From 7c7da6671aa0ff9725a61ebca3971d515f522c75 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 7 Dec 2018 15:49:15 -1000 Subject: [PATCH] SIMD refactor --- .idea/codeStyles/Project.xml | 31 +- .idea/encodings.xml | 4 + CMakeLists.txt | 3 +- DataSpec/DNACommon/ANIM.cpp | 95 ++--- DataSpec/DNACommon/ANIM.hpp | 29 +- DataSpec/DNACommon/AROTBuilder.cpp | 8 +- DataSpec/DNACommon/BabeDead.cpp | 22 +- DataSpec/DNACommon/CMDL.cpp | 16 +- DataSpec/DNACommon/DNACommon.hpp | 19 +- DataSpec/DNACommon/DeafBabe.cpp | 8 +- DataSpec/DNACommon/MAPA.cpp | 24 +- DataSpec/DNACommon/MAPU.cpp | 21 +- DataSpec/DNACommon/MLVL.cpp | 13 +- DataSpec/DNACommon/OBBTreeBuilder.cpp | 22 +- DataSpec/DNAMP1/ANIM.cpp | 14 +- DataSpec/DNAMP1/CINF.cpp | 8 +- DataSpec/DNAMP1/CMDLMaterials.cpp | 32 +- DataSpec/DNAMP1/DNAMP1.cpp | 2 +- DataSpec/DNAMP1/FRME.cpp | 61 +-- DataSpec/DNAMP1/MREA.cpp | 6 +- DataSpec/DNAMP1/PATH.cpp | 15 +- DataSpec/DNAMP1/ScriptObjects/Actor.cpp | 2 +- DataSpec/DNAMP1/ScriptObjects/DoorArea.cpp | 2 +- .../DNAMP1/ScriptObjects/IScriptObject.cpp | 7 +- DataSpec/DNAMP1/ScriptObjects/Platform.cpp | 2 +- DataSpec/DNAMP2/ANIM.cpp | 12 +- DataSpec/DNAMP2/CINF.cpp | 8 +- DataSpec/DNAMP2/DNAMP2.cpp | 2 +- DataSpec/DNAMP3/ANIM.cpp | 12 +- DataSpec/DNAMP3/CINF.cpp | 8 +- DataSpec/DNAMP3/DNAMP3.cpp | 2 +- Editor/SplashScreen.cpp | 2 +- Editor/ViewManager.cpp | 14 +- NESEmulator/malloc.h | 3 + Runtime/Audio/CSfxManager.cpp | 28 +- Runtime/AutoMapper/CAutoMapper.cpp | 18 +- Runtime/AutoMapper/CMapArea.cpp | 6 +- Runtime/AutoMapper/CMapUniverse.cpp | 14 +- Runtime/AutoMapper/CMapWorld.cpp | 48 +-- Runtime/AutoMapper/CMappableObject.cpp | 43 +-- Runtime/CSortedLists.cpp | 32 +- Runtime/CStateManager.cpp | 40 +- Runtime/Camera/CBallCamera.cpp | 162 ++++---- Runtime/Camera/CCameraFilter.cpp | 4 +- Runtime/Camera/CCameraManager.cpp | 2 +- Runtime/Camera/CCinematicCamera.cpp | 4 +- Runtime/Camera/CFirstPersonCamera.cpp | 38 +- Runtime/Camera/CGameCamera.cpp | 8 +- Runtime/Camera/CInterpolationCamera.cpp | 4 +- Runtime/Camera/CPathCamera.cpp | 6 +- Runtime/Character/CActorLights.cpp | 38 +- Runtime/Character/CAdditiveBodyState.cpp | 6 +- Runtime/Character/CAnimData.cpp | 9 + Runtime/Character/CAnimData.hpp | 1 + Runtime/Character/CAnimSource.cpp | 14 +- Runtime/Character/CBodyController.cpp | 2 +- Runtime/Character/CBodyState.cpp | 69 ++-- Runtime/Character/CGroundMovement.cpp | 42 +-- Runtime/Character/CModelData.cpp | 4 +- Runtime/Character/CRagDoll.cpp | 4 +- Runtime/Character/CRagDoll.hpp | 2 + Runtime/Character/CSteeringBehaviors.cpp | 4 +- Runtime/Collision/CAABoxFilter.cpp | 6 +- Runtime/Collision/CAreaOctTree.cpp | 18 +- Runtime/Collision/CCollidableOBBTree.cpp | 2 +- Runtime/Collision/CCollidableSphere.cpp | 52 +-- Runtime/Collision/CCollisionActor.cpp | 4 +- Runtime/Collision/CCollisionActorManager.cpp | 2 +- Runtime/Collision/CCollisionInfo.hpp | 6 +- Runtime/Collision/CGameCollision.cpp | 14 +- .../Collision/CJointCollisionDescription.cpp | 4 +- Runtime/Collision/CMetroidAreaCollider.cpp | 6 +- Runtime/Collision/CRayCastResult.cpp | 3 +- Runtime/Collision/CollisionUtil.cpp | 156 ++++---- Runtime/Graphics/CBooRenderer.cpp | 71 ++-- Runtime/Graphics/CGraphics.cpp | 12 +- Runtime/Graphics/CLight.cpp | 2 +- Runtime/Graphics/CLineRenderer.cpp | 48 +-- Runtime/Graphics/CModelBoo.cpp | 123 +++--- Runtime/Graphics/CPVSVisOctree.cpp | 36 +- Runtime/Graphics/CRainSplashGenerator.cpp | 2 +- Runtime/Graphics/CSimpleShadow.cpp | 14 +- Runtime/Graphics/Shaders/CAABoxShader.cpp | 68 ++-- .../Graphics/Shaders/CColoredQuadFilter.cpp | 10 +- Runtime/Graphics/Shaders/CEnvFxShaders.cpp | 2 +- .../Graphics/Shaders/CFluidPlaneShader.cpp | 20 +- Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp | 22 +- .../Graphics/Shaders/CTextSupportShader.cpp | 18 +- .../Graphics/Shaders/CTexturedQuadFilter.cpp | 16 +- Runtime/GuiSys/CAuiEnergyBarT01.cpp | 6 +- Runtime/GuiSys/CAuiImagePane.cpp | 22 +- Runtime/GuiSys/CCompoundTargetReticle.cpp | 38 +- Runtime/GuiSys/CFontImageDef.cpp | 4 +- Runtime/GuiSys/CGuiCamera.cpp | 2 +- Runtime/GuiSys/CGuiFrame.cpp | 2 +- Runtime/GuiSys/CGuiModel.cpp | 2 +- Runtime/GuiSys/CGuiPane.cpp | 8 +- Runtime/GuiSys/CGuiTextPane.cpp | 12 +- Runtime/GuiSys/CHudBossEnergyInterface.cpp | 2 +- Runtime/GuiSys/CHudDecoInterface.cpp | 30 +- Runtime/GuiSys/CHudEnergyInterface.cpp | 6 +- Runtime/GuiSys/CHudFreeLookInterface.cpp | 6 +- Runtime/GuiSys/CHudHelmetInterface.cpp | 2 +- Runtime/GuiSys/CHudMissileInterface.cpp | 8 +- Runtime/GuiSys/CHudRadarInterface.cpp | 28 +- Runtime/GuiSys/CHudThreatInterface.cpp | 10 +- Runtime/GuiSys/CHudVisorBeamMenu.cpp | 12 +- Runtime/GuiSys/CInstruction.cpp | 4 +- Runtime/GuiSys/COrbitPointMarker.cpp | 22 +- Runtime/GuiSys/CScanDisplay.cpp | 16 +- Runtime/GuiSys/CSplashScreen.cpp | 12 +- Runtime/GuiSys/CTextExecuteBuffer.cpp | 4 +- Runtime/GuiSys/CTextRenderBuffer.cpp | 24 +- Runtime/MP1/CArtifactDoll.cpp | 4 +- Runtime/MP1/CFaceplateDecoration.cpp | 2 +- Runtime/MP1/CFrontEndUI.cpp | 24 +- Runtime/MP1/CInGameGuiManager.cpp | 4 +- Runtime/MP1/CInventoryScreen.cpp | 2 +- Runtime/MP1/CMessageScreen.cpp | 2 +- Runtime/MP1/COptionsScreen.cpp | 2 +- Runtime/MP1/CPauseScreen.cpp | 4 +- Runtime/MP1/CPauseScreenBase.cpp | 14 +- Runtime/MP1/CPlayerVisor.cpp | 25 +- Runtime/MP1/CSamusDoll.cpp | 28 +- Runtime/MP1/CSamusHud.cpp | 47 ++- Runtime/MP1/CSlideShow.cpp | 4 +- Runtime/MP1/CSlideShow.hpp | 2 +- Runtime/MP1/World/CMetaree.cpp | 2 +- Runtime/MP1/World/CNewIntroBoss.hpp | 2 +- Runtime/MP1/World/CParasite.cpp | 19 +- Runtime/MP1/World/CSpacePirate.cpp | 355 ++++++++++++++++-- Runtime/MP1/World/CSpacePirate.hpp | 9 +- Runtime/Particle/CDecal.cpp | 16 +- Runtime/Particle/CElementGen.cpp | 92 ++--- Runtime/Particle/CElementGen.hpp | 2 +- Runtime/Particle/CEmitterElement.cpp | 6 +- Runtime/Particle/CFlameWarp.cpp | 2 +- Runtime/Particle/CModVectorElement.cpp | 8 +- Runtime/Particle/CParticleElectric.cpp | 2 +- Runtime/Particle/CParticleSwoosh.cpp | 12 +- Runtime/Particle/CRealElement.cpp | 8 +- Runtime/Particle/CVectorElement.cpp | 10 +- Runtime/Weapon/CBomb.cpp | 12 +- Runtime/Weapon/CBurstFire.cpp | 4 +- Runtime/Weapon/CGameProjectile.cpp | 16 +- Runtime/Weapon/CGunWeapon.cpp | 4 +- Runtime/Weapon/CPhazonBeam.cpp | 10 +- Runtime/Weapon/CPlayerGun.cpp | 16 +- Runtime/Weapon/CProjectileWeapon.cpp | 12 +- Runtime/Weapon/CWeapon.cpp | 2 +- Runtime/World/CActor.cpp | 8 +- Runtime/World/CActorModelParticles.cpp | 239 +++++++++++- Runtime/World/CActorModelParticles.hpp | 19 +- Runtime/World/CAi.cpp | 4 +- Runtime/World/CEnvFxManager.cpp | 38 +- Runtime/World/CEnvFxManager.hpp | 7 +- Runtime/World/CFluidPlane.cpp | 8 +- Runtime/World/CFluidPlane.hpp | 9 +- Runtime/World/CFluidPlaneCPU.cpp | 88 +++-- Runtime/World/CFluidPlaneDoor.cpp | 37 +- Runtime/World/CFluidPlaneGPU.cpp | 2 +- Runtime/World/CGameArea.cpp | 56 +-- Runtime/World/CHUDBillboardEffect.cpp | 2 +- Runtime/World/CMorphBall.cpp | 66 ++-- Runtime/World/CMorphBallShadow.cpp | 16 +- Runtime/World/CPathFindArea.cpp | 18 +- Runtime/World/CPathFindRegion.cpp | 38 +- Runtime/World/CPathFindSearch.cpp | 16 +- Runtime/World/CPatterned.cpp | 36 +- Runtime/World/CPatterned.hpp | 4 +- Runtime/World/CPhysicsActor.cpp | 4 +- Runtime/World/CPlayer.cpp | 300 +++++++-------- Runtime/World/CPlayerCameraBob.cpp | 23 +- Runtime/World/CScriptActorRotate.cpp | 6 +- Runtime/World/CScriptCameraHint.cpp | 4 +- Runtime/World/CScriptCoverPoint.cpp | 41 +- Runtime/World/CScriptCoverPoint.hpp | 14 +- Runtime/World/CScriptDamageableTrigger.cpp | 12 +- Runtime/World/CScriptDebris.cpp | 24 +- Runtime/World/CScriptDistanceFog.cpp | 2 +- Runtime/World/CScriptDock.cpp | 2 +- Runtime/World/CScriptGunTurret.cpp | 4 +- Runtime/World/CScriptPlayerActor.cpp | 2 +- Runtime/World/CScriptSpecialFunction.cpp | 6 +- Runtime/World/CScriptSteam.cpp | 4 +- Runtime/World/CScriptTrigger.hpp | 2 + Runtime/World/CScriptWater.cpp | 48 +-- Runtime/World/CTeamAiMgr.cpp | 18 +- Runtime/World/CTeamAiMgr.hpp | 2 + Runtime/World/CWallWalker.cpp | 2 +- Runtime/World/CWorldLight.cpp | 20 +- Runtime/World/CWorldTransManager.cpp | 14 +- Runtime/World/ScriptLoader.cpp | 33 +- hecl | 2 +- hecl-gui | 2 +- lldb-extras/.lldbinit | 15 +- lldb-extras/urde_lldb_tools.py | 2 +- specter | 2 +- visigen/VISIBuilder.cpp | 60 +-- visigen/VISIBuilder.hpp | 3 +- visigen/VISIRenderer.cpp | 12 +- 201 files changed, 2475 insertions(+), 1906 deletions(-) create mode 100644 .idea/encodings.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index c59141097..d7e7012ec 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -2,9 +2,9 @@ - - - - - diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000..15a15b218 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 510db2e7b..ffa67e45e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,8 +115,7 @@ else() message(STATUS "Building with x87 Vector ISA") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\ - -Wno-multichar -fno-exceptions -fno-rtti -Wno-narrowing -Wno-nullability-completeness -Werror=return-type") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -fno-exceptions -fno-rtti -Werror") if(APPLE) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin") diff --git a/DataSpec/DNACommon/ANIM.cpp b/DataSpec/DNACommon/ANIM.cpp index 091c4e573..64888baa8 100644 --- a/DataSpec/DNACommon/ANIM.cpp +++ b/DataSpec/DNACommon/ANIM.cpp @@ -39,50 +39,53 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector& ch static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div) { float q = M_PIF / 2.0f / float(div); + zeus::simd_floats f(quat.simd); return { { - atInt32(std::asin(quat.v4.vec[1]) / q), - atInt32(std::asin(quat.v4.vec[2]) / q), - atInt32(std::asin(quat.v4.vec[3]) / q), + atInt32(std::asin(f[1]) / q), + atInt32(std::asin(f[2]) / q), + atInt32(std::asin(f[3]) / q), }, - (quat.v4.vec[0] < 0.f) ? true : false + (f[0] < 0.f) }; } static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div) { float q = M_PIF / 2.0f / float(div); - Value retval = - { + athena::simd_floats f = { 0.0f, std::sin(v.v[0] * q), std::sin(v.v[1] * q), std::sin(v.v[2] * q), }; - retval.v4.vec[0] = std::sqrt(std::max((1.0f - - (retval.v4.vec[1] * retval.v4.vec[1] + - retval.v4.vec[2] * retval.v4.vec[2] + - retval.v4.vec[3] * retval.v4.vec[3])), 0.0f)); - retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0]; + f[0] = std::sqrt(std::max((1.0f - + (f[1] * f[1] + + f[2] * f[2] + + f[3] * f[3])), 0.0f)); + f[0] = v.w ? -f[0] : f[0]; + Value retval; + retval.simd.copy_from(f); return retval; } static inline Value DequantizeRotation_3(const QuantizedRot& v, atUint32 div) { float q = 1.0f / float(div); - Value retval = - { + athena::simd_floats f = { 0.0f, v.v[0] * q, v.v[1] * q, v.v[2] * q, }; - retval.v4.vec[0] = std::sqrt(std::max((1.0f - - (retval.v4.vec[1] * retval.v4.vec[1] + - retval.v4.vec[2] * retval.v4.vec[2] + - retval.v4.vec[3] * retval.v4.vec[3])), 0.0f)); - retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0]; + f[0] = std::sqrt(std::max((1.0f - + (f[1] * f[1] + + f[2] * f[2] + + f[3] * f[3])), 0.0f)); + f[0] = v.w ? -f[0] : f[0]; + Value retval; + retval.simd.copy_from(f); return retval; } @@ -337,9 +340,10 @@ BitstreamWriter::write(const std::vector>& chanKeys, ++it) { const Value* key = &*it; - maxTransVal = std::max(maxTransVal, std::fabs(key->v3.vec[0])); - maxTransVal = std::max(maxTransVal, std::fabs(key->v3.vec[1])); - maxTransVal = std::max(maxTransVal, std::fabs(key->v3.vec[2])); + zeus::simd_floats f(key->simd); + maxTransVal = std::max(maxTransVal, std::fabs(f[0])); + maxTransVal = std::max(maxTransVal, std::fabs(f[1])); + maxTransVal = std::max(maxTransVal, std::fabs(f[2])); } break; } @@ -350,9 +354,10 @@ BitstreamWriter::write(const std::vector>& chanKeys, ++it) { const Value* key = &*it; - maxScaleVal = std::max(maxScaleVal, std::fabs(key->v3.vec[0])); - maxScaleVal = std::max(maxScaleVal, std::fabs(key->v3.vec[1])); - maxScaleVal = std::max(maxScaleVal, std::fabs(key->v3.vec[2])); + zeus::simd_floats f(key->simd); + maxScaleVal = std::max(maxScaleVal, std::fabs(f[0])); + maxScaleVal = std::max(maxScaleVal, std::fabs(f[1])); + maxScaleVal = std::max(maxScaleVal, std::fabs(f[2])); } break; } @@ -383,17 +388,19 @@ BitstreamWriter::write(const std::vector>& chanKeys, } case Channel::Type::Translation: { - chan.i = {atInt32((*kit)[0].v3.vec[0] / transMultOut), - atInt32((*kit)[0].v3.vec[1] / transMultOut), - atInt32((*kit)[0].v3.vec[2] / transMultOut)}; + zeus::simd_floats f((*kit)[0].simd); + chan.i = {atInt32(f[0] / transMultOut), + atInt32(f[1] / transMultOut), + atInt32(f[2] / transMultOut)}; initVals.push_back(chan.i); break; } case Channel::Type::Scale: { - chan.i = {atInt32((*kit)[0].v3.vec[0] / scaleMultOut), - atInt32((*kit)[0].v3.vec[1] / scaleMultOut), - atInt32((*kit)[0].v3.vec[2] / scaleMultOut)}; + zeus::simd_floats f((*kit)[0].simd); + chan.i = {atInt32(f[0] / scaleMultOut), + atInt32(f[1] / scaleMultOut), + atInt32(f[2] / scaleMultOut)}; initVals.push_back(chan.i); break; } @@ -431,9 +438,10 @@ BitstreamWriter::write(const std::vector>& chanKeys, it != kit->end(); ++it) { - QuantizedValue cur = {atInt32(it->v3.vec[0] / transMultOut), - atInt32(it->v3.vec[1] / transMultOut), - atInt32(it->v3.vec[2] / transMultOut)}; + zeus::simd_floats f(it->simd); + QuantizedValue cur = {atInt32(f[0] / transMultOut), + atInt32(f[1] / transMultOut), + atInt32(f[2] / transMultOut)}; chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0))); chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1))); chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2))); @@ -447,9 +455,10 @@ BitstreamWriter::write(const std::vector>& chanKeys, it != kit->end(); ++it) { - QuantizedValue cur = {atInt32(it->v3.vec[0] / scaleMultOut), - atInt32(it->v3.vec[1] / scaleMultOut), - atInt32(it->v3.vec[2] / scaleMultOut)}; + zeus::simd_floats f(it->simd); + QuantizedValue cur = {atInt32(f[0] / scaleMultOut), + atInt32(f[1] / scaleMultOut), + atInt32(f[2] / scaleMultOut)}; chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0))); chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1))); chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2))); @@ -490,9 +499,10 @@ BitstreamWriter::write(const std::vector>& chanKeys, } case Channel::Type::Translation: { - QuantizedValue cur = {atInt32(val.v3.vec[0] / transMultOut), - atInt32(val.v3.vec[1] / transMultOut), - atInt32(val.v3.vec[2] / transMultOut)}; + zeus::simd_floats f(val.simd); + QuantizedValue cur = {atInt32(f[0] / transMultOut), + atInt32(f[1] / transMultOut), + atInt32(f[2] / transMultOut)}; quantize(newData.get(), chan.q[0], cur[0] - last[0]); quantize(newData.get(), chan.q[1], cur[1] - last[1]); quantize(newData.get(), chan.q[2], cur[2] - last[2]); @@ -501,9 +511,10 @@ BitstreamWriter::write(const std::vector>& chanKeys, } case Channel::Type::Scale: { - QuantizedValue cur = {atInt32(val.v3.vec[0] / scaleMultOut), - atInt32(val.v3.vec[1] / scaleMultOut), - atInt32(val.v3.vec[2] / scaleMultOut)}; + zeus::simd_floats f(val.simd); + QuantizedValue cur = {atInt32(f[0] / scaleMultOut), + atInt32(f[1] / scaleMultOut), + atInt32(f[2] / scaleMultOut)}; quantize(newData.get(), chan.q[0], cur[0] - last[0]); quantize(newData.get(), chan.q[1], cur[1] - last[1]); quantize(newData.get(), chan.q[2], cur[2] - last[2]); diff --git a/DataSpec/DNACommon/ANIM.hpp b/DataSpec/DNACommon/ANIM.hpp index 444d5a024..93bab6450 100644 --- a/DataSpec/DNACommon/ANIM.hpp +++ b/DataSpec/DNACommon/ANIM.hpp @@ -6,33 +6,22 @@ namespace DataSpec::DNAANIM { -union Value +struct Value { - atVec3f v3; - atVec4f v4; - Value(atVec3f v) : v3(v) {} - Value(atVec4f v) : v4(v) {} - Value(float x, float y, float z) - { - v3.vec[0] = x; - v3.vec[1] = y; - v3.vec[2] = z; - v4.vec[3] = 0.0; - } - Value(float w, float x, float y, float z) - { - v4.vec[0] = w; - v4.vec[1] = x; - v4.vec[2] = y; - v4.vec[3] = z; - } + athena::simd simd; + Value() = default; + Value(const athena::simd& s) : simd(s) {} + Value(const atVec3f& v) : simd(v.simd) {} + Value(const atVec4f& v) : simd(v.simd) {} + Value(float x, float y, float z) : simd(x, y, z, 0.f) {} + Value(float w, float x, float y, float z) : simd(w, x, y, z) {} }; struct QuantizedValue { atInt32 v[4]; atInt32& operator[] (size_t idx) {return v[idx];} - const atInt32& operator[] (size_t idx) const + atInt32 operator[] (size_t idx) const {return v[idx];} int qFrom(const QuantizedValue& other, size_t idx) const diff --git a/DataSpec/DNACommon/AROTBuilder.cpp b/DataSpec/DNACommon/AROTBuilder.cpp index c43262920..9f76a12e1 100644 --- a/DataSpec/DNACommon/AROTBuilder.cpp +++ b/DataSpec/DNACommon/AROTBuilder.cpp @@ -86,7 +86,7 @@ void AROTBuilder::Node::addChild(int level, int minChildren, const std::vector>& secsOut, const hecl::Proje { for (int i=0 ; i<2 ; ++i) { - int tmpV = int(v.val.vec[i] * 32768.f); + int tmpV = int(v.val.simd[i] * 32768.f); tmpV = zeus::clamp(-32768, tmpV, 32767); w.writeInt16Big(atInt16(tmpV)); } diff --git a/DataSpec/DNACommon/DNACommon.hpp b/DataSpec/DNACommon/DNACommon.hpp index 437b13125..16e46354b 100644 --- a/DataSpec/DNACommon/DNACommon.hpp +++ b/DataSpec/DNACommon/DNACommon.hpp @@ -41,20 +41,23 @@ template <> inline void DNAColor::Enumerate(typename ReadYaml: size_t count; if (auto v = _r.enterSubVector(nullptr, count)) { - r = (count >= 1) ? _r.readFloat(nullptr) : 0.f; - g = (count >= 2) ? _r.readFloat(nullptr) : 0.f; - b = (count >= 3) ? _r.readFloat(nullptr) : 0.f; - a = (count >= 4) ? _r.readFloat(nullptr) : 0.f; + zeus::simd_floats f; + f[0] = (count >= 1) ? _r.readFloat(nullptr) : 0.f; + f[1] = (count >= 2) ? _r.readFloat(nullptr) : 0.f; + f[2] = (count >= 3) ? _r.readFloat(nullptr) : 0.f; + f[3] = (count >= 4) ? _r.readFloat(nullptr) : 0.f; + mSimd.copy_from(f); } } template <> inline void DNAColor::Enumerate(typename WriteYaml::StreamT& _w) { if (auto v = _w.enterSubVector(nullptr)) { - _w.writeFloat(nullptr, r); - _w.writeFloat(nullptr, g); - _w.writeFloat(nullptr, b); - _w.writeFloat(nullptr, a); + zeus::simd_floats f(mSimd); + _w.writeFloat(nullptr, f[0]); + _w.writeFloat(nullptr, f[1]); + _w.writeFloat(nullptr, f[2]); + _w.writeFloat(nullptr, f[3]); } } template <> inline void DNAColor::Enumerate(typename BinarySize::StreamT& _s) diff --git a/DataSpec/DNACommon/DeafBabe.cpp b/DataSpec/DNACommon/DeafBabe.cpp index eb08ea1ca..e4d9d62c5 100644 --- a/DataSpec/DNACommon/DeafBabe.cpp +++ b/DataSpec/DNACommon/DeafBabe.cpp @@ -15,10 +15,10 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b os << "material_index = []\n" "col_bm = bmesh.new()\n"; for (const atVec3f& vert : db.verts) - os.format("col_bm.verts.new((%f,%f,%f))\n", - vert.vec[0], - vert.vec[1], - vert.vec[2]); + { + zeus::simd_floats f(vert.simd); + os.format("col_bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]); + } os << "col_bm.verts.ensure_lookup_table()\n"; diff --git a/DataSpec/DNACommon/MAPA.cpp b/DataSpec/DNACommon/MAPA.cpp index 04909cf6c..2bfdc3a04 100644 --- a/DataSpec/DNACommon/MAPA.cpp +++ b/DataSpec/DNACommon/MAPA.cpp @@ -185,6 +185,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, if (mapa.version < 5) { const MAPA::MappableObjectMP1_2* moMP12 = static_cast(mo.get()); + zeus::simd_floats mtxF[3]; + for (int i = 0; i < 3; ++i) + moMP12->transformMtx[i].simd.copy_to(mtxF[i]); os.format("obj = bpy.data.objects.new('MAPOBJ_%02d', None)\n" "bpy.context.scene.objects.link(obj)\n" "obj.retro_mappable_type = %d\n" @@ -197,15 +200,18 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, "obj.rotation_quaternion = mtxd[1]\n" "obj.scale = mtxd[2]\n", moIdx, moMP12->type, RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, - moMP12->transformMtx[0].vec[0], moMP12->transformMtx[0].vec[1], moMP12->transformMtx[0].vec[2], moMP12->transformMtx[0].vec[3], - moMP12->transformMtx[1].vec[0], moMP12->transformMtx[1].vec[1], moMP12->transformMtx[1].vec[2], moMP12->transformMtx[1].vec[3], - moMP12->transformMtx[2].vec[0], moMP12->transformMtx[2].vec[1], moMP12->transformMtx[2].vec[2], moMP12->transformMtx[2].vec[3]); + mtxF[0][0], mtxF[0][1], mtxF[0][2], mtxF[0][3], + mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], + mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]); ++moIdx; continue; } else { const MAPA::MappableObjectMP3* moMP3 = static_cast(mo.get()); + zeus::simd_floats mtxF[3]; + for (int i = 0; i < 3; ++i) + moMP3->transformMtx[i].simd.copy_to(mtxF[i]); os.format("obj = bpy.data.objects.new('MAPOBJ_%02d', None)\n" "bpy.context.scene.objects.link(obj)\n" "obj.retro_mappable_type = %d\n" @@ -218,9 +224,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, "obj.rotation_quaternion = mtxd[1]\n" "obj.scale = mtxd[2]\n", moIdx, moMP3->type, RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, - moMP3->transformMtx[0].vec[0], moMP3->transformMtx[0].vec[1], moMP3->transformMtx[0].vec[2], moMP3->transformMtx[0].vec[3], - moMP3->transformMtx[1].vec[0], moMP3->transformMtx[1].vec[1], moMP3->transformMtx[1].vec[2], moMP3->transformMtx[1].vec[3], - moMP3->transformMtx[2].vec[0], moMP3->transformMtx[2].vec[1], moMP3->transformMtx[2].vec[2], moMP3->transformMtx[2].vec[3]); + mtxF[0][0], mtxF[0][1], mtxF[0][2], mtxF[0][3], + mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], + mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]); ++moIdx; continue; } @@ -232,8 +238,10 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, /* Read in verts */ for (const atVec3f& vert : mapa.vertices) - os.format("bm.verts.new((%f,%f,%f))\n", - vert.vec[0], vert.vec[1], vert.vec[2]); + { + zeus::simd_floats f(vert.simd); + os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]); + } os << "bm.verts.ensure_lookup_table()\n"; /* Read in surfaces */ diff --git a/DataSpec/DNACommon/MAPU.cpp b/DataSpec/DNACommon/MAPU.cpp index 5b7f7f7c3..05265000f 100644 --- a/DataSpec/DNACommon/MAPU.cpp +++ b/DataSpec/DNACommon/MAPU.cpp @@ -47,6 +47,10 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, { hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(wld.mlvl); const MAPU::Transform& wldXf = wld.transform; + zeus::simd_floats wldXfF[3]; + for (int i = 0; i < 3; ++i) + wldXf.xf[i].simd.copy_to(wldXfF[i]); + zeus::simd_floats hexColorF(wld.hexColor.mSimd); os.format("wldObj = bpy.data.objects.new('%s', None)\n" "mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n" "mtxd = mtx.decompose()\n" @@ -57,14 +61,17 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, "wldObj.retro_mapworld_color = (%f, %f, %f, %f)\n" "wldObj.retro_mapworld_path = '''%s'''\n" "bpy.context.scene.objects.link(wldObj)\n", wld.name.c_str(), - wldXf.xf[0].vec[0], wldXf.xf[0].vec[1], wldXf.xf[0].vec[2], wldXf.xf[0].vec[3], - wldXf.xf[1].vec[0], wldXf.xf[1].vec[1], wldXf.xf[1].vec[2], wldXf.xf[1].vec[3], - wldXf.xf[2].vec[0], wldXf.xf[2].vec[1], wldXf.xf[2].vec[2], wldXf.xf[2].vec[3], - wld.hexColor.r, wld.hexColor.g, wld.hexColor.b, wld.hexColor.a, + wldXfF[0][0], wldXfF[0][1], wldXfF[0][2], wldXfF[0][3], + wldXfF[1][0], wldXfF[1][1], wldXfF[1][2], wldXfF[1][3], + wldXfF[2][0], wldXfF[2][1], wldXfF[2][2], wldXfF[2][3], + hexColorF[0], hexColorF[1], hexColorF[2], hexColorF[3], path.getParentPath().getRelativePathUTF8().data()); int idx = 0; for (const MAPU::Transform& hexXf : wld.hexTransforms) { + zeus::simd_floats hexXfF[3]; + for (int i = 0; i < 3; ++i) + hexXf.xf[i].simd.copy_to(hexXfF[i]); os.format("obj = bpy.data.objects.new('%s_%d', hexMesh)\n" "mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n" "mtxd = mtx.decompose()\n" @@ -75,9 +82,9 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, "bpy.context.scene.objects.link(obj)\n" "obj.parent = wldObj\n", wld.name.c_str(), idx++, - hexXf.xf[0].vec[0], hexXf.xf[0].vec[1], hexXf.xf[0].vec[2], hexXf.xf[0].vec[3], - hexXf.xf[1].vec[0], hexXf.xf[1].vec[1], hexXf.xf[1].vec[2], hexXf.xf[1].vec[3], - hexXf.xf[2].vec[0], hexXf.xf[2].vec[1], hexXf.xf[2].vec[2], hexXf.xf[2].vec[3]); + hexXfF[0][0], hexXfF[0][1], hexXfF[0][2], hexXfF[0][3], + hexXfF[1][0], hexXfF[1][1], hexXfF[1][2], hexXfF[1][3], + hexXfF[2][0], hexXfF[2][1], hexXfF[2][2], hexXfF[2][3]); } } diff --git a/DataSpec/DNACommon/MLVL.cpp b/DataSpec/DNACommon/MLVL.cpp index 9eb311fc5..c699e6dcc 100644 --- a/DataSpec/DNACommon/MLVL.cpp +++ b/DataSpec/DNACommon/MLVL.cpp @@ -44,6 +44,9 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, hecl::SystemUTF8Conv areaDirName(*mreaEntry->unique.m_areaName); os.AABBToBMesh(area.aabb[0], area.aabb[1]); + zeus::simd_floats xfMtxF[3]; + for (int i = 0; i < 3; ++i) + area.transformMtx[i].simd.copy_to(xfMtxF[i]); os.format("box_mesh = bpy.data.meshes.new('''%s''')\n" "bm.to_mesh(box_mesh)\n" "bm.free()\n" @@ -56,9 +59,9 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, "box.rotation_quaternion = mtxd[1]\n" "box.scale = mtxd[2]\n", areaDirName.str().data(), - area.transformMtx[0].vec[0], area.transformMtx[0].vec[1], area.transformMtx[0].vec[2], area.transformMtx[0].vec[3], - area.transformMtx[1].vec[0], area.transformMtx[1].vec[1], area.transformMtx[1].vec[2], area.transformMtx[1].vec[3], - area.transformMtx[2].vec[0], area.transformMtx[2].vec[1], area.transformMtx[2].vec[2], area.transformMtx[2].vec[3]); + xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], xfMtxF[0][3], + xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], xfMtxF[1][3], + xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], xfMtxF[2][3]); /* Insert dock planes */ int dockIdx = 0; @@ -72,7 +75,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, int idx = 0; for (const atVec3f& pv : dock.planeVerts) { - zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg; + const zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg; os.format("bm.verts.new((%f,%f,%f))\n" "bm.verts.ensure_lookup_table()\n", pvRel[0], pvRel[1], pvRel[2]); @@ -88,7 +91,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, "bm.free()\n" "dockObj.parent = box\n"; os.format("dockObj.location = (%f,%f,%f)\n", - pvAvg[0], pvAvg[1], pvAvg[2]); + float(pvAvg[0]), float(pvAvg[1]), float(pvAvg[2])); ++dockIdx; } ++areaIdx; diff --git a/DataSpec/DNACommon/OBBTreeBuilder.cpp b/DataSpec/DNACommon/OBBTreeBuilder.cpp index 3f9d246ac..895fdcacf 100644 --- a/DataSpec/DNACommon/OBBTreeBuilder.cpp +++ b/DataSpec/DNACommon/OBBTreeBuilder.cpp @@ -59,9 +59,9 @@ static FittedOBB BuildFromCovarianceMatrix(gmm::dense_matrix& C, r.normalize(); u.normalize(), f.normalize(); // set the rotation matrix using the eigvenvectors - ret.xf.basis[0][0]=r.x; ret.xf.basis[1][0]=u.x; ret.xf.basis[2][0]=f.x; - ret.xf.basis[0][1]=r.y; ret.xf.basis[1][1]=u.y; ret.xf.basis[2][1]=f.y; - ret.xf.basis[0][2]=r.z; ret.xf.basis[1][2]=u.z; ret.xf.basis[2][2]=f.z; + ret.xf.basis[0] = r; + ret.xf.basis[1] = u; + ret.xf.basis[2] = f; // now build the bounding box extents in the rotated frame zeus::CVector3f minim(1e10f, 1e10f, 1e10f), maxim(-1e10f, -1e10f, -1e10f); @@ -115,11 +115,11 @@ static FittedOBB FitOBB(const ColMesh& mesh, const std::vector& index) Am += Ai; // these bits set the c terms to Am*E[xx], Am*E[xy], Am*E[xz].... - cxx += ( 9.0*mui.x*mui.x + p.x*p.x + q.x*q.x + r.x*r.x )*(Ai/12.0); - cxy += ( 9.0*mui.x*mui.y + p.x*p.y + q.x*q.y + r.x*r.y )*(Ai/12.0); - cxz += ( 9.0*mui.x*mui.z + p.x*p.z + q.x*q.z + r.x*r.z )*(Ai/12.0); - cyy += ( 9.0*mui.y*mui.y + p.y*p.y + q.y*q.y + r.y*r.y )*(Ai/12.0); - cyz += ( 9.0*mui.y*mui.z + p.y*p.z + q.y*q.z + r.y*r.z )*(Ai/12.0); + cxx += ( 9.0*mui.x()*mui.x() + p.x()*p.x() + q.x()*q.x() + r.x()*r.x() )*(Ai/12.0); + cxy += ( 9.0*mui.x()*mui.y() + p.x()*p.y() + q.x()*q.y() + r.x()*r.y() )*(Ai/12.0); + cxz += ( 9.0*mui.x()*mui.z() + p.x()*p.z() + q.x()*q.z() + r.x()*r.z() )*(Ai/12.0); + cyy += ( 9.0*mui.y()*mui.y() + p.y()*p.y() + q.y()*q.y() + r.y()*r.y() )*(Ai/12.0); + cyz += ( 9.0*mui.y()*mui.z() + p.y()*p.z() + q.y()*q.z() + r.y()*r.z() )*(Ai/12.0); } if (zeus::close_enough(Am, 0.f)) @@ -131,8 +131,8 @@ static FittedOBB FitOBB(const ColMesh& mesh, const std::vector& index) cxx /= Am; cxy /= Am; cxz /= Am; cyy /= Am; cyz /= Am; czz /= Am; // now subtract off the E[x]*E[x], E[x]*E[y], ... terms - cxx -= mu.x*mu.x; cxy -= mu.x*mu.y; cxz -= mu.x*mu.z; - cyy -= mu.y*mu.y; cyz -= mu.y*mu.z; czz -= mu.z*mu.z; + cxx -= mu.x()*mu.x(); cxy -= mu.x()*mu.y(); cxz -= mu.x()*mu.z(); + cyy -= mu.y()*mu.y(); cyz -= mu.y()*mu.z(); czz -= mu.z()*mu.z(); // now build the covariance matrix C(0,0)=cxx; C(0,1)=cxy; C(0,2)=cxz; @@ -169,7 +169,7 @@ static std::unique_ptr RecursiveMakeNode(const ColMesh& mesh, const std::v for (int i = 0; i < 3; ++i) { n->xf[i] = zeus::CVector4f{obb.xf.basis[i]}; - n->xf[i].vec[3] = obb.xf.origin[i]; + n->xf[i].simd[3] = float(obb.xf.origin[i]); } n->halfExtent = obb.he; diff --git a/DataSpec/DNAMP1/ANIM.cpp b/DataSpec/DNAMP1/ANIM.cpp index bf0a2f298..393b8082c 100644 --- a/DataSpec/DNAMP1/ANIM.cpp +++ b/DataSpec/DNAMP1/ANIM.cpp @@ -52,7 +52,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI { size_t idx = 0; for (const DNAANIM::Value& val : rotKeys) - fixedRotKeys[idx++][c] = val.v4.vec[c]; + fixedRotKeys[idx++][c] = val.simd[c]; } for (zeus::CQuaternion& rot : fixedRotKeys) @@ -77,7 +77,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI { size_t idx = 0; for (const DNAANIM::Value& val : transKeys) - fixedTransKeys[idx++][c] = val.v3.vec[c]; + fixedTransKeys[idx++][c] = val.simd[c]; } for (zeus::CVector3f& t : fixedTransKeys) @@ -281,7 +281,7 @@ void ANIM::ANIM0::Enumerate(athena::io::IStreamWriter& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(athena::io::IStreamWriter& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k::Bone& bone : inverter.getBones()) + { + zeus::simd_floats originF(bone.m_origBone.origin.simd); + zeus::simd_floats tailF(bone.m_tail.mSimd); os.format("bone = arm.edit_bones.new('%s')\n" "bone.head = (%f,%f,%f)\n" "bone.tail = (%f,%f,%f)\n" "bone.use_inherit_scale = False\n" "arm_bone_table[%u] = bone\n", getBoneNameFromId(bone.m_origBone.id)->c_str(), - bone.m_origBone.origin.vec[0], bone.m_origBone.origin.vec[1], bone.m_origBone.origin.vec[2], - bone.m_tail[0], bone.m_tail[1], bone.m_tail[2], + originF[0], originF[1], originF[2], + tailF[0], tailF[1], tailF[2], bone.m_origBone.id); + } for (const Bone& bone : bones) if (bone.parentId != 2) diff --git a/DataSpec/DNAMP1/CMDLMaterials.cpp b/DataSpec/DNAMP1/CMDLMaterials.cpp index 832280fae..ee90ca8e9 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.cpp +++ b/DataSpec/DNAMP1/CMDLMaterials.cpp @@ -1304,38 +1304,38 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction, mode = Mode::Scroll; if (gameArgs.size() < 2) Log.report(logvisor::Fatal, "Mode2 UV anim requires 2 vector arguments"); - vals[0] = gameArgs[0].vec[0]; - vals[1] = gameArgs[0].vec[1]; - vals[2] = gameArgs[1].vec[0]; - vals[3] = gameArgs[1].vec[1]; + vals[0] = gameArgs[0].simd[0]; + vals[1] = gameArgs[0].simd[1]; + vals[2] = gameArgs[1].simd[0]; + vals[3] = gameArgs[1].simd[1]; } else if (!gameFunction.compare("RetroUVMode3Node")) { mode = Mode::Rotation; if (gameArgs.size() < 2) Log.report(logvisor::Fatal, "Mode3 UV anim requires 2 arguments"); - vals[0] = gameArgs[0].vec[0]; - vals[1] = gameArgs[1].vec[0]; + vals[0] = gameArgs[0].simd[0]; + vals[1] = gameArgs[1].simd[0]; } else if (!gameFunction.compare("RetroUVMode4Node")) { mode = Mode::HStrip; if (gameArgs.size() < 4) Log.report(logvisor::Fatal, "Mode4 UV anim requires 4 arguments"); - vals[0] = gameArgs[0].vec[0]; - vals[1] = gameArgs[1].vec[0]; - vals[2] = gameArgs[2].vec[0]; - vals[3] = gameArgs[3].vec[0]; + vals[0] = gameArgs[0].simd[0]; + vals[1] = gameArgs[1].simd[0]; + vals[2] = gameArgs[2].simd[0]; + vals[3] = gameArgs[3].simd[0]; } else if (!gameFunction.compare("RetroUVMode5Node")) { mode = Mode::VStrip; if (gameArgs.size() < 4) Log.report(logvisor::Fatal, "Mode5 UV anim requires 4 arguments"); - vals[0] = gameArgs[0].vec[0]; - vals[1] = gameArgs[1].vec[0]; - vals[2] = gameArgs[2].vec[0]; - vals[3] = gameArgs[3].vec[0]; + vals[0] = gameArgs[0].simd[0]; + vals[1] = gameArgs[1].simd[0]; + vals[2] = gameArgs[2].simd[0]; + vals[3] = gameArgs[3].simd[0]; } else if (!gameFunction.compare("RetroUVMode6NodeN")) mode = Mode::Model; @@ -1344,8 +1344,8 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction, mode = Mode::CylinderEnvironment; if (gameArgs.size() < 2) Log.report(logvisor::Fatal, "Mode7 UV anim requires 2 arguments"); - vals[0] = gameArgs[0].vec[0]; - vals[1] = gameArgs[1].vec[0]; + vals[0] = gameArgs[0].simd[0]; + vals[1] = gameArgs[1].simd[0]; } else Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str()); diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index 496616219..e94c657be 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -289,7 +289,7 @@ void PAKBridge::addPATHToMREA(PAKRouter& pakRouter, } } -static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f}; +static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}}; void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, std::unordered_map& addTo, diff --git a/DataSpec/DNAMP1/FRME.cpp b/DataSpec/DNAMP1/FRME.cpp index baf3ba7bc..9a0ea0057 100644 --- a/DataSpec/DNAMP1/FRME.cpp +++ b/DataSpec/DNAMP1/FRME.cpp @@ -366,15 +366,20 @@ bool FRME::Extract(const SpecBase &dataSpec, switch(info->type) { case LITEInfo::ELightType::LocalAmbient: + { + zeus::simd_floats colorF(w.header.color.simd); os.format("bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n" "bg_node.inputs[1].default_value = %f\n", - w.header.color.vec[0], w.header.color.vec[1], w.header.color.vec[2], + colorF[0], colorF[1], colorF[2], info->distQ / 8.0); break; + } case LITEInfo::ELightType::Spot: case LITEInfo::ELightType::Directional: os << "angle = Quaternion((1.0, 0.0, 0.0), math.radians(90.0))\n"; default: + { + zeus::simd_floats colorF(w.header.color.simd); os.format("lamp = bpy.data.lamps.new(name='%s', type='POINT')\n" "lamp.color = (%f, %f, %f)\n" "lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n" @@ -387,7 +392,7 @@ bool FRME::Extract(const SpecBase &dataSpec, "lamp.retro_light_index = %d\n" "binding = lamp\n", w.header.name.c_str(), - w.header.color.vec[0], w.header.color.vec[1], w.header.color.vec[2], + colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC, info->angL, info->angQ, info->loadedIdx); if (info->type == LITEInfo::ELightType::Spot) @@ -397,6 +402,7 @@ bool FRME::Extract(const SpecBase &dataSpec, else if (info->type == LITEInfo::ELightType::Directional) os << "lamp.type = 'HEMI'\n"; } + } } } else if (w.type == SBIG('IMGP')) @@ -456,10 +462,8 @@ bool FRME::Extract(const SpecBase &dataSpec, ti = 2; else ti = i; - os.format("verts.append(bm.verts.new((%f,%f,%f)))\n", - info->quadCoords[ti].vec[0], - info->quadCoords[ti].vec[1], - info->quadCoords[ti].vec[2]); + zeus::simd_floats f(info->quadCoords[ti].simd); + os.format("verts.append(bm.verts.new((%f,%f,%f)))\n", f[0], f[1], f[2]); } os << "bm.faces.new(verts)\n" "bm.loops.layers.uv.new('UV')\n" @@ -473,9 +477,8 @@ bool FRME::Extract(const SpecBase &dataSpec, ti = 2; else ti = i; - os.format("bm.verts[%d].link_loops[0][bm.loops.layers.uv[0]].uv = (%f,%f)\n", i, - info->uvCoords[ti].vec[0], - info->uvCoords[ti].vec[1]); + zeus::simd_floats f(info->uvCoords[ti].simd); + os.format("bm.verts[%d].link_loops[0][bm.loops.layers.uv[0]].uv = (%f,%f)\n", i, f[0], f[1]); } os.format("binding = bpy.data.meshes.new('%s')\n" "bm.to_mesh(binding)\n" @@ -485,6 +488,7 @@ bool FRME::Extract(const SpecBase &dataSpec, } } + zeus::simd_floats colorF(w.header.color.simd); os.format("frme_obj = bpy.data.objects.new(name='%s', object_data=binding)\n" "frme_obj.pass_index = %d\n" "parentName = '%s'\n" @@ -507,7 +511,7 @@ bool FRME::Extract(const SpecBase &dataSpec, w.header.defaultVisible ? "True" : "False", w.header.defaultActive ? "True" : "False", w.header.cullFaces ? "True" : "False", - w.header.color.vec[0], w.header.color.vec[1], w.header.color.vec[2], w.header.color.vec[3], + colorF[0], colorF[1], colorF[2], colorF[3], w.header.modelDrawFlags, w.isWorker ? "True" : "False", w.workerId); @@ -541,12 +545,10 @@ bool FRME::Extract(const SpecBase &dataSpec, using PANEInfo = Widget::PANEInfo; if (PANEInfo* info = static_cast(w.widgetInfo.get())) { + zeus::simd_floats f(info->scaleCenter.simd); os.format("frme_obj.retro_pane_dimensions = (%f,%f)\n" "frme_obj.retro_pane_scale_center = (%f,%f,%f)\n", - info->xDim, info->zDim, - info->scaleCenter.vec[0], - info->scaleCenter.vec[1], - info->scaleCenter.vec[2]); + info->xDim, info->zDim, f[0], f[1], f[2]); } } else if (w.type == SBIG('TXPN')) @@ -559,6 +561,10 @@ bool FRME::Extract(const SpecBase &dataSpec, if (frme.version >= 1) jpFontPath = pakRouter.getWorking(info->jpnFont, true); + zeus::simd_floats scaleF(info->scaleCenter.simd); + zeus::simd_floats fillF(info->fillColor.simd); + zeus::simd_floats outlineF(info->outlineColor.simd); + zeus::simd_floats extentF(info->blockExtent.simd); os.format("frme_obj.retro_pane_dimensions = (%f,%f)\n" "frme_obj.retro_pane_scale_center = (%f,%f,%f)\n" "frme_obj.retro_textpane_font_path = '%s'\n" @@ -572,22 +578,13 @@ bool FRME::Extract(const SpecBase &dataSpec, "frme_obj.retro_textpane_hjustification = bpy.types.Object.retro_textpane_hjustification[1]['items'][%d][0]\n" "frme_obj.retro_textpane_vjustification = bpy.types.Object.retro_textpane_vjustification[1]['items'][%d][0]\n", info->xDim, info->zDim, - info->scaleCenter.vec[0], - info->scaleCenter.vec[1], - info->scaleCenter.vec[2], + scaleF[0], scaleF[1], scaleF[2], fontPath.getRelativePathUTF8().data(), info->wordWrap ? "True" : "False", info->horizontal ? "True" : "False", - info->fillColor.vec[0], - info->fillColor.vec[1], - info->fillColor.vec[2], - info->fillColor.vec[3], - info->outlineColor.vec[0], - info->outlineColor.vec[1], - info->outlineColor.vec[2], - info->outlineColor.vec[3], - info->blockExtent.vec[0], - info->blockExtent.vec[1], + fillF[0], fillF[1], fillF[2], fillF[3], + outlineF[0], outlineF[1], outlineF[2], outlineF[3], + extentF[0], extentF[1], jpFontPath.getRelativePathUTF8().data(), info->jpnPointScale[0], info->jpnPointScale[1], @@ -652,6 +649,10 @@ bool FRME::Extract(const SpecBase &dataSpec, } } + zeus::simd_floats xfMtxF[3]; + for (int i = 0; i < 3; ++i) + w.basis[i].simd.copy_to(xfMtxF[i]); + zeus::simd_floats originF(w.origin.simd); os.format("mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n" "mtxd = mtx.decompose()\n" "frme_obj.rotation_mode = 'QUATERNION'\n" @@ -659,9 +660,9 @@ bool FRME::Extract(const SpecBase &dataSpec, "frme_obj.rotation_quaternion = mtxd[1] * angle\n" "frme_obj.scale = mtxd[2]\n" "bpy.context.scene.objects.link(frme_obj)\n", - w.basis[0].vec[0], w.basis[0].vec[1], w.basis[0].vec[2], w.origin.vec[0], - w.basis[1].vec[0], w.basis[1].vec[1], w.basis[1].vec[2], w.origin.vec[1], - w.basis[2].vec[0], w.basis[2].vec[1], w.basis[2].vec[2], w.origin.vec[2]); + xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], originF[0], + xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], originF[1], + xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], originF[2]); } os.centerView(); diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index d737b748b..c223cc884 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -463,9 +463,9 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, } else { - head.localToWorldMtx[0].vec[0] = 1.f; - head.localToWorldMtx[1].vec[1] = 1.f; - head.localToWorldMtx[2].vec[2] = 1.f; + head.localToWorldMtx[0].simd[0] = 1.f; + head.localToWorldMtx[1].simd[1] = 1.f; + head.localToWorldMtx[2].simd[2] = 1.f; } head.meshCount = meshes.size(); head.geomSecIdx = 0; diff --git a/DataSpec/DNAMP1/PATH.cpp b/DataSpec/DNAMP1/PATH.cpp index 573eeca8d..f70a36c01 100644 --- a/DataSpec/DNAMP1/PATH.cpp +++ b/DataSpec/DNAMP1/PATH.cpp @@ -64,8 +64,10 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry entryName.data()); for (const Node& n : nodes) - os.format("bm.verts.new((%f,%f,%f))\n", - n.position.vec[0], n.position.vec[1], n.position.vec[2]); + { + zeus::simd_floats f(n.position.simd); + os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]); + } os << "bm.verts.ensure_lookup_table()\n"; @@ -128,15 +130,18 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry if (xf) { const zeus::CMatrix4f& w = *xf; + zeus::simd_floats xfMtxF[4]; + for (int i = 0; i < 4; ++i) + w.m[i].mSimd.copy_to(xfMtxF[i]); os.format("mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n" "mtxd = mtx.decompose()\n" "path_mesh_obj.rotation_mode = 'QUATERNION'\n" "path_mesh_obj.location = mtxd[0]\n" "path_mesh_obj.rotation_quaternion = mtxd[1]\n" "path_mesh_obj.scale = mtxd[2]\n", - w.m[0][0], w.m[1][0], w.m[2][0], w.m[3][0], - w.m[0][1], w.m[1][1], w.m[2][1], w.m[3][1], - w.m[0][2], w.m[1][2], w.m[2][2], w.m[3][2]); + xfMtxF[0][0], xfMtxF[1][0], xfMtxF[2][0], xfMtxF[3][0], + xfMtxF[0][1], xfMtxF[1][1], xfMtxF[2][1], xfMtxF[3][1], + xfMtxF[0][2], xfMtxF[1][2], xfMtxF[2][2], xfMtxF[3][2]); } os.linkBackground("//!area.blend"); diff --git a/DataSpec/DNAMP1/ScriptObjects/Actor.cpp b/DataSpec/DNAMP1/ScriptObjects/Actor.cpp index 8a5569370..067be34bb 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Actor.cpp +++ b/DataSpec/DNAMP1/ScriptObjects/Actor.cpp @@ -27,7 +27,7 @@ zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const aabbOut = zeus::CAABox(aabb.first, aabb.second); } - if (aabbOut.min.x > aabbOut.max.x) + if (aabbOut.min.x() > aabbOut.max.x()) return {}; zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location); diff --git a/DataSpec/DNAMP1/ScriptObjects/DoorArea.cpp b/DataSpec/DNAMP1/ScriptObjects/DoorArea.cpp index ac58639b6..a30ccc9c0 100644 --- a/DataSpec/DNAMP1/ScriptObjects/DoorArea.cpp +++ b/DataSpec/DNAMP1/ScriptObjects/DoorArea.cpp @@ -19,7 +19,7 @@ zeus::CAABox DoorArea::getVISIAABB(hecl::blender::Token& btok) const aabbOut = zeus::CAABox(aabb.first, aabb.second); } - if (aabbOut.min.x > aabbOut.max.x) + if (aabbOut.min.x() > aabbOut.max.x()) return {}; zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location); diff --git a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.cpp b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.cpp index a02893783..a0b5b6189 100644 --- a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.cpp +++ b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.cpp @@ -269,9 +269,10 @@ zeus::CTransform ConvertEditorEulerToTransform4f(const zeus::CVector3f& scale, const zeus::CVector3f& orientation, const zeus::CVector3f& position) { - return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) * - zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) * - zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) * + zeus::simd_floats f(orientation.mSimd); + return zeus::CTransform::RotateZ(zeus::degToRad(f[2])) * + zeus::CTransform::RotateY(zeus::degToRad(f[1])) * + zeus::CTransform::RotateX(zeus::degToRad(f[0])) * zeus::CTransform::Scale(scale) + position; } diff --git a/DataSpec/DNAMP1/ScriptObjects/Platform.cpp b/DataSpec/DNAMP1/ScriptObjects/Platform.cpp index 91d15bc21..ddf36bef2 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Platform.cpp +++ b/DataSpec/DNAMP1/ScriptObjects/Platform.cpp @@ -27,7 +27,7 @@ zeus::CAABox Platform::getVISIAABB(hecl::blender::Token& btok) const aabbOut = zeus::CAABox(aabb.first, aabb.second); } - if (aabbOut.min.x > aabbOut.max.x) + if (aabbOut.min.x() > aabbOut.max.x()) return {}; zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location); diff --git a/DataSpec/DNAMP2/ANIM.cpp b/DataSpec/DNAMP2/ANIM.cpp index 4f0b81a85..6d5d0bc6c 100644 --- a/DataSpec/DNAMP2/ANIM.cpp +++ b/DataSpec/DNAMP2/ANIM.cpp @@ -60,7 +60,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI { size_t idx = 0; for (const DNAANIM::Value& val : rotKeys) - fixedRotKeys[idx++][c] = val.v4.vec[c]; + fixedRotKeys[idx++][c] = val.simd[c]; } for (zeus::CQuaternion& rot : fixedRotKeys) @@ -85,7 +85,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI { size_t idx = 0; for (const DNAANIM::Value& val : transKeys) - fixedTransKeys[idx++][c] = val.v3.vec[c]; + fixedTransKeys[idx++][c] = val.simd[c]; } for (zeus::CVector3f& t : fixedTransKeys) @@ -108,7 +108,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI auto frameit = frames.begin(); ao.changeCurve(ANIMOutStream::CurveType::Scale, c, scaleKeys.size()); for (const DNAANIM::Value& val : scaleKeys) - ao.write(*frameit++, val.v3.vec[c]); + ao.write(*frameit++, val.simd[c]); } } } @@ -367,7 +367,7 @@ void ANIM::ANIM0::Enumerate(typename Write::StreamT& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(typename Write::StreamT& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(bone.second)) ++cit; @@ -399,7 +399,7 @@ void ANIM::ANIM0::Enumerate(typename Write::StreamT& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(bone.second)) ++cit; diff --git a/DataSpec/DNAMP2/CINF.cpp b/DataSpec/DNAMP2/CINF.cpp index 5dd17a6fb..5da04bdad 100644 --- a/DataSpec/DNAMP2/CINF.cpp +++ b/DataSpec/DNAMP2/CINF.cpp @@ -64,15 +64,19 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& c cinfId.toUint32()); for (const DNAANIM::RigInverter::Bone& bone : inverter.getBones()) + { + zeus::simd_floats originF(bone.m_origBone.origin.simd); + zeus::simd_floats tailF(bone.m_tail.mSimd); os.format("bone = arm.edit_bones.new('%s')\n" "bone.head = (%f,%f,%f)\n" "bone.tail = (%f,%f,%f)\n" "bone.use_inherit_scale = False\n" "arm_bone_table[%u] = bone\n", getBoneNameFromId(bone.m_origBone.id)->c_str(), - bone.m_origBone.origin.vec[0], bone.m_origBone.origin.vec[1], bone.m_origBone.origin.vec[2], - bone.m_tail[0], bone.m_tail[1], bone.m_tail[2], + originF[0], originF[1], originF[2], + tailF[0], tailF[1], tailF[2], bone.m_origBone.id); + } for (const Bone& bone : bones) if (bone.parentId != 97) diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 27cf1ac59..570ca8b47 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -193,7 +193,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, CharacterAssoci } } -static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f}; +static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}}; void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, std::unordered_map& addTo, diff --git a/DataSpec/DNAMP3/ANIM.cpp b/DataSpec/DNAMP3/ANIM.cpp index 20d39c122..b61a95d9d 100644 --- a/DataSpec/DNAMP3/ANIM.cpp +++ b/DataSpec/DNAMP3/ANIM.cpp @@ -73,7 +73,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, { size_t idx = 0; for (const DNAANIM::Value& val : rotKeys) - fixedRotKeys[idx++][c] = val.v4.vec[c]; + fixedRotKeys[idx++][c] = val.simd[c]; } for (zeus::CQuaternion& rot : fixedRotKeys) @@ -98,7 +98,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, { size_t idx = 0; for (const DNAANIM::Value& val : transKeys) - fixedTransKeys[idx++][c] = val.v3.vec[c]; + fixedTransKeys[idx++][c] = val.simd[c]; } for (zeus::CVector3f& t : fixedTransKeys) @@ -121,7 +121,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, auto frameit = frames.begin(); ao.changeCurve(ANIMOutStream::CurveType::Scale, c, scaleKeys.size()); for (const DNAANIM::Value& val : scaleKeys) - ao.write(*frameit++, val.v3.vec[c]); + ao.write(*frameit++, val.simd[c]); } } } @@ -383,7 +383,7 @@ void ANIM::ANIM0::Enumerate(athena::io::IStreamWriter& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(athena::io::IStreamWriter& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(bone.second)) ++cit; @@ -415,7 +415,7 @@ void ANIM::ANIM0::Enumerate(athena::io::IStreamWriter& writer) const std::vector& keys = *cit++; auto kit = keys.begin(); for (size_t k=0 ; k(bone.second)) ++cit; diff --git a/DataSpec/DNAMP3/CINF.cpp b/DataSpec/DNAMP3/CINF.cpp index d1f9abece..5028f85db 100644 --- a/DataSpec/DNAMP3/CINF.cpp +++ b/DataSpec/DNAMP3/CINF.cpp @@ -17,15 +17,19 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID64& c cinfId.toUint64()); for (const DNAANIM::RigInverter::Bone& bone : inverter.getBones()) + { + zeus::simd_floats originF(bone.m_origBone.origin.simd); + zeus::simd_floats tailF(bone.m_tail.mSimd); os.format("bone = arm.edit_bones.new('%s')\n" "bone.head = (%f,%f,%f)\n" "bone.tail = (%f,%f,%f)\n" "bone.use_inherit_scale = False\n" "arm_bone_table[%u] = bone\n", getBoneNameFromId(bone.m_origBone.id)->c_str(), - bone.m_origBone.origin.vec[0], bone.m_origBone.origin.vec[1], bone.m_origBone.origin.vec[2], - bone.m_tail[0], bone.m_tail[1], bone.m_tail[2], + originF[0], originF[1], originF[2], + tailF[0], tailF[1], tailF[2], bone.m_origBone.id); + } if (bones.size()) { diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index 3261f5667..6084654aa 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -203,7 +203,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, CharacterAssoci } } -static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f}; +static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}}; void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, std::unordered_map& addTo, diff --git a/Editor/SplashScreen.cpp b/Editor/SplashScreen.cpp index 7e36c8ef6..44dc64778 100644 --- a/Editor/SplashScreen.cpp +++ b/Editor/SplashScreen.cpp @@ -127,7 +127,7 @@ void SplashScreen::updateContentOpacity(float opacity) zeus::CColor color = zeus::CColor::lerp(clearColor, res.themeData().uiText(), opacity); m_title->colorGlyphs(color); m_buildInfo->colorGlyphs(color); - m_badgeIcon->setMultiplyColor({1.f, 1.f, 1.f, color.a}); + m_badgeIcon->setMultiplyColor({1.f, 1.f, 1.f, color.a()}); m_badgeText->colorGlyphs(color); m_newButt.m_view->colorGlyphs(color); m_openButt.m_view->colorGlyphs(color); diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 3e99fc311..ce2705f5b 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -87,20 +87,20 @@ void ViewManager::TestGameView::think() if (g_StateManager->Player() && playerInfo && playerInfo->toBoolean()) { const CPlayer& pl = g_StateManager->GetPlayer(); - zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f()); - zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager); - zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f()); + const zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f()); + const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager); + const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f()); overlayText += hecl::Format("Player Position: x %f, y %f, z %f\n" " Quaternion: w %f, x %f, y %f, z %f\n" " Roll: %f, Pitch: %f, Yaw: %f\n" "Camera Position: x %f, y %f, z %f\n" " Quaternion: w %f, x %f, y %f, z %f\n" " Roll: %f, Pitch: %f, Yaw: %f\n", - pl.GetTranslation().x, pl.GetTranslation().y, pl.GetTranslation().z, - plQ.w, plQ.x, plQ.y, plQ.z, + pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(), + plQ.w(), plQ.x(), plQ.y(), plQ.z(), plQ.roll(), plQ.pitch(), plQ.yaw(), - camXf.origin.x, camXf.origin.y, camXf.origin.z, - camQ.w, camQ.x, camQ.y, camQ.z, + camXf.origin.x(), camXf.origin.y(), camXf.origin.z(), + camQ.w(), camQ.x(), camQ.y(), camQ.z(), camQ.roll(), camQ.pitch(), camQ.yaw()); } if (worldInfo && worldInfo->toBoolean()) diff --git a/NESEmulator/malloc.h b/NESEmulator/malloc.h index 7f11d0973..c3dcd7c10 100644 --- a/NESEmulator/malloc.h +++ b/NESEmulator/malloc.h @@ -6,7 +6,10 @@ #elif _WIN32 #include <../ucrt/malloc.h> #else +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winclude-next-absolute-path" #include_next +#pragma GCC diagnostic pop #endif #endif // URDE_NESEMULATOR_MALLOC_H diff --git a/Runtime/Audio/CSfxManager.cpp b/Runtime/Audio/CSfxManager.cpp index e970caace..7001f23ea 100644 --- a/Runtime/Audio/CSfxManager.cpp +++ b/Runtime/Audio/CSfxManager.cpp @@ -130,8 +130,10 @@ void CSfxManager::CSfxEmitterWrapper::Play() else x1a_reverb = 0.f; + zeus::simd_floats pos(x24_parmData.x0_pos.mSimd); + zeus::simd_floats dir(x24_parmData.xc_dir.mSimd); x50_emitterHandle = CAudioSys::GetAmuseEngine().addEmitter( - x24_parmData.x0_pos.v, x24_parmData.xc_dir.v, + pos.data(), dir.data(), x24_parmData.x18_maxDist, x24_parmData.x1c_distComp, x24_parmData.x24_sfxId, x24_parmData.x27_minVol, x24_parmData.x26_maxVol, (x24_parmData.x20_flags & 0x8) != 0); @@ -180,7 +182,9 @@ void CSfxManager::CSfxEmitterWrapper::UpdateEmitterSilent() { if (x50_emitterHandle) { - x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v); + zeus::simd_floats pos(x24_parmData.x0_pos.mSimd); + zeus::simd_floats dir(x24_parmData.xc_dir.mSimd); + x50_emitterHandle->setVectors(pos.data(), dir.data()); x50_emitterHandle->setMaxVol(1.f / 127.f); } x55_cachedMaxVol = x24_parmData.x26_maxVol; @@ -190,7 +194,9 @@ void CSfxManager::CSfxEmitterWrapper::UpdateEmitter() { if (x50_emitterHandle) { - x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v); + zeus::simd_floats pos(x24_parmData.x0_pos.mSimd); + zeus::simd_floats dir(x24_parmData.xc_dir.mSimd); + x50_emitterHandle->setVectors(pos.data(), dir.data()); x50_emitterHandle->setMaxVol(x55_cachedMaxVol); } } @@ -280,7 +286,11 @@ void CSfxManager::AddListener(ESfxChannels channel, { if (m_listener) CAudioSys::GetAmuseEngine().removeListener(m_listener.get()); - m_listener = CAudioSys::GetAmuseEngine().addListener(pos.v, dir.v, heading.v, up.v, frontRadius, + zeus::simd_floats p(pos.mSimd); + zeus::simd_floats d(dir.mSimd); + zeus::simd_floats h(heading.mSimd); + zeus::simd_floats u(up.mSimd); + m_listener = CAudioSys::GetAmuseEngine().addListener(p.data(), d.data(), h.data(), u.data(), frontRadius, surroundRadius, soundSpeed, vol); } @@ -290,7 +300,11 @@ void CSfxManager::UpdateListener(const zeus::CVector3f& pos, const zeus::CVector { if (m_listener) { - m_listener->setVectors(pos.v, dir.v, heading.v, up.v); + zeus::simd_floats p(pos.mSimd); + zeus::simd_floats d(dir.mSimd); + zeus::simd_floats h(heading.mSimd); + zeus::simd_floats u(up.mSimd); + m_listener->setVectors(p.data(), d.data(), h.data(), u.data()); m_listener->setVolume(vol); } } @@ -442,7 +456,9 @@ void CSfxManager::UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f& emitter.GetEmitterData().xc_dir = dir; emitter.GetEmitterData().x26_maxVol = maxVol; amuse::Emitter& h = *emitter.GetHandle(); - h.setVectors(pos.v, dir.v); + zeus::simd_floats p(pos.mSimd); + zeus::simd_floats d(dir.mSimd); + h.setVectors(p.data(), d.data()); h.setMaxVol(maxVol); } diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index f9f26f2b2..372a3bc76 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -623,8 +623,8 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa float deltaFrames = input.DeltaTime() * 60.f; SetShouldRotatingSoundBePlaying(true); zeus::CEulerAngles eulers(xa8_renderStates[0].x8_camOrientation); - zeus::CRelAngle angX(eulers.x); - zeus::CRelAngle angZ(eulers.z); + zeus::CRelAngle angX(eulers.x()); + zeus::CRelAngle angZ(eulers.z()); float dt = deltaFrames * g_tweakAutoMapper->GetCamRotateDegreesPerFrame(); @@ -892,7 +892,7 @@ zeus::CQuaternion CAutoMapper::GetMiniMapCameraOrientation(const CStateManager& { const CGameCamera* cam = stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr); zeus::CEulerAngles camAngles(zeus::CQuaternion(cam->GetTransform().buildMatrix3f())); - float rotMod = -(std::floor(camAngles.z * 0.15915494f) * 2.f * M_PIF - camAngles.z); + float rotMod = -(std::floor(camAngles.z() / (2.f * M_PIF)) * 2.f * M_PIF - camAngles.z()); if (rotMod < 0.f) rotMod += 2.f * M_PIF; @@ -1035,9 +1035,9 @@ float CAutoMapper::GetDesiredMiniMapCameraDistance(const CStateManager& mgr) con zeus::CVector3f xfPoint = mapa->GetAreaPostTransform(*x24_world, xa0_curAreaId) * mapa->GetAreaCenterPoint(); zeus::CVector3f maxMargin; - maxMargin.x = std::max(xfPoint.x - aabb.min.x, aabb.max.x - xfPoint.x); - maxMargin.y = std::max(xfPoint.y - aabb.min.y, aabb.max.y - xfPoint.y); - maxMargin.z = std::max(xfPoint.z - aabb.min.z, aabb.max.z - xfPoint.z); + maxMargin.x() = std::max(xfPoint.x() - aabb.min.x(), aabb.max.x() - xfPoint.x()); + maxMargin.y() = std::max(xfPoint.y() - aabb.min.y(), aabb.max.y() - xfPoint.y()); + maxMargin.z() = std::max(xfPoint.z() - aabb.min.z(), aabb.max.z() - xfPoint.z()); zeus::CVector3f extent = mapa->GetBoundingBox().max - mapa->GetBoundingBox().min; return (0.5f * (0.5f * extent.magnitude()) + 0.5f * maxMargin.magnitude()) * @@ -1589,7 +1589,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo float func = zeus::clamp(0.f, 0.5f * (1.f + std::sin(5.f * CGraphics::GetSecondsMod900() - (M_PIF / 2.f))), 1.f); float scale = std::min(0.6f * g_tweakAutoMapper->GetMaxCamDist() / g_tweakAutoMapper->GetMinCamDist(), objectScale); zeus::CEulerAngles eulers(mgr.GetCameraManager()->GetCurrentCameraTransform(mgr)); - zeus::CRelAngle angle(eulers.z); + zeus::CRelAngle angle(eulers.z()); zeus::CTransform playerXf(zeus::CMatrix3f::RotateZ(angle), CMapArea::GetAreaPostTranslate(*x24_world, mgr.GetNextAreaId()) + mgr.GetPlayer().GetTranslation()); CGraphics::SetModelMatrix(mapXf * playerXf * zeus::CTransform::Scale(scale * (0.25f * func + 0.75f))); @@ -1600,7 +1600,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo alpha = xa8_renderStates[0].x34_alphaSurfaceVisited; alpha *= mapAlpha; zeus::CColor modColor = g_tweakAutoMapper->GetMiniMapSamusModColor(); - modColor.a *= alpha; + modColor.a() *= alpha; CModelFlags flags(5, 0, 8 | 1, modColor); /* Depth GEqual */ flags.m_extendedShader = EExtendedShader::DepthGEqualNoZWrite; x30_miniMapSamus->Draw(flags); @@ -1651,7 +1651,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo alpha *= xa8_renderStates[0].x34_alphaSurfaceVisited; alpha *= mapAlpha; zeus::CColor color = zeus::CColor::skWhite; - color.a = alpha; + color.a() = alpha; filter.drawVerts(color, verts); } } diff --git a/Runtime/AutoMapper/CMapArea.cpp b/Runtime/AutoMapper/CMapArea.cpp index c7d3c377c..23282230c 100644 --- a/Runtime/AutoMapper/CMapArea.cpp +++ b/Runtime/AutoMapper/CMapArea.cpp @@ -294,10 +294,10 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C Instance& instance = const_cast(m_instances[instIdx]); - if (surfColor.a) + if (surfColor.a()) instance.m_surfacePrims.draw(surfColor, m_primStart, m_primCount); - if (lineColor.a) + if (lineColor.a()) { bool draw2 = lineWidth > 1.f; athena::io::MemoryReader r(x1c_outlineOffset, INT_MAX); @@ -306,7 +306,7 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C std::vector& linePrims = instance.m_linePrims; zeus::CColor color = lineColor; if (draw2) - color.a *= 0.5f; + color.a() *= 0.5f; float width = lineWidth; auto primIt = linePrims.begin(); diff --git a/Runtime/AutoMapper/CMapUniverse.cpp b/Runtime/AutoMapper/CMapUniverse.cpp index 7bfb32cb4..790dc968a 100644 --- a/Runtime/AutoMapper/CMapUniverse.cpp +++ b/Runtime/AutoMapper/CMapUniverse.cpp @@ -66,16 +66,16 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3 if (w == parms.GetFocusWorldIndex()) { surfColor = data.GetSurfaceColorSelected(); - surfColor.a *= parms.GetAlpha(); + surfColor.a() *= parms.GetAlpha(); outlineColor = data.GetOutlineColorSelected(); - outlineColor.a *= parms.GetAlpha(); + outlineColor.a() *= parms.GetAlpha(); } else { surfColor = data.GetSurfaceColorUnselected(); - surfColor.a *= parms.GetAlpha(); + surfColor.a() *= parms.GetAlpha(); outlineColor = data.GetSurfaceColorUnselected(); - outlineColor.a *= parms.GetAlpha(); + outlineColor.a() *= parms.GetAlpha(); } for (int h=0 ; hGetSurface(s); zeus::CVector3f centerPos = hexXf * surf.GetCenterPosition(); - sortInfos.emplace_back(centerPos.y, w, h, s, surfColor, outlineColor); + sortInfos.emplace_back(centerPos.y(), w, h, s, surfColor, outlineColor); } } } @@ -109,11 +109,11 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3 surfColor = zeus::CColor::lerp(g_tweakAutoMapper->GetSurfaceSelectVisitedColor(), g_tweakAutoMapper->GetAreaFlashPulseColor(), parms.GetFlashPulse()); - surfColor.a = info.GetSurfaceColor().a; + surfColor.a() = info.GetSurfaceColor().a(); outlineColor = zeus::CColor::lerp(g_tweakAutoMapper->GetOutlineSelectVisitedColor(), g_tweakAutoMapper->GetAreaFlashPulseColor(), parms.GetFlashPulse()); - outlineColor.a = info.GetOutlineColor().a; + outlineColor.a() = info.GetOutlineColor().a(); } zeus::CTransform hexXf = mwData.GetMapAreaData(info.GetAreaIndex()); diff --git a/Runtime/AutoMapper/CMapWorld.cpp b/Runtime/AutoMapper/CMapWorld.cpp index 710dbe3b8..caff8b7a6 100644 --- a/Runtime/AutoMapper/CMapWorld.cpp +++ b/Runtime/AutoMapper/CMapWorld.cpp @@ -311,9 +311,9 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre else { finalSurfColor = *surfaceColor; - finalSurfColor.a = surfDepth * alphaSurf; + finalSurfColor.a() = surfDepth * alphaSurf; finalOutlineColor = *outlineColor; - finalOutlineColor.a = outlineDepth * alphaOutline; + finalOutlineColor.a() = outlineDepth * alphaOutline; } if ((selArea != playerArea || parms.GetHintAreaFlashIntensity() == 0.f) && @@ -331,7 +331,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre { const CMapArea::CMapAreaSurface& surf = mapa->GetSurface(i); zeus::CVector3f pos = modelView * surf.GetCenterPosition(); - sortInfos.emplace_back(pos.y, thisArea, CMapObjectSortInfo::EObjectCode::Surface, i, + sortInfos.emplace_back(pos.y(), thisArea, CMapObjectSortInfo::EObjectCode::Surface, i, finalSurfColor, finalOutlineColor); } @@ -355,7 +355,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre zeus::CVector3f center = obj.BuildSurfaceCenterPoint(s); zeus::CVector3f pos = modelView * (CMapArea::GetAreaPostTranslate(parms.GetWorld(), thisArea) + center); - sortInfos.emplace_back(pos.y, thisArea, CMapObjectSortInfo::EObjectCode::DoorSurface, si+s, + sortInfos.emplace_back(pos.y(), thisArea, CMapObjectSortInfo::EObjectCode::DoorSurface, si+s, zeus::CColor{1.f, 0.f, 1.f, 1.f}, zeus::CColor{1.f, 0.f, 1.f, 1.f}); } continue; @@ -364,8 +364,8 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre zeus::CVector3f pos = modelView * (obj.GetTransform().origin + CMapArea::GetAreaPostTranslate(parms.GetWorld(), thisArea)); - sortInfos.emplace_back(pos.y, thisArea, doorType ? CMapObjectSortInfo::EObjectCode::Door : - CMapObjectSortInfo::EObjectCode::Object, + sortInfos.emplace_back(pos.y(), thisArea, doorType ? CMapObjectSortInfo::EObjectCode::Door : + CMapObjectSortInfo::EObjectCode::Object, i, zeus::CColor{1.f, 0.f, 1.f, 1.f}, zeus::CColor{1.f, 0.f, 1.f, 1.f}); } } @@ -476,8 +476,8 @@ static Circle2 ExactCircle3(const zeus::CVector2f* a, const zeus::CVector2f* b, zeus::CVector2f magVec(d1.magSquared() * 0.5f, d2.magSquared() * 0.5f); if (std::fabs(cross) > 0.01f) { - zeus::CVector2f tmp((d2.y * magVec.x - d1.y * magVec.y) / cross, - (d1.x * magVec.y - d2.x * magVec.x) / cross); + zeus::CVector2f tmp((d2.y() * magVec.x() - d1.y() * magVec.y()) / cross, + (d1.x() * magVec.y() - d2.x() * magVec.x()) / cross); ret.x0_point = *a + tmp; ret.x8_radiusSq = tmp.magSquared(); } @@ -760,10 +760,10 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld zeus::CAABox aabb = mapa->GetBoundingBox().getTransformedAABox(mapa->GetAreaPostTransform(wld, i)); for (int j=0 ; j<8 ; ++j) { - zeus::CVector3f point = aabb.getPoint(j); - coords.emplace_back(point.x, point.y); - zMin = std::min(point.z, zMin); - zMax = std::max(point.z, zMax); + const zeus::CVector3f point = aabb.getPoint(j); + coords.push_back(point.toVec2f()); + zMin = std::min(point.z(), zMin); + zMax = std::max(point.z(), zMax); } } } @@ -772,35 +772,35 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld Circle circle = MinCircle(coords); const_cast(this)->x3c_worldSphereRadius = circle.x8_radius; const_cast(this)->x30_worldSpherePoint = - zeus::CVector3f(circle.x0_point.x, circle.x0_point.y, (zMin + zMax) * 0.5f); + zeus::CVector3f(circle.x0_point.x(), circle.x0_point.y(), (zMin + zMax) * 0.5f); const_cast(this)->x40_worldSphereHalfDepth = (zMax - zMin) * 0.5f; } zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const { zeus::CVector3f ret = point; - if (std::fabs(lookVec.z) > FLT_EPSILON) + if (std::fabs(lookVec.z()) > FLT_EPSILON) { - float f2 = point.z - (x40_worldSphereHalfDepth + x30_worldSpherePoint.z); - float f1 = point.z - (x30_worldSpherePoint.z - x40_worldSphereHalfDepth); + float f2 = point.z() - (x40_worldSphereHalfDepth + x30_worldSpherePoint.z()); + float f1 = point.z() - (x30_worldSpherePoint.z() - x40_worldSphereHalfDepth); if (f2 > 0.f) - ret = point + lookVec * (-f2 / lookVec.z); + ret = point + lookVec * (-f2 / lookVec.z()); else if (f1 < 0.f) - ret = point + lookVec * (-f1 / lookVec.z); + ret = point + lookVec * (-f1 / lookVec.z()); } else { - ret.z = zeus::clamp(x30_worldSpherePoint.z - x40_worldSphereHalfDepth, ret.z, - x40_worldSphereHalfDepth + x30_worldSpherePoint.z); + ret.z() = zeus::clamp(x30_worldSpherePoint.z() - x40_worldSphereHalfDepth, float(ret.z()), + x40_worldSphereHalfDepth + x30_worldSpherePoint.z()); } - zeus::CVector2f tmp(x30_worldSpherePoint.x, x30_worldSpherePoint.y); - zeus::CVector2f vec2 = zeus::CVector2f(point.x, point.y) - tmp; + zeus::CVector2f tmp = x30_worldSpherePoint.toVec2f(); + zeus::CVector2f vec2 = point.toVec2f() - tmp; if (vec2.magnitude() > x3c_worldSphereRadius) { tmp += vec2.normalized() * x3c_worldSphereRadius; - ret.x = tmp.x; - ret.y = tmp.y; + ret.x() = float(tmp.x()); + ret.y() = float(tmp.y()); } return ret; diff --git a/Runtime/AutoMapper/CMappableObject.cpp b/Runtime/AutoMapper/CMappableObject.cpp index 2e8179932..9c9ace08c 100644 --- a/Runtime/AutoMapper/CMappableObject.cpp +++ b/Runtime/AutoMapper/CMappableObject.cpp @@ -31,8 +31,8 @@ CMappableObject::CMappableObject(const void* buf) zeus::CTransform CMappableObject::AdjustTransformForType() { - const float doorCenterX = g_tweakAutoMapper->GetDoorCenter().x; - const float doorCenterZ = g_tweakAutoMapper->GetDoorCenter().z; + const float doorCenterX = g_tweakAutoMapper->GetDoorCenter().x(); + const float doorCenterZ = g_tweakAutoMapper->GetDoorCenter().z(); if (x0_type == EMappableObjectType::BigDoor1) { zeus::CTransform orientation; @@ -127,11 +127,11 @@ CMappableObject::GetDoorColors(int curAreaId, const CMapWorldInfo& mwInfo, float color = zeus::CColor::skClear; } - color.a *= alpha; - return {color, zeus::CColor(std::min(1.4f * color.r, 1.f), - std::min(1.4f * color.g, 1.f), - std::min(1.4f * color.b, 1.f), - std::min(1.4f * color.a, 1.f))}; + color.a() *= alpha; + return {color, zeus::CColor(std::min(1.4f * color.r(), 1.f), + std::min(1.4f * color.g(), 1.f), + std::min(1.4f * color.b(), 1.f), + std::min(1.4f * color.a(), 1.f))}; } void CMappableObject::PostConstruct(const void *) @@ -200,7 +200,7 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, break; } - iconColor.a *= alpha; + iconColor.a() *= alpha; TLockedToken tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), iconRes}); if (!m_texQuadFilter || m_texQuadFilter->GetTex().GetObj() != tex.GetObj()) @@ -243,15 +243,15 @@ zeus::CVector3f CMappableObject::BuildSurfaceCenterPoint(int surfIdx) const case 0: return x10_transform * zeus::CVector3f::skZero; case 1: - return x10_transform * zeus::CVector3f{0.f, 0.f, 2.f * doorCenter.x}; + return x10_transform * zeus::CVector3f{0.f, 0.f, 2.f * doorCenter.x()}; case 2: - return x10_transform * zeus::CVector3f{0.f, -doorCenter.y, 0.f}; + return x10_transform * zeus::CVector3f{0.f, -doorCenter.y(), 0.f}; case 3: - return x10_transform * zeus::CVector3f{0.f, doorCenter.y, 0.f}; + return x10_transform * zeus::CVector3f{0.f, doorCenter.y(), 0.f}; case 4: - return x10_transform * zeus::CVector3f{-doorCenter.x, 0.f, 0.f}; + return x10_transform * zeus::CVector3f{-doorCenter.x(), 0.f, 0.f}; case 5: - return x10_transform * zeus::CVector3f{doorCenter.x, 0.f, 0.f}; + return x10_transform * zeus::CVector3f{doorCenter.x(), 0.f, 0.f}; default: break; } @@ -284,16 +284,17 @@ boo::ObjToken CMappableObject::g_doorIbo; void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks) { const zeus::CVector3f& center = tweaks.GetDoorCenter(); + zeus::simd_floats centerF(center.mSimd); zeus::CVector3f* doorVerts = const_cast(&CMappableObject::skDoorVerts[0]); /* Wrap door verts around -Z to build surface */ - doorVerts[0].assign( -center.z, -center.y, 0.f); - doorVerts[1].assign( -center.z, -center.y, 2.f * center.x); - doorVerts[2].assign( -center.z, center.y, 0.f); - doorVerts[3].assign( -center.z, center.y, 2.f * center.x); - doorVerts[4].assign(.2f * -center.z, -center.y, 0.f); - doorVerts[5].assign(.2f * -center.z, -center.y, 2.f * center.x); - doorVerts[6].assign(.2f * -center.z, center.y, 0.f); - doorVerts[7].assign(.2f * -center.z, center.y, 2.f * center.x); + doorVerts[0].assign( -centerF[2], -centerF[1], 0.f); + doorVerts[1].assign( -centerF[2], -centerF[1], 2.f * centerF[0]); + doorVerts[2].assign( -centerF[2], centerF[1], 0.f); + doorVerts[3].assign( -centerF[2], centerF[1], 2.f * centerF[0]); + doorVerts[4].assign(.2f * -centerF[2], -centerF[1], 0.f); + doorVerts[5].assign(.2f * -centerF[2], -centerF[1], 2.f * centerF[0]); + doorVerts[6].assign(.2f * -centerF[2], centerF[1], 0.f); + doorVerts[7].assign(.2f * -centerF[2], centerF[1], 2.f * centerF[0]); CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx) { diff --git a/Runtime/CSortedLists.cpp b/Runtime/CSortedLists.cpp index 869708e57..a79d591c3 100644 --- a/Runtime/CSortedLists.cpp +++ b/Runtime/CSortedLists.cpp @@ -162,22 +162,22 @@ s16 CSortedListManager::FindInListLower(ESortedList list, float val) const s16 CSortedListManager::ConstructIntersectionArray(const zeus::CAABox& aabb) { - int minXa = FindInListLower(ESortedList::MinX, aabb.min.x); - int maxXa = FindInListUpper(ESortedList::MinX, aabb.max.x); - int minXb = FindInListLower(ESortedList::MaxX, aabb.min.x); - int maxXb = FindInListUpper(ESortedList::MaxX, aabb.max.x); + int minXa = FindInListLower(ESortedList::MinX, aabb.min.x()); + int maxXa = FindInListUpper(ESortedList::MinX, aabb.max.x()); + int minXb = FindInListLower(ESortedList::MaxX, aabb.min.x()); + int maxXb = FindInListUpper(ESortedList::MaxX, aabb.max.x()); int xEnd = std::min(int(xb000_sortedLists[3].x800_size) - maxXb, minXa) + (maxXb + (maxXa - minXa) - minXb) / 2; - int minYa = FindInListLower(ESortedList::MinY, aabb.min.y); - int maxYa = FindInListUpper(ESortedList::MinY, aabb.max.y); - int minYb = FindInListLower(ESortedList::MaxY, aabb.min.y); - int maxYb = FindInListUpper(ESortedList::MaxY, aabb.max.y); + int minYa = FindInListLower(ESortedList::MinY, aabb.min.y()); + int maxYa = FindInListUpper(ESortedList::MinY, aabb.max.y()); + int minYb = FindInListLower(ESortedList::MaxY, aabb.min.y()); + int maxYb = FindInListUpper(ESortedList::MaxY, aabb.max.y()); int yEnd = std::min(int(xb000_sortedLists[4].x800_size) - maxYb, minYa) + (maxYb + (maxYa - minYa) - minYb) / 2; - int minZa = FindInListLower(ESortedList::MinZ, aabb.min.z); - int maxZa = FindInListUpper(ESortedList::MinZ, aabb.max.z); - int minZb = FindInListLower(ESortedList::MaxZ, aabb.min.z); - int maxZb = FindInListUpper(ESortedList::MaxZ, aabb.max.z); + int minZa = FindInListLower(ESortedList::MinZ, aabb.min.z()); + int maxZa = FindInListUpper(ESortedList::MinZ, aabb.max.z()); + int minZb = FindInListLower(ESortedList::MaxZ, aabb.min.z()); + int maxZb = FindInListUpper(ESortedList::MaxZ, aabb.max.z()); int zEnd = std::min(int(xb000_sortedLists[5].x800_size) - maxZb, minZa) + (maxZb + (maxZa - minZa) - minZb) / 2; if (xEnd < yEnd && xEnd < zEnd) @@ -252,10 +252,10 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector& o { if (mag == 0.f) mag = 8000.f; - zeus::CVector3f ray = dir * mag; - zeus::CVector3f sum = ray + pos; - zeus::CVector3f maxs(std::max(pos.x, sum.x), std::max(pos.y, sum.y), std::max(pos.z, sum.z)); - zeus::CVector3f mins(std::min(sum.x, pos.x), std::min(sum.y, pos.y), std::min(sum.z, pos.z)); + const zeus::CVector3f ray = dir * mag; + const zeus::CVector3f sum = ray + pos; + zeus::CVector3f maxs(std::max(pos.x(), sum.x()), std::max(pos.y(), sum.y()), std::max(pos.z(), sum.z())); + zeus::CVector3f mins(std::min(sum.x(), pos.x()), std::min(sum.y(), pos.y()), std::min(sum.z(), pos.z())); BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor); } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 3fd31051b..ece27c25d 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -254,7 +254,7 @@ void CStateManager::UpdateThermalVisor() { CGameArea* area = x850_world->GetArea(x8cc_nextAreaId); const zeus::CTransform& playerXf = x84c_player->GetTransform(); - zeus::CVector3f playerXYPos(playerXf.origin.x, playerXf.origin.y, 0.f); + zeus::CVector3f playerXYPos(playerXf.origin.x(), playerXf.origin.y(), 0.f); CGameArea* lastArea = nullptr; float closestDist = FLT_MAX; for (const CGameArea::Dock& dock : area->GetDocks()) @@ -262,7 +262,7 @@ void CStateManager::UpdateThermalVisor() zeus::CVector3f dockCenter = (dock.GetPlaneVertices()[0] + dock.GetPlaneVertices()[1] + dock.GetPlaneVertices()[2] + dock.GetPlaneVertices()[3]) * 0.25f; - dockCenter.z = 0.f; + dockCenter.z() = 0.f; float dist = (playerXYPos - dockCenter).magSquared(); if (dist < closestDist) { @@ -512,7 +512,7 @@ void CStateManager::DrawReflection(const zeus::CVector3f& reflectPoint) zeus::CAABox aabb = x84c_player->GetBoundingBox(); zeus::CVector3f playerPos = aabb.center(); zeus::CVector3f surfToPlayer = playerPos - reflectPoint; - surfToPlayer.z = 0.f; + surfToPlayer.z() = 0.f; zeus::CVector3f viewPos = playerPos - surfToPlayer.normalized() * 3.5f; zeus::CTransform look = zeus::lookAt(viewPos, playerPos, {0.f, 0.f, -1.f}); @@ -594,7 +594,7 @@ void CStateManager::DrawE3DeathEffect() const } float whiteAmt = zeus::clamp(0.f, 1.f - player.x9f4_deathTime / (0.05f * 6.f), 1.f); zeus::CColor color = zeus::CColor::skWhite; - color.a = whiteAmt; + color.a() = whiteAmt; const_cast(m_deathWhiteout).draw(color); } } @@ -605,7 +605,7 @@ void CStateManager::DrawAdditionalFilters() const !x870_cameraManager->IsInCinematicCamera()) { zeus::CColor color = zeus::CColor::skWhite; - color.a = 1.f - xf0c_escapeTimer; + color.a() = 1.f - xf0c_escapeTimer; const_cast(m_escapeWhiteout).draw(color); } } @@ -615,14 +615,14 @@ zeus::CFrustum CStateManager::SetupDrawFrustum(const SViewport& vp) const zeus::CFrustum ret; const CGameCamera* cam = x870_cameraManager->GetCurrentCamera(*this); zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this); - int vpWidth = xf2c_viewportScale.x * vp.x8_width; - int vpHeight = xf2c_viewportScale.y * vp.xc_height; + int vpWidth = xf2c_viewportScale.x() * vp.x8_width; + int vpHeight = xf2c_viewportScale.y() * vp.xc_height; int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left; int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top; g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight); - float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y) * 2.f; - float width = xf2c_viewportScale.x * vp.x8_width; - float height = xf2c_viewportScale.y * vp.xc_height; + float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y()) * 2.f; + float width = xf2c_viewportScale.x() * vp.x8_width; + float height = xf2c_viewportScale.y() * vp.xc_height; zeus::CProjection proj; proj.setPersp(zeus::SProjPersp{fov, width / height, cam->GetNearClipDistance(), cam->GetFarClipDistance()}); ret.updatePlanes(camXf, proj); @@ -635,15 +635,15 @@ zeus::CFrustum CStateManager::SetupViewForDraw(const SViewport& vp) const zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this); g_Renderer->SetWorldViewpoint(camXf); CBooModel::SetNewPlayerPositionAndTime(x84c_player->GetTranslation()); - int vpWidth = xf2c_viewportScale.x * vp.x8_width; - int vpHeight = xf2c_viewportScale.y * vp.xc_height; + int vpWidth = xf2c_viewportScale.x() * vp.x8_width; + int vpHeight = xf2c_viewportScale.y() * vp.xc_height; int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left; int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top; g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight); CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); - float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y) * 2.f; - float width = xf2c_viewportScale.x * vp.x8_width; - float height = xf2c_viewportScale.y * vp.xc_height; + float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y()) * 2.f; + float width = xf2c_viewportScale.x() * vp.x8_width; + float height = xf2c_viewportScale.y() * vp.xc_height; g_Renderer->SetPerspective(zeus::radToDeg(fov), width, height, cam->GetNearClipDistance(), cam->GetFarClipDistance()); zeus::CFrustum frustum; @@ -1668,9 +1668,9 @@ bool CStateManager::MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterial { zeus::CVector3f crossed = { - -ray.dir.z * ray.dir.z - ray.dir.y * ray.dir.x, - ray.dir.x * ray.dir.x - ray.dir.z * ray.dir.y, - ray.dir.y * ray.dir.y - ray.dir.x * -ray.dir.z + -ray.dir.z() * ray.dir.z() - ray.dir.y() * ray.dir.x(), + ray.dir.x() * ray.dir.x() - ray.dir.z() * ray.dir.y(), + ray.dir.y() * ray.dir.y() - ray.dir.x() * -ray.dir.z() }; crossed.normalize(); @@ -1702,9 +1702,9 @@ void CStateManager::TestBombHittingWater(const CActor& damager, const zeus::CVec if (TCastToPtr water = damagee) { zeus::CAABox bounds = water->GetTriggerBoundsWR(); - zeus::CVector3f hitPos(pos.x, pos.y, bounds.max.z); + zeus::CVector3f hitPos(pos.x(), pos.y(), bounds.max.z()); float bombRad = powerBomb ? 4.f : 2.f; - float delta = bounds.max.z - pos.dot(zeus::CVector3f::skUp); + float delta = bounds.max.z() - pos.dot(zeus::CVector3f::skUp); if (delta <= bombRad && delta > 0.f) { // Below surface diff --git a/Runtime/Camera/CBallCamera.cpp b/Runtime/Camera/CBallCamera.cpp index 0194837ad..2d2f678a6 100644 --- a/Runtime/Camera/CBallCamera.cpp +++ b/Runtime/Camera/CBallCamera.cpp @@ -324,7 +324,7 @@ void CBallCamera::BuildSplineNav(CStateManager& mgr) float elevation = x1a0_elevation; float distance = x190_curMinDistance; ConstrainElevationAndDistance(elevation, distance, 0.f, mgr); - zeus::CVector3f pt1(x35c_splineIntermediatePos.x, x35c_splineIntermediatePos.y, GetTranslation().z); + zeus::CVector3f pt1(x35c_splineIntermediatePos.x(), x35c_splineIntermediatePos.y(), GetTranslation().z()); x37c_camSpline.AddKnot(pt1, zeus::CVector3f::skForward); zeus::CVector3f pt2 = pt1 + (x35c_splineIntermediatePos - GetTranslation()) * (0.5f + downFactor); x37c_camSpline.AddKnot(pt2, zeus::CVector3f::skForward); @@ -362,11 +362,11 @@ void CBallCamera::BuildSplineArc(CStateManager& mgr) float distance = x190_curMinDistance; ConstrainElevationAndDistance(elevation, distance, 0.f, mgr); zeus::CVector3f halfwayPoint = (ballPos.toVec2f() - GetTranslation().toVec2f()) * 0.5f + GetTranslation().toVec2f(); - halfwayPoint.z = GetTranslation().z; + halfwayPoint.z() = GetTranslation().z(); zeus::CVector3f delta = GetTranslation() - halfwayPoint; zeus::CQuaternion rot; rot.rotateZ(zeus::degToRad(45.f)); - if (mgr.GetPlayer().GetMoveDir().cross(x34_transform.basis[1]).z >= 0.f) + if (mgr.GetPlayer().GetMoveDir().cross(x34_transform.basis[1]).z() >= 0.f) { rot = zeus::CQuaternion(); rot.rotateZ(zeus::degToRad(-45.f)); @@ -442,7 +442,7 @@ void CBallCamera::UpdatePlayerMovement(float dt, CStateManager& mgr) zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition(); x2f0_ballDelta = ballPos - x2dc_prevBallPos; x2fc_ballDeltaFlat = x2f0_ballDelta; - x2fc_ballDeltaFlat.z = 0.f; + x2fc_ballDeltaFlat.z() = 0.f; if (x2fc_ballDeltaFlat.canBeNormalized()) x2e8_ballVelFlat = x2fc_ballDeltaFlat.magnitude() / dt; else @@ -450,7 +450,7 @@ void CBallCamera::UpdatePlayerMovement(float dt, CStateManager& mgr) x2dc_prevBallPos = ballPos; x18d_28_obtuseDirection = false; zeus::CVector3f camToBallFlat = ballPos - GetTranslation(); - camToBallFlat.z = 0.f; + camToBallFlat.z() = 0.f; if (camToBallFlat.canBeNormalized()) { camToBallFlat.normalize(); @@ -479,7 +479,7 @@ void CBallCamera::UpdateTransform(const zeus::CVector3f& lookDir, const zeus::CV if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr)) useLookDir = hint->GetTransform().basis[1]; zeus::CVector3f lookDirFlat = useLookDir; - lookDirFlat.z = 0.f; + lookDirFlat.z() = 0.f; if (!lookDirFlat.canBeNormalized()) { SetTranslation(pos); @@ -545,7 +545,7 @@ zeus::CVector3f CBallCamera::ConstrainYawAngle(const CPlayer& player, float dist CStateManager& mgr) const { zeus::CVector3f playerToCamFlat = GetTranslation() - player.GetTranslation(); - playerToCamFlat.z = 0.f; + playerToCamFlat.z() = 0.f; zeus::CVector3f lookDir = player.GetTransform().basis[1]; if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) { @@ -697,7 +697,7 @@ zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& hintToLoo return hintToLookDir; zeus::CVector3f hintDir = hint->GetTransform().basis[1]; zeus::CVector3f hintDirFlat = hintDir; - hintDirFlat.z = 0.f; + hintDirFlat.z() = 0.f; if (hintDir.canBeNormalized() && hintDirFlat.canBeNormalized()) { hintDir.normalize(); @@ -710,7 +710,7 @@ zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& hintToLoo } zeus::CVector3f hintToLookDirFlat = hintToLookDir; - hintToLookDirFlat.z = 0.f; + hintToLookDirFlat.z() = 0.f; if (hintToLookDir.canBeNormalized() && hintToLookDirFlat.canBeNormalized()) hintToLookDirFlat.normalize(); else @@ -723,20 +723,20 @@ zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& hintToLoo attitude = refAttitude + zeus::clamp(-x1ac_attitudeRange, attitude - refAttitude, x1ac_attitudeRange); } - if (hintToLookDir.z >= 0.f) + if (hintToLookDir.z() >= 0.f) attitude = -attitude; float azimuth = std::acos(zeus::clamp(-1.f, hintToLookDirFlat.dot(hintDirFlat), 1.f)); if (x18c_30_clampAzimuth) azimuth = zeus::clamp(-x1b0_azimuthRange, azimuth, x1b0_azimuthRange); - if (hintToLookDirFlat.x * hintDirFlat.y - hintDirFlat.x * hintToLookDirFlat.y >= 0.f) + if (hintToLookDirFlat.x() * hintDirFlat.y() - hintDirFlat.x() * hintToLookDirFlat.y() >= 0.f) azimuth = -azimuth; zeus::CQuaternion quat; quat.rotateZ(azimuth); zeus::CVector3f aziLookDirFlat = quat.transform(hintDirFlat); - zeus::CVector3f attitudeAxis(aziLookDirFlat.y, -aziLookDirFlat.x, 0.f); + zeus::CVector3f attitudeAxis(aziLookDirFlat.y(), -aziLookDirFlat.x(), 0.f); attitudeAxis.normalize(); return zeus::CQuaternion::fromAxisAngle(attitudeAxis, -attitude).transform(aziLookDirFlat); } @@ -952,12 +952,12 @@ zeus::CVector3f CBallCamera::InterpolateCameraElevation(const zeus::CVector3f& c if (!x18c_31_clearLOS && x350_obscuringMaterial.HasMaterial(EMaterialTypes::Floor)) { x3d4_elevInterpTimer = 1.f; - ret.z = x3d8_elevInterpStart = GetTranslation().z; + ret.z() = x3d8_elevInterpStart = GetTranslation().z(); } else if (x3d4_elevInterpTimer > 0.f) { x3d4_elevInterpTimer -= dt; - ret.z = (camPos.z - x3d8_elevInterpStart) * (1.f - zeus::clamp(0.f, x3d4_elevInterpTimer, 1.f)) + + ret.z() = (camPos.z() - x3d8_elevInterpStart) * (1.f - zeus::clamp(0.f, x3d4_elevInterpTimer, 1.f)) + x3d8_elevInterpStart; } @@ -979,10 +979,10 @@ zeus::CVector3f CBallCamera::CalculateCollidersCentroid(const std::vectorx4c_occlusionCount < 2 && col.x4c_occlusionCount < 2) { - float z0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.z; - float x1 = prevCol->x50_scale * col.x8_lastLocalPos.x; - float x0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.x; - float z1 = prevCol->x50_scale * col.x8_lastLocalPos.z; + float z0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.z(); + float x1 = prevCol->x50_scale * col.x8_lastLocalPos.x(); + float x0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.x(); + float z1 = prevCol->x50_scale * col.x8_lastLocalPos.z(); float cross = x0 * z1 - x1 * z0; accumCross += cross; @@ -1015,29 +1015,29 @@ zeus::CVector3f CBallCamera::ApplyColliders() zeus::CVector3f mediumCentroid = CalculateCollidersCentroid(x274_mediumColliders, x2c8_mediumCollidersObsCount); zeus::CVector3f largeCentroid = CalculateCollidersCentroid(x284_largeColliders, x2cc_largeCollidersObsCount); - if (smallCentroid.y == 0.f) + if (smallCentroid.y() == 0.f) x2a0_smallCentroid = smallCentroid; else x2a0_smallCentroid = zeus::CVector3f::skZero; - float centroidX = x2a0_smallCentroid.x; - float centroidZ = x2a0_smallCentroid.z; + float centroidX = x2a0_smallCentroid.x(); + float centroidZ = x2a0_smallCentroid.z(); - if (mediumCentroid.y == 0.f) + if (mediumCentroid.y() == 0.f) x2ac_mediumCentroid = mediumCentroid; else x2ac_mediumCentroid = zeus::CVector3f::skZero; - centroidX += x2ac_mediumCentroid.x; - centroidZ += x2ac_mediumCentroid.z; + centroidX += x2ac_mediumCentroid.x(); + centroidZ += x2ac_mediumCentroid.z(); - if (largeCentroid.y == 0.f) + if (largeCentroid.y() == 0.f) x2b8_largeCentroid = largeCentroid; else x2b8_largeCentroid = zeus::CVector3f::skZero; - centroidX += x2b8_largeCentroid.x; - centroidZ += x2b8_largeCentroid.z; + centroidX += x2b8_largeCentroid.x(); + centroidZ += x2b8_largeCentroid.z(); if (x18c_31_clearLOS) centroidX /= 1.5f; @@ -1075,10 +1075,10 @@ void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vectorGetBallCameraOffset().y, g_tweakPlayer->GetPlayerBallHalfExtent()}; - x310_idealLookVec.y *= x308_speedFactor; - x31c_predictedLookPos = mgr.GetPlayer().GetMoveDir() * x310_idealLookVec.y; - x31c_predictedLookPos.z = x310_idealLookVec.z; + x310_idealLookVec = {0.f, g_tweakBall->GetBallCameraOffset().y(), g_tweakPlayer->GetPlayerBallHalfExtent()}; + x310_idealLookVec.y() *= x308_speedFactor; + x31c_predictedLookPos = mgr.GetPlayer().GetMoveDir() * x310_idealLookVec.y(); + x31c_predictedLookPos.z() = float(x310_idealLookVec.z()); x31c_predictedLookPos += mgr.GetPlayer().GetTranslation(); zeus::CTransform predictedLookXf = zeus::lookAt(xf.origin, x31c_predictedLookPos); float toleranceRecip = 1.f / tolerance; @@ -1225,9 +1225,9 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) x2c4_smallCollidersObsCount = CountObscuredColliders(x264_smallColliders); x2c8_mediumCollidersObsCount = CountObscuredColliders(x274_mediumColliders); x2cc_largeCollidersObsCount = CountObscuredColliders(x284_largeColliders); - zeus::CVector3f posAtBallLevel = {0.f, 0.f, GetTranslation().z - ballPos.z}; + zeus::CVector3f posAtBallLevel = {0.f, 0.f, GetTranslation().z() - ballPos.z()}; zeus::CVector3f ballToCamFlat = GetTranslation() - ballPos; - ballToCamFlat.z = 0.f; + ballToCamFlat.z() = 0.f; float ballToCamFlatMag = 0.f; if (ballToCamFlat.canBeNormalized()) ballToCamFlatMag = ballToCamFlat.magnitude(); @@ -1240,7 +1240,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) float distance = x214_ballCameraSpring.ApplyDistanceSpring(x190_curMinDistance, ballToCamFlatMag, (3.f + x308_speedFactor) * dt); zeus::CVector3f camToBall = ballPos - GetTranslation(); - camToBall.z = 0.f; + camToBall.z() = 0.f; if (camToBall.canBeNormalized()) { camToBall.normalize(); @@ -1309,9 +1309,9 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) g_tweakBall->GetBallCameraBoostYawSpeed(), dt, mgr); } ballToCam.normalize(); - ballToCam.z = 0.f; + ballToCam.z() = 0.f; ballToCam = ballToCam * distance; - ballToCam.z = 1.f; + ballToCam.z() = 1.f; desiredBallToCam = ballToCam; noDoor = false; } @@ -1328,10 +1328,10 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) ballToCam = ConstrainYawAngle(mgr.GetPlayer(), g_tweakBall->GetBallCameraChaseDistance(), g_tweakBall->GetBallCameraChaseYawSpeed(), dt, mgr); } - ballToCam.z = 0.f; + ballToCam.z() = 0.f; ballToCam.normalize(); ballToCam = ballToCam * distance; - ballToCam.z = g_tweakBall->GetBallCameraElevation(); + ballToCam.z() = g_tweakBall->GetBallCameraElevation(); desiredBallToCam = ballToCam; noDoor = false; } @@ -1385,7 +1385,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) colliderPointLocal = AvoidGeometry(lookXf, nearList, dt, mgr); zeus::CVector3f ballToCam2 = GetTranslation() - ballPos; - ballToCam2.z = 0.f; + ballToCam2.z() = 0.f; if (ballToCam2.magnitude() < 2.f) { if (x18c_31_clearLOS && x478_shortMoveCount > 2) @@ -1431,10 +1431,10 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) zeus::CVector3f finalPos = posDelta * cDistSpringMag + x294_dampedPos; if (mgr.GetPlayer().GetMorphBall()->GetSpiderBallState() != CMorphBall::ESpiderBallState::Active && - !x18e_24_noElevationVelClamp && mgr.GetPlayer().GetVelocity().z > 8.f) + !x18e_24_noElevationVelClamp && mgr.GetPlayer().GetVelocity().z() > 8.f) { zeus::CVector3f delta = finalPos - oldPos; - delta.z = zeus::clamp(-0.1f * dt, delta.z, 0.1f * dt); + delta.z() = zeus::clamp(-0.1f * dt, float(delta.z()), 0.1f * dt); finalPos = oldPos + delta; } @@ -1442,12 +1442,12 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) finalPos = InterpolateCameraElevation(finalPos, dt); if (x18d_29_noElevationInterp) - finalPos.z = elevation + ballPos.z; + finalPos.z() = elevation + ballPos.z(); if (ballToCam2.magnitude() < 2.f) { - if (finalPos.z < 2.f + ballPos.z) - finalPos.z = 2.f + ballPos.z; + if (finalPos.z() < 2.f + ballPos.z()) + finalPos.z() = 2.f + ballPos.z(); x214_ballCameraSpring.Reset(); } @@ -1457,12 +1457,12 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) if (!door->x2a8_26_isOpen) finalPos = GetTranslation(); - float backupZ = finalPos.z; + float backupZ = finalPos.z(); finalPos = MoveCollisionActor(finalPos, dt, mgr); if (x18c_31_clearLOS && x478_shortMoveCount > 0) { - finalPos.z = backupZ; + finalPos.z() = backupZ; finalPos = MoveCollisionActor(finalPos, dt, mgr); } @@ -1494,11 +1494,11 @@ zeus::CVector3f CBallCamera::ClampElevationToWater(zeus::CVector3f& pos, CStateM zeus::CVector3f ret = pos; if (TCastToConstPtr water = mgr.GetObjectById(mgr.GetPlayer().GetFluidId())) { - float waterZ = water->GetTriggerBoundsWR().max.z; - if (pos.z >= waterZ && pos.z - waterZ <= 0.25f) - ret.z = 0.25f + waterZ; - else if (pos.z < waterZ && pos.z - waterZ >= -0.12f) - ret.z = waterZ - 0.12f; + float waterZ = water->GetTriggerBoundsWR().max.z(); + if (pos.z() >= waterZ && pos.z() - waterZ <= 0.25f) + ret.z() = 0.25f + waterZ; + else if (pos.z() < waterZ && pos.z() - waterZ >= -0.12f) + ret.z() = waterZ - 0.12f; } return ret; } @@ -1512,9 +1512,9 @@ void CBallCamera::UpdateTransitionFromBallCamera(CStateManager& mgr) x47c_failsafeState->x90_splinePoints[2] += delta; x47c_failsafeState->x90_splinePoints[3] += delta; zeus::CVector3f splinePoint = GetFailsafeSplinePoint(x47c_failsafeState->x90_splinePoints, morphFactor); - splinePoint.z = (splinePoint.z - eyePos.z) * zeus::clamp(0.f, 1.f - 1.5f * morphFactor, 1.f) + eyePos.z; + splinePoint.z() = (splinePoint.z() - eyePos.z()) * zeus::clamp(0.f, 1.f - 1.5f * morphFactor, 1.f) + eyePos.z(); zeus::CVector3f deltaFlat = eyePos - splinePoint; - deltaFlat.z = 0.f; + deltaFlat.z() = 0.f; if (deltaFlat.magnitude() > 0.001f) { SetTransform(zeus::lookAt(splinePoint, zeus::CVector3f::lerp(x1d8_lookPos, eyePos, morphFactor))); @@ -1539,7 +1539,7 @@ void CBallCamera::UpdateUsingTransitions(float dt, CStateManager& mgr) x18d_26_lookAtBall = false; zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition(); zeus::CVector3f eyePos = mgr.GetPlayer().GetEyePosition(); - ballPos.z += x1b4_lookAtOffset.z; + ballPos.z() += x1b4_lookAtOffset.z(); zeus::CVector3f lookDir = x34_transform.basis[1]; zeus::CTransform xe8 = x34_transform; @@ -1608,16 +1608,16 @@ void CBallCamera::UpdateUsingTransitions(float dt, CStateManager& mgr) yawSpeed = std::fabs(std::acos(zeus::clamp(-1.f, playerToCamDir.dot(-moveDir), 1.f))) * morphT / dt; } zeus::CVector3f useLookDir = ConstrainYawAngle(mgr.GetPlayer(), yawSpeed, zeus::degToRad(10.f), dt, mgr); - useLookDir.z = 0.f; + useLookDir.z() = 0.f; useLookDir.normalize(); zeus::CVector3f camPos = useLookDir * distance + eyePos; - camPos.z = (GetTranslation().z - eyePos.z) * morphT + eyePos.z; + camPos.z() = (GetTranslation().z() - eyePos.z()) * morphT + eyePos.z(); finalPos = ClampElevationToWater(camPos, mgr); finalPos = MoveCollisionActor(finalPos, dt, mgr); zeus::CVector3f finalToBall = ballPos - finalPos; - finalToBall.z = 0.f; + finalToBall.z() = 0.f; zeus::CVector3f lookPos = ballPos; - lookPos.z = morphT * (eyePos.z - ballPos.z) + ballPos.z; + lookPos.z() = morphT * (eyePos.z() - ballPos.z()) + ballPos.z(); if (finalToBall.canBeNormalized()) SetTransform(zeus::lookAt(finalPos, lookPos)); else @@ -1642,7 +1642,7 @@ zeus::CTransform CBallCamera::UpdateCameraPositions(float dt, const zeus::CTrans const zeus::CTransform& newXf) { zeus::CTransform useXf = newXf; - if (std::fabs(oldXf.basis[1].z) > 0.9f && std::fabs(newXf.basis[1].z) > 0.9f && + if (std::fabs(oldXf.basis[1].z()) > 0.9f && std::fabs(newXf.basis[1].z()) > 0.9f && oldXf.basis[0].dot(newXf.basis[0]) <= 0.999f) { zeus::CVector3f newRight = zeus::CQuaternion::clampedRotateTo(oldXf.basis[0], newXf.basis[0], @@ -1859,9 +1859,9 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation if (!mgr.RayCollideWorld(ballPos, eyePos, BallCameraFilter, nullptr)) eyePos = ballPos; - zeus::CVector3f idealLookVec(0.f, -dist, elev - (eyePos.z - ballPos.z)); + zeus::CVector3f idealLookVec(0.f, -dist, elev - (eyePos.z() - ballPos.z())); idealLookVec = lookDirXf.getRotation() * idealLookVec; - zeus::CVector3f lookVec(0.f, distance, elev - (eyePos.z - ballPos.z)); + zeus::CVector3f lookVec(0.f, distance, elev - (eyePos.z() - ballPos.z())); float idealLookDist = idealLookVec.magnitude(); float resolveLOSIntervalAng = zeus::degToRad(30.f); bool foundClear = false; @@ -1869,8 +1869,8 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation if (!clear && idealLookDist <= 0.f) { zeus::CAABox x13ac(ballPos - distance, ballPos + distance); - x13ac.min.z = ballPos.z; - x13ac.max.z = elev + ballPos.z; + x13ac.min.z() = float(ballPos.z()); + x13ac.max.z() = elev + ballPos.z(); rstl::reserved_vector nearList; mgr.BuildNearList(nearList, x13ac, BallCameraFilter, TCastToConstPtr(mgr.GetObjectById(x46c_collisionActorId)).GetPtr()); @@ -1956,8 +1956,8 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation if (!foundClear) { zeus::CAABox findBounds(ballPos - distance, ballPos + distance); - findBounds.min.z = ballPos.z; - findBounds.max.z = elev + ballPos.z; + findBounds.min.z() = float(ballPos.z()); + findBounds.max.z() = elev + ballPos.z(); rstl::reserved_vector nearList; mgr.BuildNearList(nearList, findBounds, BallCameraFilter, TCastToConstPtr(mgr.GetObjectById(x46c_collisionActorId)).GetPtr()); @@ -2263,7 +2263,7 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr) if (player->IsMorphBallTransitioning()) { x1d8_lookPos = ballPos; - x1d8_lookPos.z += x1b4_lookAtOffset.z; + x1d8_lookPos.z() += x1b4_lookAtOffset.z(); x1c0_lookPosAhead = x1d8_lookPos; x1cc_fixedLookPos = x1d8_lookPos; } @@ -2271,21 +2271,21 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr) { zeus::CVector3f dirNorm = player->GetMoveDir(); dirNorm.normalize(); - zeus::CVector3f lookAtOffsetAhead(x308_speedFactor * x1b4_lookAtOffset.x, - x308_speedFactor * x1b4_lookAtOffset.y, - x1b4_lookAtOffset.z); + zeus::CVector3f lookAtOffsetAhead(x308_speedFactor * x1b4_lookAtOffset.x(), + x308_speedFactor * x1b4_lookAtOffset.y(), + x1b4_lookAtOffset.z()); if (x18c_25_chaseAllowed && (x400_state == EBallCameraState::Chase || x400_state == EBallCameraState::One)) - lookAtOffsetAhead = zeus::CVector3f(x308_speedFactor * x410_chaseLookAtOffset.x, - x308_speedFactor * x410_chaseLookAtOffset.y, - x410_chaseLookAtOffset.z); + lookAtOffsetAhead = zeus::CVector3f(x308_speedFactor * x410_chaseLookAtOffset.x(), + x308_speedFactor * x410_chaseLookAtOffset.y(), + x410_chaseLookAtOffset.z()); if (mgr.GetCameraManager()->IsInterpolationCameraActive()) - lookAtOffsetAhead = zeus::CVector3f(0.f, 0.f, x1b4_lookAtOffset.z); + lookAtOffsetAhead = zeus::CVector3f(0.f, 0.f, x1b4_lookAtOffset.z()); zeus::CTransform moveXf = player->CreateTransformFromMovementDirection().getRotation(); if (x2fc_ballDeltaFlat.canBeNormalized()) lookAtOffsetAhead = moveXf * lookAtOffsetAhead; zeus::CVector3f lookAtPosAhead = ballPos + lookAtOffsetAhead; x1c0_lookPosAhead = lookAtPosAhead; - x1cc_fixedLookPos = ballPos + zeus::CVector3f(0.f, 0.f, lookAtOffsetAhead.z); + x1cc_fixedLookPos = ballPos + zeus::CVector3f(0.f, 0.f, lookAtOffsetAhead.z()); zeus::CVector3f aheadToCurrentLookDelta = x1d8_lookPos - lookAtPosAhead; float aheadToCurrentLookMag = aheadToCurrentLookDelta.magnitude(); if (aheadToCurrentLookDelta.canBeNormalized()) @@ -2298,7 +2298,7 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr) if (x18d_26_lookAtBall) { x1d8_lookPos = ballPos; - x1d8_lookPos.z += x1b4_lookAtOffset.z; + x1d8_lookPos.z() += x1b4_lookAtOffset.z(); } else { @@ -2330,9 +2330,9 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr) } if (x18d_30_directElevation) { - x1d8_lookPos.z = ballPos.z + x1b4_lookAtOffset.z; - x1c0_lookPosAhead.z = x1d8_lookPos.z; - x1cc_fixedLookPos.z = x1d8_lookPos.z; + x1d8_lookPos.z() = ballPos.z() + x1b4_lookAtOffset.z(); + x1c0_lookPosAhead.z() = float(x1d8_lookPos.z()); + x1cc_fixedLookPos.z() = float(x1d8_lookPos.z()); } if (x18d_31_overrideLookDir) { @@ -2426,7 +2426,7 @@ void CBallCamera::ApplyCameraHint(CStateManager& mgr) { float distance = hint->GetHint().GetBallToCam().toVec2f().magnitude(); zeus::CVector3f camToBall = -zeus::CVector3f(hint->GetHint().GetBallToCam().toVec2f()).normalized(); - camPos = FindDesiredPosition(distance, hint->GetHint().GetBallToCam().z, camToBall, mgr, false); + camPos = FindDesiredPosition(distance, hint->GetHint().GetBallToCam().z(), camToBall, mgr, false); } TeleportCamera(zeus::lookAt(camPos, x1d8_lookPos), mgr); break; @@ -2446,7 +2446,7 @@ void CBallCamera::ApplyCameraHint(CStateManager& mgr) { zeus::CVector3f lookDir = mgr.GetPlayer().GetTranslation() - mgr.GetCameraManager()->GetCurrentCameraTransform(mgr).origin; - lookDir.z = 0.f; + lookDir.z() = 0.f; if (lookDir.canBeNormalized()) lookDir.normalize(); else @@ -2493,7 +2493,7 @@ void CBallCamera::ApplyCameraHint(CStateManager& mgr) void CBallCamera::ResetPosition(CStateManager& mgr) { x1d8_lookPos = mgr.GetPlayer().GetBallPosition(); - x1d8_lookPos.z += x1b4_lookAtOffset.z; + x1d8_lookPos.z() += x1b4_lookAtOffset.z(); x1c0_lookPosAhead = x1d8_lookPos; x1cc_fixedLookPos = x1d8_lookPos; } diff --git a/Runtime/Camera/CCameraFilter.cpp b/Runtime/Camera/CCameraFilter.cpp index 1eab1fca3..5e267da64 100644 --- a/Runtime/Camera/CCameraFilter.cpp +++ b/Runtime/Camera/CCameraFilter.cpp @@ -82,7 +82,7 @@ void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, if (x0_curType == EFilterType::Multiply) x1c_nextColor = zeus::CColor::skWhite; else if (x0_curType == EFilterType::Add || x0_curType == EFilterType::Blend) - x1c_nextColor.a = 0.f; + x1c_nextColor.a() = 0.f; } else { @@ -95,7 +95,7 @@ void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, else if (type == EFilterType::Add || type == EFilterType::Blend) { x18_curColor = x1c_nextColor; - x18_curColor.a = 0.f; + x18_curColor.a() = 0.f; x14_prevColor = x18_curColor; } } diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index 4a94a0ad1..50a46dd26 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -235,7 +235,7 @@ void CCameraManager::RestoreHintlessCamera(CStateManager& mgr) if (hint) { zeus::CVector3f camToPlayerFlat = mgr.GetPlayer().GetTranslation() - ballCamXf.origin; - camToPlayerFlat.z = 0.f; + camToPlayerFlat.z() = 0.f; if (camToPlayerFlat.canBeNormalized()) camToPlayerFlat.normalize(); else diff --git a/Runtime/Camera/CCinematicCamera.cpp b/Runtime/Camera/CCinematicCamera.cpp index 3b8e3dcd2..b1dd06b3f 100644 --- a/Runtime/Camera/CCinematicCamera.cpp +++ b/Runtime/Camera/CCinematicCamera.cpp @@ -199,9 +199,9 @@ void CCinematicCamera::Think(float dt, CStateManager& mgr) { zeus::CVector3f target = mgr.GetPlayer().GetTranslation(); if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) - target.z += mgr.GetPlayer().GetMorphBall()->GetBallRadius(); + target.z() += mgr.GetPlayer().GetMorphBall()->GetBallRadius(); else - target.z += mgr.GetPlayer().GetEyeHeight(); + target.z() += mgr.GetPlayer().GetEyeHeight(); zeus::CVector3f upVec = orientation.transform(zeus::CVector3f::skUp); if ((target - viewPoint).toVec2f().magnitude() < 0.0011920929f) diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index d093654f0..38b08caee 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -85,12 +85,12 @@ void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransf float dt, zeus::CVector3f& rVec) { zeus::CVector3f gunFrontVec = x190_gunFollowXf.frontVector(); - gunFrontVec.z = 0.f; + gunFrontVec.z() = 0.f; if (gunFrontVec.canBeNormalized()) gunFrontVec.normalize(); zeus::CVector3f rVecNoZ = rVec; - rVecNoZ.z = 0.f; + rVecNoZ.z() = 0.f; if (rVecNoZ.canBeNormalized()) rVecNoZ.normalize(); @@ -124,12 +124,12 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) float angleClamp = g_tweakPlayer->GetVerticalFreeLookAngleVel() - std::fabs(x1c0_pitch); angle = zeus::clamp(-angleClamp, angle, angleClamp); zeus::CVector3f vec; - vec.z = std::sin(angle); - vec.y = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle); - vec.x = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle); + vec.z() = std::sin(angle); + vec.y() = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle); + vec.x() = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle); if (g_tweakPlayer->GetFreeLookTurnsPlayer()) { - vec.x = 0.f; + vec.x() = 0.f; if (!zeus::close_enough(vec, zeus::CVector3f::skZero)) vec.normalize(); } @@ -185,9 +185,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) g_tweakPlayer->GetJumpCameraPitchDownFull(), 1.f) * g_tweakPlayer->GetJumpCameraPitchDownAngle(); angle += x1c0_pitch; - rVec.x = 0.f; - rVec.y = std::cos(angle); - rVec.z = -std::sin(angle); + rVec.x() = 0.f; + rVec.y() = std::cos(angle); + rVec.z() = -std::sin(angle); rVec = playerXf.rotate(rVec); } @@ -196,9 +196,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) float angle = zeus::clamp(0.f, (player->x29c_fallCameraTimer - g_tweakPlayer->GetFallCameraPitchDownStart()) / g_tweakPlayer->GetFallCameraPitchDownFull(), 1.f) * g_tweakPlayer->GetFallCameraPitchDownAngle(); - rVec.x = 0.f; - rVec.y = std::cos(angle); - rVec.z = -std::sin(angle); + rVec.x() = 0.f; + rVec.y() = std::cos(angle); + rVec.z() = -std::sin(angle); rVec = playerXf.rotate(rVec); } @@ -264,7 +264,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) gunFrontVec.normalize(); zeus::CVector3f rVecCpy = rVec; - rVecCpy.z = 0.f; + rVecCpy.z() = 0.f; if (rVecCpy.canBeNormalized()) rVecCpy.normalize(); @@ -290,12 +290,12 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) else { zeus::CVector3f gunFront = x190_gunFollowXf.frontVector(); - gunFront.z = 0.f; + gunFront.z() = 0.f; if (gunFront.canBeNormalized()) gunFront.normalize(); zeus::CVector3f rVecCpy = rVec; - rVecCpy.z = 0.f; + rVecCpy.z() = 0.f; if (rVecCpy.canBeNormalized()) rVecCpy.normalize(); @@ -342,12 +342,12 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr) if (TCastToConstPtr pvol = mgr.GetObjectById(x1c4_pitchId)) { zeus::CVector3f pitchDirFlat = pvol->GetTransform().basis[1]; - pitchDirFlat.z = 0.f; + pitchDirFlat.z() = 0.f; if (!pitchDirFlat.canBeNormalized()) pitchDirFlat = zeus::CVector3f::skForward; zeus::CVector3f playerDirFlat = player->GetTransform().basis[1]; - playerDirFlat.z = 0.f; + playerDirFlat.z() = 0.f; playerDirFlat.normalize(); float pitchDot = zeus::clamp(-1.f, pitchDirFlat.dot(playerDirFlat), 1.f); @@ -357,7 +357,7 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr) x1c0_pitch = pvol->GetUpPitch() * -pitchDot; zeus::CVector3f pvolToPlayerFlat = player->GetTranslation() - pvol->GetTranslation(); - pvolToPlayerFlat.z = 0.f; + pvolToPlayerFlat.z() = 0.f; float pitchMul = 0.f; if (pvolToPlayerFlat.canBeNormalized()) { @@ -368,7 +368,7 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr) pitchMul = 1.f; else pitchMul = 1.f - zeus::clamp(-1.f, (pvolPlayerProj - pvol->GetMaxInterpolationDistance()) / - (pvol->GetScale().y - pvol->GetMaxInterpolationDistance()), 1.f); + (pvol->GetScale().y() - pvol->GetMaxInterpolationDistance()), 1.f); } x1c0_pitch *= pitchMul; } diff --git a/Runtime/Camera/CGameCamera.cpp b/Runtime/Camera/CGameCamera.cpp index 3e9b9313c..0a9d38d4a 100644 --- a/Runtime/Camera/CGameCamera.cpp +++ b/Runtime/Camera/CGameCamera.cpp @@ -68,7 +68,7 @@ zeus::CVector3f CGameCamera::ConvertToScreenSpace(const zeus::CVector3f& v) cons if (rVec.isZero()) return {-1.f, -1.f, 1.f}; - rVec = zeus::CVector3f(rVec.x, rVec.z, -rVec.y); + rVec = zeus::CVector3f(rVec.x(), rVec.z(), -rVec.y()); zeus::CMatrix4f mtx = GetPerspectiveMatrix(); return mtx.multiplyOneOverW(rVec); } @@ -84,11 +84,11 @@ zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& ne if (std::fabs(f2) > 0.999f) xfCpy = oldXf; - if (xfCpy.upVector().z < -0.2f) + if (xfCpy.upVector().z() < -0.2f) xfCpy = zeus::CQuaternion::fromAxisAngle(xfCpy.frontVector(), M_PIF).toTransform() * xfCpy; - if (!zeus::close_enough(xfCpy.rightVector().z, 0.f) && - !zeus::close_enough(xfCpy.upVector().z, 0.f)) + if (!zeus::close_enough(xfCpy.rightVector().z(), 0.f) && + !zeus::close_enough(xfCpy.upVector().z(), 0.f)) { if (xfCpy.frontVector().canBeNormalized()) xfCpy = zeus::lookAt(zeus::CVector3f::skZero, xfCpy.frontVector()); diff --git a/Runtime/Camera/CInterpolationCamera.cpp b/Runtime/Camera/CInterpolationCamera.cpp index 8bd6caf3a..c3cdee0b5 100644 --- a/Runtime/Camera/CInterpolationCamera.cpp +++ b/Runtime/Camera/CInterpolationCamera.cpp @@ -131,7 +131,7 @@ bool CInterpolationCamera::InterpolateSinusoidal(zeus::CTransform& xf, const zeu else lookDir = x34_transform.basis[1]; zeus::CVector3f lookDirFlat = lookDir; - lookDirFlat.z = 0.f; + lookDirFlat.z() = 0.f; if (lookDirFlat.canBeNormalized()) { t = zeus::clamp(-1.f, t, 1.f); @@ -209,7 +209,7 @@ bool CInterpolationCamera::InterpolateWithDistance(zeus::CTransform& xf, const z float ang = zeus::clamp(-1.f, std::acos(lookProj) / (M_PIF / 6.f), 1.f) * rotationSpeed * dt; zeus::CVector3f lookDirFlat = lookDir; - lookDirFlat.z = 0.f; + lookDirFlat.z() = 0.f; bool rotationFail = false; if (lookDirFlat.canBeNormalized()) { diff --git a/Runtime/Camera/CPathCamera.cpp b/Runtime/Camera/CPathCamera.cpp index 318b90f52..fffd210f8 100644 --- a/Runtime/Camera/CPathCamera.cpp +++ b/Runtime/Camera/CPathCamera.cpp @@ -55,7 +55,7 @@ void CPathCamera::Think(float dt, CStateManager& mgr) if ((x1ec_flags & 0x10)) { if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr)) - ballLook.z = hint->GetTranslation().z; + ballLook.z() = hint->GetTranslation().z(); } if (!mgr.GetPlayer().GetVelocity().canBeNormalized() && (ballLook - GetTranslation()).canBeNormalized()) @@ -74,7 +74,7 @@ void CPathCamera::Think(float dt, CStateManager& mgr) ClampToClosedDoor(mgr); zeus::CVector3f tmp = ballLook - GetTranslation(); - tmp.z = 0.f; + tmp.z() = 0.f; if (tmp.canBeNormalized()) SetTransform(zeus::lookAt(GetTranslation(), ballLook)); @@ -168,7 +168,7 @@ zeus::CTransform CPathCamera::MoveAlongSpline(float t, CStateManager& mgr) zeus::CVector3f splineToPlayer = mgr.GetPlayer().GetTranslation() - x188_spline.GetInterpolatedSplinePointByLength(x1d8_time).origin; float distToPlayer = 0.f; - splineToPlayer.z = 0.f; + splineToPlayer.z() = 0.f; if (splineToPlayer.canBeNormalized()) distToPlayer = splineToPlayer.magnitude(); float easedDistT = (distToPlayer - x1f0_minEaseDist) / (x1f4_maxEaseDist - x1f0_minEaseDist); diff --git a/Runtime/Character/CActorLights.cpp b/Runtime/Character/CActorLights.cpp index 93cc1e574..cf5b7a9b7 100644 --- a/Runtime/Character/CActorLights.cpp +++ b/Runtime/Character/CActorLights.cpp @@ -81,10 +81,10 @@ void CActorLights::BuildFaceLightList(const CStateManager& mgr, const CGameArea& zeus::CVector3f camToExplo = explosion->GetTranslation() - fpTransform.origin; if (fpTransform.transposeRotate(camToExplo).dot(zeus::CVector3f::skForward) >= 0.f) { - camToExplo.y = -camToExplo.y + ITweakGui::FaceReflectionDistanceDebugValueToActualValue( - g_tweakGui->GetFaceReflectionDistance()); - camToExplo.z = -camToExplo.z + ITweakGui::FaceReflectionHeightDebugValueToActualValue( - g_tweakGui->GetFaceReflectionHeight()); + camToExplo.y() = -camToExplo.y() + ITweakGui::FaceReflectionDistanceDebugValueToActualValue( + g_tweakGui->GetFaceReflectionDistance()); + camToExplo.z() = -camToExplo.z() + ITweakGui::FaceReflectionHeightDebugValueToActualValue( + g_tweakGui->GetFaceReflectionHeight()); explosionLight.SetPosition(fpTransform * camToExplo); zeus::CSphere sphere(originalLight.GetPosition(), originalLight.GetRadius()); if (aabb.intersects(sphere)) @@ -140,7 +140,7 @@ void CActorLights::AddOverflowToLights(const CLight& light, const zeus::CColor& mag = 1.f / mag; zeus::CColor useColor = color * mag; - useColor.a = 1.f; + useColor.a() = 1.f; x0_areaLights.push_back(CLight::BuildCustom(light.GetPosition() * mag, light.GetDirection() * mag, useColor, light.GetAttenuationConstant() * mag, light.GetAttenuationLinear() * mag, @@ -155,15 +155,15 @@ void CActorLights::MoveAmbienceToLights(const zeus::CColor& color) if (x298_29_ambienceGenerated) { x288_ambientColor += color * 0.333333f; - x288_ambientColor.a = 1.f; + x288_ambientColor.a() = 1.f; return; } zeus::CColor useColor = x0_areaLights[0].GetColor() + color; - float maxComponent = std::max(useColor.r, std::max(useColor.g, useColor.b)); + float maxComponent = std::max(useColor.r(), std::max(useColor.g(), useColor.b())); if (maxComponent > FLT_EPSILON) useColor *= (1.f / maxComponent); - useColor.a = 1.f; + useColor.a() = 1.f; x0_areaLights[0].SetColor(useColor); } @@ -174,7 +174,7 @@ void CActorLights::MultiplyLightingLevels(float level) { zeus::CColor color = light.GetColor(); color *= level; - color.a = 1.f; + color.a() = 1.f; light.SetColor(color); } } @@ -303,7 +303,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea& SLightValue& value = valList.back(); value.x0_areaLightIdx = lightIdx; value.x4_color = light.GetNormalIndependentLightingAtPoint(vec); - value.x4_color.a = 0.f; + value.x4_color.a() = 0.f; value.x10_colorMag = value.x4_color.magnitude(); value.x18_visiblity = visible; } @@ -323,7 +323,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea& if (x298_27_findShadowLight) { /* Accumulate magnitudes up to most intense for shadow dynamic range check */ - x288_ambientColor.a = 0.f; + x288_ambientColor.a() = 0.f; float mag = x288_ambientColor.magnitude(); for (auto it = valList.rbegin() ; it != valList.rend() ; ++it) { @@ -436,13 +436,13 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea& MoveAmbienceToLights(overflowAmbColor); /* Clamp ambient color */ - if (x288_ambientColor.r > 1.f) - x288_ambientColor.r = 1.f; - if (x288_ambientColor.g > 1.f) - x288_ambientColor.g = 1.f; - if (x288_ambientColor.b > 1.f) - x288_ambientColor.b = 1.f; - x288_ambientColor.a = 1.f; + if (x288_ambientColor.r() > 1.f) + x288_ambientColor.r() = 1.f; + if (x288_ambientColor.g() > 1.f) + x288_ambientColor.g() = 1.f; + if (x288_ambientColor.b() > 1.f) + x288_ambientColor.b() = 1.f; + x288_ambientColor.a() = 1.f; /* Multiply down lighting with world fader level */ if (worldLightingLevel < 1.f) @@ -534,7 +534,7 @@ std::vector CActorLights::BuildLightVector() const lights.push_back(light); zeus::CColor ambColor = x288_ambientColor; - ambColor.a = 1.f; + ambColor.a() = 1.f; lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, ambColor)); return lights; diff --git a/Runtime/Character/CAdditiveBodyState.cpp b/Runtime/Character/CAdditiveBodyState.cpp index 98ee35f9a..61302e2aa 100644 --- a/Runtime/Character/CAdditiveBodyState.cpp +++ b/Runtime/Character/CAdditiveBodyState.cpp @@ -55,13 +55,13 @@ pas::EAnimationState CABSAim::UpdateBody(float dt, CBodyController& bc, CStateMa { CAnimData& animData = *bc.GetOwner().ModelData()->AnimationData(); - float hAngle = zeus::clamp(-x18_angles[0], std::atan2(target.x, target.y), x18_angles[1]); + float hAngle = zeus::clamp(-x18_angles[0], std::atan2(target.x(), target.y()), x18_angles[1]); hAngle *= 0.63661975f; hAngle = zeus::clamp(-3.f, (hAngle - x28_hWeight) * 0.25f / dt, 3.f); x2c_hWeightVel += dt * zeus::clamp(-10.f, (hAngle - x2c_hWeightVel) / dt, 10.f); - float hypotenuse = std::sqrt(target.y * target.y + target.x * target.x); - float vAngle = zeus::clamp(-x18_angles[3], std::atan2(target.z, hypotenuse), x18_angles[2]); + float hypotenuse = std::sqrt(target.y() * target.y() + target.x() * target.x()); + float vAngle = zeus::clamp(-x18_angles[3], std::atan2(target.z(), hypotenuse), x18_angles[2]); vAngle *= 0.63661975f; vAngle = zeus::clamp(-3.f, (vAngle - x30_vWeight) * 0.25f / dt, 3.f); x34_vWeightVel += dt * zeus::clamp(-10.f, (vAngle - x34_vWeightVel) / dt, 10.f); diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 50906b7da..3d6d9b38e 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -97,6 +97,15 @@ CAnimData::CAnimData(CAssetId id, x1f8_animRoot = treeNode; } +void CAnimData::SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr) +{ + auto search = std::find_if(xc_charInfo.x98_effects.begin(), xc_charInfo.x98_effects.end(), + [effectName](const auto& v) { return v.first == effectName; }); + if (search != xc_charInfo.x98_effects.end()) + for (const auto& p : search->second) + x120_particleDB.SetParticleEffectState(p.GetComponentName(), active, mgr); +} + void CAnimData::InitializeEffects(CStateManager& mgr, TAreaId aId, const zeus::CVector3f& scale) { for (const auto& effects : xc_charInfo.GetEffectList()) diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp index 274d7630f..12e1d8659 100644 --- a/Runtime/Character/CAnimData.hpp +++ b/Runtime/Character/CAnimData.hpp @@ -164,6 +164,7 @@ public: const TLockedToken& charFactory, int drawInstCount); + void SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr); void InitializeEffects(CStateManager&, TAreaId, const zeus::CVector3f&); CAssetId GetEventResourceIdForAnimResourceId(CAssetId) const; void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet); diff --git a/Runtime/Character/CAnimSource.cpp b/Runtime/Character/CAnimSource.cpp index 4d400d69a..4cc96e5ba 100644 --- a/Runtime/Character/CAnimSource.cpp +++ b/Runtime/Character/CAnimSource.cpp @@ -30,18 +30,18 @@ void RotationAndOffsetStorage::CopyRotationsAndOffsets(const std::vector act = x0_actor) diff --git a/Runtime/Character/CBodyState.cpp b/Runtime/Character/CBodyState.cpp index 685b26544..6f84175d3 100644 --- a/Runtime/Character/CBodyState.cpp +++ b/Runtime/Character/CBodyState.cpp @@ -120,7 +120,7 @@ void CBSProjectileAttack::Start(CBodyController& bc, CStateManager& mgr) zeus::CVector3f localDelta = bc.GetOwner().GetTransform().transposeRotate(cmd->GetTargetPosition() - bc.GetOwner().GetTranslation()); - zeus::CRelAngle angle = std::atan2(localDelta.y, localDelta.x); + zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x()); float attackAngle = angle.asDegrees(); CPASAnimParmData parms(18, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), CPASAnimParm::FromReal32(angle.asDegrees()), @@ -217,7 +217,7 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr) const CBCKnockDownCmd* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); - zeus::CRelAngle angle = std::atan2(localDir.y, localDir.z); + zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z()); CPASAnimParmData parms(0, CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); @@ -320,7 +320,7 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) const CBCKnockBackCmd* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack)); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); - zeus::CRelAngle angle = std::atan2(localDir.y, localDir.x); + zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); CPASAnimParmData parms(6, CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); @@ -471,11 +471,10 @@ pas::EAnimationState CBSStep::UpdateBody(float dt, CBodyController& bc, CStateMa void CBSTurn::Start(CBodyController& bc, CStateManager& mgr) { const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; - zeus::CVector2f lookDir2d(lookDir.x, lookDir.y); - x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().x, - bc.GetCommandMgr().GetFaceVector().y); + zeus::CVector2f lookDir2d(lookDir.toVec2f()); + x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); float deltaAngle = zeus::radToDeg(zeus::CVector2f::getAngleDiff(lookDir2d, x8_dest)); - x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y, -lookDir2d.x).dot(x8_dest) > 0.f); + x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); CPASAnimParmData parms(8, CPASAnimParm::FromEnum(s32(x10_turnDir)), CPASAnimParm::FromReal32(deltaAngle), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); @@ -493,8 +492,8 @@ void CBSTurn::Start(CBodyController& bc, CStateManager& mgr) bool CBSTurn::FacingDest(CBodyController& bc) const { const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; - zeus::CVector2f lookDir2d(lookDir.x, lookDir.y); - zeus::CVector2f leftDir(lookDir2d.y, -lookDir2d.x); + zeus::CVector2f lookDir2d(lookDir.toVec2f()); + zeus::CVector2f leftDir(lookDir2d.y(), -lookDir2d.x()); if (x10_turnDir == pas::ETurnDirection::Left) { if (leftDir.dot(x8_dest) < 0.f) @@ -561,11 +560,10 @@ void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr) } else { - x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().x, - bc.GetCommandMgr().GetFaceVector().y); + x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; - zeus::CVector2f lookDir2d(lookDir.x, lookDir.y); - x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y, -lookDir2d.x).dot(x8_dest) > 0.f); + zeus::CVector2f lookDir2d(lookDir.toVec2f()); + x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); CPASAnimParmData parms(5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); @@ -590,13 +588,12 @@ pas::EAnimationState CBSFlyerTurn::UpdateBody(float dt, CBodyController& bc, CSt { if (!bc.GetCommandMgr().GetFaceVector().isZero()) { - x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().x, - bc.GetCommandMgr().GetFaceVector().y); + x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; - zeus::CVector2f lookDir2d(lookDir.x, lookDir.y); - x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y, -lookDir2d.x).dot(x8_dest) > 0.f); + zeus::CVector2f lookDir2d(lookDir.toVec2f()); + x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); } - bc.FaceDirection(zeus::CVector3f(x8_dest.x, x8_dest.y, 0.f), dt); + bc.FaceDirection(zeus::CVector3f(x8_dest.x(), x8_dest.y(), 0.f), dt); } return st; } @@ -869,7 +866,7 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) const CBCKnockBackCmd* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack)); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); - zeus::CRelAngle angle = std::atan2(localDir.y, localDir.x); + zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); CPASAnimParmData parms(11, CPASAnimParm::FromEnum(s32(bc.GetFallState())), CPASAnimParm::FromReal32(angle.asDegrees())); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); @@ -1022,7 +1019,7 @@ bool CBSJump::CheckForWallJump(CBodyController& bc, CStateManager& mgr) { float distToWall = (xc_waypoint1 - act->GetTranslation()).magnitude(); zeus::CAABox aabb = act->GetBoundingBox(); - float xExtent = (aabb.max.x - aabb.min.x) * 0.5f; + float xExtent = (aabb.max.x() - aabb.min.x()) * 0.5f; if (distToWall < 1.414f * xExtent || (act->CanLongJump() && distToWall < 3.f * xExtent)) { x4_state = x30_26_wallBounceRight ? pas::EJumpState::WallBounceRight : pas::EJumpState::WallBounceLeft; @@ -1143,8 +1140,8 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa if (TCastToPtr act = bc.GetOwner()) { zeus::CVector3f toFinal = x24_waypoint2 - act->GetTranslation(); - float tmp = std::sqrt(act->GetGravityConstant() / (2.f * toFinal.z)); - act->SetVelocityWR(zeus::CVector3f(tmp * toFinal.x, tmp * toFinal.y, 0.f)); + float tmp = std::sqrt(act->GetGravityConstant() / (2.f * toFinal.z())); + act->SetVelocityWR(zeus::CVector3f(tmp * toFinal.x(), tmp * toFinal.y(), 0.f)); } } break; @@ -1184,7 +1181,7 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr) static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)); x4_state = pas::EHurledState(cmd->GetSkipLaunchState()); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); - zeus::CRelAngle angle = std::atan2(localDir.y, localDir.x); + zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); x8_knockAngle = angle.asDegrees(); CPASAnimParmData parms(14, CPASAnimParm::FromInt32(-1), CPASAnimParm::FromReal32(x8_knockAngle), @@ -1291,7 +1288,7 @@ bool CBSHurled::ShouldStartLand(float dt, CBodyController& bc) const if (ai->IsOnGround()) return true; if (zeus::close_enough(ai->GetTranslation(), x1c_lastTranslation, 0.0001f) && - ai->GetVelocity().z < 0.f) + ai->GetVelocity().z() < 0.f) { x28_landedDur += dt; if (x28_landedDur >= 0.25f) @@ -1406,7 +1403,7 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr) const CBCSlideCmd* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Slide)); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetSlideDirection()); - float angle = std::atan2(localDir.y, localDir.x); + float angle = std::atan2(localDir.y(), localDir.x()); CPASAnimParmData parms(15, CPASAnimParm::FromEnum(s32(cmd->GetSlideType())), CPASAnimParm::FromReal32(zeus::radToDeg(angle))); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); @@ -1733,12 +1730,12 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta if (TCastToPtr wp = mgr.ObjectById(x8_wpId)) { zeus::CVector3f toWp = wp->GetTranslation() - act->GetTranslation(); - if (toWp.z > 0.f) + if (toWp.z() > 0.f) { - float tmp = -act->GetMomentum().z / act->GetMass(); - float tmp2 = std::sqrt(tmp * 2.f * toWp.z); + float tmp = -act->GetMomentum().z() / act->GetMass(); + float tmp2 = std::sqrt(tmp * 2.f * toWp.z()); tmp = 1.f / (tmp2 / tmp); - xc_launchVel = zeus::CVector3f(tmp * toWp.x, tmp * toWp.y, tmp2); + xc_launchVel = zeus::CVector3f(tmp * toWp.x(), tmp * toWp.y(), tmp2); x18_24_launched = false; } } @@ -1842,7 +1839,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta if (TCastToPtr wp = mgr.ObjectById(x8_wpId)) { xc_launchVel = 15.f * wp->GetTransform().basis[1]; - xc_launchVel.z = 5.f; + xc_launchVel.z() = 5.f; } else { @@ -2005,13 +2002,13 @@ float CBSLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc) if (IsPitchable()) { zeus::CVector3f tmp = vec; - tmp.z = 0.f; + tmp.z() = 0.f; zeus::CVector3f lookVec = act->GetTransform().basis[1]; - lookVec.z = 0.f; + lookVec.z() = 0.f; lookVec.normalize(); bc.FaceDirection3D(tmp, lookVec, dt); zeus::CVector3f lookVec2 = act->GetTransform().basis[1]; - lookVec2.z = vec.z; + lookVec2.z() = float(vec.z()); lookVec2.normalize(); if (!zeus::close_enough(lookVec, lookVec2, 0.0001f)) { @@ -2021,7 +2018,7 @@ float CBSLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc) } bc.FaceDirection3D(lookVec2, act->GetTransform().basis[1], dt); zeus::CVector3f lookVec3 = act->GetTransform().basis[1]; - lookVec3.z = 0.f; + lookVec3.z() = 0.f; bc.FaceDirection3D(lookVec3, act->GetTransform().basis[1], dt); } else @@ -2283,11 +2280,11 @@ float CBSFlyerLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc) float ret = CBSLocomotion::ApplyLocomotionPhysics(dt, bc); if (TCastToPtr act = bc.GetOwner()) { - if (std::fabs(bc.GetCommandMgr().GetMoveVector().z) > 0.01f && + if (std::fabs(bc.GetCommandMgr().GetMoveVector().z()) > 0.01f && (!x3cc_pitchable || bc.GetBodyStateInfo().GetMaximumPitch() < 0.17453292f)) { zeus::CVector3f dir; - dir.z = dt * bc.GetBodyStateInfo().GetMaxSpeed() * bc.GetCommandMgr().GetMoveVector().z; + dir.z() = dt * bc.GetBodyStateInfo().GetMaxSpeed() * bc.GetCommandMgr().GetMoveVector().z(); act->ApplyImpulseWR(act->GetMoveToORImpulseWR(dir, dt), zeus::CAxisAngle::sIdentity); } } diff --git a/Runtime/Character/CGroundMovement.cpp b/Runtime/Character/CGroundMovement.cpp index 4c3ec1921..bda4a435a 100644 --- a/Runtime/Character/CGroundMovement.cpp +++ b/Runtime/Character/CGroundMovement.cpp @@ -34,7 +34,7 @@ void CGroundMovement::CheckFalling(CPhysicsActor& actor, CStateManager& mgr, flo mgr.SendScriptMsg(&actor, kInvalidUniqueId, EScriptObjectMessage::OnFloor); actor.SetAngularVelocityWR(actor.GetAngularVelocityWR() * 0.98f); zeus::CVector3f vel = actor.GetTransform().transposeRotate(actor.GetVelocity()); - vel.z = 0.f; + vel.z() = 0.f; actor.SetVelocityOR(vel); actor.SetMomentumWR(zeus::CVector3f::skZero); } @@ -166,15 +166,15 @@ bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& m return true; zeus::CAABox actorAABB = actor.GetBoundingBox(); - if (normAccum.z >= 0.f) + if (normAccum.z() >= 0.f) { - zextent = aabb.max.z - actorAABB.min.z + 0.02f; + zextent = aabb.max.z() - actorAABB.min.z() + 0.02f; if (zextent > stepUp) return true; } else { - zextent = aabb.min.z - actorAABB.max.z - 0.02f; + zextent = aabb.min.z() - actorAABB.max.z() - 0.02f; if (zextent < -stepDown) return true; } @@ -226,9 +226,9 @@ bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateMana zeus::CAABox actorAABB = actor.GetBoundingBox(); float zextent; if (amt > 0.f) - zextent = aabb.min.z - actorAABB.max.z - 0.02f + amt; + zextent = aabb.min.z() - actorAABB.max.z() - 0.02f + amt; else - zextent = aabb.max.z - actorAABB.min.z + 0.02f + amt; + zextent = aabb.max.z() - actorAABB.min.z() + 0.02f + amt; actor.MoveCollisionPrimitive({0.f, 0.f, zextent}); @@ -426,11 +426,11 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& if (noJump) { zeus::CVector3f vel = player.GetVelocity(); - vel.z = 0.f; + vel.z() = 0.f; actor.SetVelocityWR(vel); - actor.x15c_force.z = 0.f; - actor.x150_momentum.z = 0.f; - actor.x168_impulse.z = 0.f; + actor.x15c_force.z() = 0.f; + actor.x150_momentum.z() = 0.f; + actor.x168_impulse.z() = 0.f; } CPhysicsState physStatePre = actor.GetPhysicsState(); @@ -688,9 +688,9 @@ bool CGroundMovement::RemoveNormalComponent(const zeus::CVector3f& a, zeus::CVec static bool RemovePositiveZComponentFromNormal(zeus::CVector3f& vec) { - if (vec.z > 0.f && vec.z < 0.99f) + if (vec.z() > 0.f && vec.z() < 0.99f) { - vec.z = 0.f; + vec.z() = 0.f; vec.normalize(); return true; } @@ -795,9 +795,9 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics vel += (elasticForce - dot) * collisionNorm; if (clipCollision && floorCollision) if (!CGroundMovement::RemoveNormalComponent(floorPlaneNormal, vel)) - vel.z = 0.f; - if (vel.z > opts.x38_maxPositiveVerticalVelocity) - vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z); + vel.z() = 0.f; + if (vel.z() > opts.x38_maxPositiveVerticalVelocity) + vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z()); if (opts.x18_dampForceAndMomentum) { @@ -818,11 +818,11 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics if (opts.x0_setWaterLandingForce && !floor) { - if (collisionInfo.GetNormalLeft().z < -0.1f && vel.z > 0.f) - vel.z *= 0.5f; + if (collisionInfo.GetNormalLeft().z() < -0.1f && vel.z() > 0.f) + vel.z() *= 0.5f; - float zNormAbs = std::fabs(collisionInfo.GetNormalLeft().z); - if ((zNormAbs > opts.x10_downwardZThreshold && vel.z < 0.f) || zNormAbs > opts.xc_anyZThreshold) + float zNormAbs = std::fabs(collisionInfo.GetNormalLeft().z()); + if ((zNormAbs > opts.x10_downwardZThreshold && vel.z() < 0.f) || zNormAbs > opts.xc_anyZThreshold) { actor.x15c_force = zeus::CVector3f(0.f, 0.f, -(1.f + std::max(opts.x4_waterLandingForceCoefficient * zNormAbs, @@ -836,8 +836,8 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics else { zeus::CVector3f vel = actor.x138_velocity; - if (actor.x138_velocity.z > opts.x38_maxPositiveVerticalVelocity) - vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z); + if (actor.x138_velocity.z() > opts.x38_maxPositiveVerticalVelocity) + vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z()); actor.SetVelocityWR(vel); } diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp index 3705e8033..f9d2c2b47 100644 --- a/Runtime/Character/CModelData.cpp +++ b/Runtime/Character/CModelData.cpp @@ -385,7 +385,7 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf, { if (x14_25_sortThermal && which == EWhichModel::ThermalHot) { - zeus::CColor mul(drawFlags.x4_color.a, drawFlags.x4_color.a); + zeus::CColor mul(drawFlags.x4_color.a(), drawFlags.x4_color.a()); RenderThermal(xf, mul, {0.f, 0.f, 0.f, 0.25f}, drawFlags); } else @@ -500,7 +500,7 @@ void CModelData::DisintegrateDraw(EWhichModel which, const zeus::CTransform& xf, CModelFlags flags(5, 0, 3, zeus::CColor::skWhite); flags.m_extendedShader = EExtendedShader::Disintegrate; flags.addColor = addColor; - flags.addColor.a = t; // Stash T value in here (shader does not care) + flags.addColor.a() = t; // Stash T value in here (shader does not care) if (x10_animData) { diff --git a/Runtime/Character/CRagDoll.cpp b/Runtime/Character/CRagDoll.cpp index e1cd92dc4..6ca8272b2 100644 --- a/Runtime/Character/CRagDoll.cpp +++ b/Runtime/Character/CRagDoll.cpp @@ -87,7 +87,7 @@ void CRagDoll::AccumulateForces(float dt, float waterTop) float volume = particle.x10_radius * particle.x10_radius * particle.x10_radius; totalVolume += volume; centerOfVolume += particle.x4_curPos * volume; - float fromTargetZ = particle.x4_curPos.z - targetZ; + float fromTargetZ = particle.x4_curPos.z() - targetZ; float verticalAcc = x48_floatingGravity; float termVelCoefficient = 0.f; if (std::fabs(fromTargetZ) < 0.5f) @@ -100,7 +100,7 @@ void CRagDoll::AccumulateForces(float dt, float waterTop) verticalAcc = x44_normalGravity; termVelCoefficient = 1.f; } - particle.x20_velocity.z += verticalAcc; + particle.x20_velocity.z() += verticalAcc; zeus::CVector3f vel = (particle.x4_curPos - particle.x14_prevPos) * fps; float velMag = vel.magnitude(); if (velMag > FLT_EPSILON) diff --git a/Runtime/Character/CRagDoll.hpp b/Runtime/Character/CRagDoll.hpp index 19fc9be59..bda2c3de9 100644 --- a/Runtime/Character/CRagDoll.hpp +++ b/Runtime/Character/CRagDoll.hpp @@ -136,6 +136,8 @@ public: bool IsPrimed() const { return x68_26_primed; } bool WillContinueSmallMovements() const { return x68_27_continueSmallMovements; } bool IsOver() const { return x68_25_over; } + void SetNoOverTimer(bool b) { x68_28_noOverTimer = b; } + void SetContinueSmallMovements(bool b) { x68_27_continueSmallMovements = b; } }; } diff --git a/Runtime/Character/CSteeringBehaviors.cpp b/Runtime/Character/CSteeringBehaviors.cpp index 6b38168af..e4f2a81a8 100644 --- a/Runtime/Character/CSteeringBehaviors.cpp +++ b/Runtime/Character/CSteeringBehaviors.cpp @@ -405,7 +405,7 @@ CSteeringBehaviors::ProjectOrbitalPosition(const zeus::CVector3f& pos, const zeu if (vel.canBeNormalized()) { zeus::CVector3f pointToPos = pos - orbitPoint; - pointToPos.z = 0.f; + pointToPos.z() = 0.f; if (pointToPos.canBeNormalized()) { zeus::CVector3f useVel = vel; @@ -416,7 +416,7 @@ CSteeringBehaviors::ProjectOrbitalPosition(const zeus::CVector3f& pos, const zeu { usePos += preThinkDt * useVel; zeus::CVector3f usePointToPos = usePos - orbitPoint; - usePointToPos.z = 0.f; + usePointToPos.z() = 0.f; if (usePointToPos.canBeNormalized()) { usePointToPos.normalize(); diff --git a/Runtime/Collision/CAABoxFilter.cpp b/Runtime/Collision/CAABoxFilter.cpp index 3be7b5bdd..91966625a 100644 --- a/Runtime/Collision/CAABoxFilter.cpp +++ b/Runtime/Collision/CAABoxFilter.cpp @@ -14,15 +14,15 @@ void CAABoxFilter::FilterBoxFloorCollisions(const CCollisionInfoList& in, CColli float minZ = 10000.f; for (const CCollisionInfo& info : in) { - if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Wall) && info.GetPoint().z < minZ) - minZ = info.GetPoint().z; + if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Wall) && info.GetPoint().z() < minZ) + minZ = info.GetPoint().z(); } CCollisionInfoList temp; for (const CCollisionInfo& info : in) { if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Floor)) { - if (info.GetPoint().z < minZ) + if (info.GetPoint().z() < minZ) temp.Add(info, false); } else diff --git a/Runtime/Collision/CAreaOctTree.cpp b/Runtime/Collision/CAreaOctTree.cpp index 4dc643104..45cbbd81e 100644 --- a/Runtime/Collision/CAreaOctTree.cpp +++ b/Runtime/Collision/CAreaOctTree.cpp @@ -13,10 +13,14 @@ static bool _close_enough(float f1, float f2, float epsilon) static bool BoxLineTest(const zeus::CAABox& aabb, const zeus::CLine& line, float& lT, float& hT) { - const float* aabbMin = &aabb.min.x; - const float* aabbMax = &aabb.max.x; - const float* lorigin = &line.origin.x; - const float* ldir = &line.dir.x; + zeus::simd_floats aabbMinF(aabb.min.mSimd); + zeus::simd_floats aabbMaxF(aabb.max.mSimd); + zeus::simd_floats lineOrigin(line.origin.mSimd); + zeus::simd_floats lineDir(line.dir.mSimd); + const float* aabbMin = aabbMinF.data(); + const float* aabbMax = aabbMaxF.data(); + const float* lorigin = lineOrigin.data(); + const float* ldir = lineDir.data(); lT = -FLT_MAX; hT = FLT_MAX; @@ -416,11 +420,11 @@ void CAreaOctTree::Node::LineTestExInternal(const zeus::CLine& line, const CMate zeus::CVector3f lineStart = line.origin + (lT * line.dir); int selector = 0; - if (lineStart.x >= center.x) + if (lineStart.x() >= center.x()) selector = 1; - if (lineStart.y >= center.y) + if (lineStart.y() >= center.y()) selector |= 1 << 1; - if (lineStart.z >= center.z) + if (lineStart.z() >= center.z()) selector |= 1 << 2; float tmpLoT = lT; diff --git a/Runtime/Collision/CCollidableOBBTree.cpp b/Runtime/Collision/CCollidableOBBTree.cpp index 8d9d5a451..07d03d30d 100644 --- a/Runtime/Collision/CCollidableOBBTree.cpp +++ b/Runtime/Collision/CCollidableOBBTree.cpp @@ -162,7 +162,7 @@ CRayCastResult CCollidableOBBTree::LineIntersectsTree(const zeus::CMRay& ray, co zeus::CPlane CCollidableOBBTree::TransformPlane(const zeus::CPlane& pl, const zeus::CTransform& xf) { zeus::CVector3f normal = xf.rotate(pl.normal()); - return zeus::CPlane(normal, (xf * (pl.normal() * pl.d)).dot(normal)); + return zeus::CPlane(normal, (xf * (pl.normal() * pl.d())).dot(normal)); } bool CCollidableOBBTree::SphereCollideWithLeafMoving(const COBBTree::CLeafData& leaf, const zeus::CTransform& xf, diff --git a/Runtime/Collision/CCollidableSphere.cpp b/Runtime/Collision/CCollidableSphere.cpp index 33fac90e8..470751aa5 100644 --- a/Runtime/Collision/CCollidableSphere.cpp +++ b/Runtime/Collision/CCollidableSphere.cpp @@ -68,82 +68,82 @@ bool Sphere_AABox(const CInternalCollisionStructure& collision, CCollisionInfoLi switch (flags) { case 0x1a: - point = zeus::CVector3f(b1.max.x, b1.max.y, b1.min.z); + point = zeus::CVector3f(b1.max.x(), b1.max.y(), b1.min.z()); break; case 0x19: - point = zeus::CVector3f(b1.min.x, b1.max.y, b1.min.z); + point = zeus::CVector3f(b1.min.x(), b1.max.y(), b1.min.z()); break; case 0x16: - point = zeus::CVector3f(b1.max.x, b1.min.y, b1.min.z); + point = zeus::CVector3f(b1.max.x(), b1.min.y(), b1.min.z()); break; case 0x15: - point = zeus::CVector3f(b1.min.x, b1.min.y, b1.min.z); + point = zeus::CVector3f(b1.min.x(), b1.min.y(), b1.min.z()); break; case 0x2a: - point = zeus::CVector3f(b1.max.x, b1.max.y, b1.max.z); + point = zeus::CVector3f(b1.max.x(), b1.max.y(), b1.max.z()); break; case 0x29: - point = zeus::CVector3f(b1.min.x, b1.max.y, b1.max.z); + point = zeus::CVector3f(b1.min.x(), b1.max.y(), b1.max.z()); break; case 0x26: - point = zeus::CVector3f(b1.max.x, b1.min.y, b1.max.z); + point = zeus::CVector3f(b1.max.x(), b1.min.y(), b1.max.z()); break; case 0x25: - point = zeus::CVector3f(b1.min.x, b1.min.y, b1.max.z); + point = zeus::CVector3f(b1.min.x(), b1.min.y(), b1.max.z()); break; case 0x11: - point = zeus::CVector3f(b1.min.x, s0.position.y, b1.min.z); + point = zeus::CVector3f(b1.min.x(), s0.position.y(), b1.min.z()); break; case 0x12: - point = zeus::CVector3f(b1.max.x, s0.position.y, b1.min.z); + point = zeus::CVector3f(b1.max.x(), s0.position.y(), b1.min.z()); break; case 0x14: - point = zeus::CVector3f(s0.position.x, b1.min.y, b1.min.z); + point = zeus::CVector3f(s0.position.x(), b1.min.y(), b1.min.z()); break; case 0x18: - point = zeus::CVector3f(s0.position.x, b1.max.y, b1.min.z); + point = zeus::CVector3f(s0.position.x(), b1.max.y(), b1.min.z()); break; case 0x5: - point = zeus::CVector3f(b1.min.x, b1.min.y, s0.position.z); + point = zeus::CVector3f(b1.min.x(), b1.min.y(), s0.position.z()); break; case 0x6: - point = zeus::CVector3f(b1.max.x, b1.min.y, s0.position.z); + point = zeus::CVector3f(b1.max.x(), b1.min.y(), s0.position.z()); break; case 0x9: - point = zeus::CVector3f(b1.min.x, b1.max.y, s0.position.z); + point = zeus::CVector3f(b1.min.x(), b1.max.y(), s0.position.z()); break; case 0xa: - point = zeus::CVector3f(b1.max.x, b1.max.y, s0.position.z); + point = zeus::CVector3f(b1.max.x(), b1.max.y(), s0.position.z()); break; case 0x21: - point = zeus::CVector3f(b1.min.x, s0.position.y, b1.max.z); + point = zeus::CVector3f(b1.min.x(), s0.position.y(), b1.max.z()); break; case 0x22: - point = zeus::CVector3f(b1.max.x, s0.position.y, b1.max.z); + point = zeus::CVector3f(b1.max.x(), s0.position.y(), b1.max.z()); break; case 0x24: - point = zeus::CVector3f(s0.position.x, b1.min.y, b1.max.z); + point = zeus::CVector3f(s0.position.x(), b1.min.y(), b1.max.z()); break; case 0x28: - point = zeus::CVector3f(s0.position.x, b1.max.y, b1.max.z); + point = zeus::CVector3f(s0.position.x(), b1.max.y(), b1.max.z()); break; case 0x1: - point = zeus::CVector3f(b1.min.x, s0.position.y, s0.position.z); + point = zeus::CVector3f(b1.min.x(), s0.position.y(), s0.position.z()); break; case 0x2: - point = zeus::CVector3f(b1.max.x, s0.position.y, s0.position.z); + point = zeus::CVector3f(b1.max.x(), s0.position.y(), s0.position.z()); break; case 0x4: - point = zeus::CVector3f(s0.position.x, b1.min.y, s0.position.z); + point = zeus::CVector3f(s0.position.x(), b1.min.y(), s0.position.z()); break; case 0x8: - point = zeus::CVector3f(s0.position.x, b1.max.y, s0.position.z); + point = zeus::CVector3f(s0.position.x(), b1.max.y(), s0.position.z()); break; case 0x10: - point = zeus::CVector3f(s0.position.x, s0.position.y, b1.min.z); + point = zeus::CVector3f(s0.position.x(), s0.position.y(), b1.min.z()); break; case 0x20: - point = zeus::CVector3f(s0.position.x, s0.position.y, b1.max.z); + point = zeus::CVector3f(s0.position.x(), s0.position.y(), b1.max.z()); break; default: break; } diff --git a/Runtime/Collision/CCollisionActor.cpp b/Runtime/Collision/CCollisionActor.cpp index af747545c..c8035f862 100644 --- a/Runtime/Collision/CCollisionActor.cpp +++ b/Runtime/Collision/CCollisionActor.cpp @@ -113,8 +113,8 @@ zeus::CVector3f CCollisionActor::GetScanObjectIndicatorPosition(const CStateMana else { const zeus::CVector3f v = GetBoxSize(); - float comp = (v.x < v.y ? v.y : v.z); - comp = (comp < v.z ? v.x : comp); + float comp = (v.x() < v.y() ? v.y() : v.z()); + comp = (comp < v.z() ? v.x() : comp); scanScale = 0.5f * comp; } diff --git a/Runtime/Collision/CCollisionActorManager.cpp b/Runtime/Collision/CCollisionActorManager.cpp index 0902f4495..1c8bf7a2f 100644 --- a/Runtime/Collision/CCollisionActorManager.cpp +++ b/Runtime/Collision/CCollisionActorManager.cpp @@ -34,7 +34,7 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own if (dist <= FLT_EPSILON) continue; zeus::CVector3f bounds = modDesc.GetBounds(); - bounds.y += dist; + bounds.y() += dist; CCollisionActor* newAct = new CCollisionActor(mgr.AllocateUniqueId(), area, x10_ownerId, bounds, zeus::CVector3f(0.f, 0.5f * dist, 0.f), active, modDesc.GetMass()); diff --git a/Runtime/Collision/CCollisionInfo.hpp b/Runtime/Collision/CCollisionInfo.hpp index 76413f215..9bbd42ec7 100644 --- a/Runtime/Collision/CCollisionInfo.hpp +++ b/Runtime/Collision/CCollisionInfo.hpp @@ -32,9 +32,9 @@ public: CCollisionInfo(const zeus::CAABox& aabox, const CMaterialList& list1, const CMaterialList& list2, const zeus::CVector3f& normalLeft, const zeus::CVector3f& normalRight) : x0_point(aabox.min), - xc_extentX(aabox.max.x - aabox.min.x, 0.f, 0.f), - x18_extentY(0.f, aabox.max.y - aabox.min.y, 0.f), - x24_extentZ(0.f, 0.f, aabox.max.z - aabox.min.z), + xc_extentX(aabox.max.x() - aabox.min.x(), 0.f, 0.f), + x18_extentY(0.f, aabox.max.y() - aabox.min.y(), 0.f), + x24_extentZ(0.f, 0.f, aabox.max.z() - aabox.min.z()), x30_valid(true), x31_hasExtents(true), x38_materialLeft(list2), x40_materialRight(list1), x48_normalLeft(normalLeft), x54_normalRight(normalRight) diff --git a/Runtime/Collision/CGameCollision.cpp b/Runtime/Collision/CGameCollision.cpp index f414890ba..2c7861dca 100644 --- a/Runtime/Collision/CGameCollision.cpp +++ b/Runtime/Collision/CGameCollision.cpp @@ -246,14 +246,14 @@ bool CGameCollision::CanBlock(const CMaterialList& mat, const zeus::CVector3f& v if (mat.HasMaterial(EMaterialTypes::Floor)) return true; - return (v.z > 0.85f); + return (v.z() > 0.85f); } bool CGameCollision::IsFloor(const CMaterialList& mat, const zeus::CVector3f& v) { if (mat.HasMaterial(EMaterialTypes::Floor)) return true; - return (v.z > 0.85f); + return (v.z() > 0.85f); } void CGameCollision::SendMaterialMessage(CStateManager& mgr, const CMaterialList& mat, CActor& act) @@ -424,9 +424,9 @@ float CGameCollision::GetMinExtentForCollisionPrimitive(const CCollisionPrimitiv else if (prim.GetPrimType() == FOURCC('AABX')) { const CCollidableAABox& aabx = static_cast(prim); - zeus::CVector3f extent = aabx.GetAABB().max - aabx.GetAABB().min; - float minExtent = std::min(extent.x, extent.y); - minExtent = std::min(minExtent, extent.z); + const zeus::CVector3f extent = aabx.GetAABB().max - aabx.GetAABB().min; + float minExtent = std::min(extent.x(), extent.y()); + minExtent = std::min(minExtent, extent.z()); return minExtent; } else if (prim.GetPrimType() == FOURCC('ABSH')) @@ -882,7 +882,7 @@ void CGameCollision::CollideWithDynamicBodyNoRot(CPhysicsActor& a0, CPhysicsActo { zeus::CVector3f normal = info.GetNormalLeft(); if (zeroZ) - normal.z = 0.f; + normal.z() = 0.f; zeus::CVector3f relVel = GetActorRelativeVelocities(a0, &a1); float velNormDot = relVel.dot(normal); @@ -952,7 +952,7 @@ void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMateri { zeus::CUnitVector3f useNorm = normal; if (zeroZ && m0.HasMaterial(EMaterialTypes::Player) && !m1.HasMaterial(EMaterialTypes::Floor)) - useNorm.z = 0.f; + useNorm.z() = 0.f; if (useNorm.canBeNormalized()) { diff --git a/Runtime/Collision/CJointCollisionDescription.cpp b/Runtime/Collision/CJointCollisionDescription.cpp index 9b06ba787..93bb58a9b 100644 --- a/Runtime/Collision/CJointCollisionDescription.cpp +++ b/Runtime/Collision/CJointCollisionDescription.cpp @@ -63,8 +63,8 @@ CJointCollisionDescription::OBBCollision(CSegId pivotId, const zeus::CVector3f& void CJointCollisionDescription::ScaleAllBounds(const zeus::CVector3f& scale) { xc_bounds *= scale; - x24_radius *= scale.x; - x28_maxSeparation *= scale.x; + x24_radius *= scale.x(); + x28_maxSeparation *= scale.x(); x18_pivotPoint *= scale; } } diff --git a/Runtime/Collision/CMetroidAreaCollider.cpp b/Runtime/Collision/CMetroidAreaCollider.cpp index 0174a0f46..4b88e83f6 100644 --- a/Runtime/Collision/CMetroidAreaCollider.cpp +++ b/Runtime/Collision/CMetroidAreaCollider.cpp @@ -205,7 +205,7 @@ void CMetroidAreaCollider::BuildOctreeLeafCache(const CAreaOctTree::Node& node, static zeus::CVector3f ClipRayToPlane(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CPlane& plane) { - return (1.f - -plane.pointToPlaneDist(a) / (b - a).dot(plane.vec)) * (a - b) + b; + return (1.f - -plane.pointToPlaneDist(a) / (b - a).dot(plane.normal())) * (a - b) + b; } bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const zeus::CVector3f* verts, @@ -722,8 +722,8 @@ bool CMetroidAreaCollider::MovingAABoxCollisionCheck_Edge(const zeus::CVector3f& zeus::CVector3d clipped = ev0d + (-(ev0d.dot(edge.x70_coDir) - edge.x88_dirCoDirDot) / delta.dot(edge.x70_coDir)) * delta; - int maxCompIdx = (std::fabs(edge.x70_coDir.x) > std::fabs(edge.x70_coDir.y)) ? 0 : 1; - if (std::fabs(edge.x70_coDir[maxCompIdx]) < std::fabs(edge.x70_coDir.z)) + int maxCompIdx = (std::fabs(edge.x70_coDir.x()) > std::fabs(edge.x70_coDir.y())) ? 0 : 1; + if (std::fabs(edge.x70_coDir[maxCompIdx]) < std::fabs(edge.x70_coDir.z())) maxCompIdx = 2; int ci0, ci1; diff --git a/Runtime/Collision/CRayCastResult.cpp b/Runtime/Collision/CRayCastResult.cpp index d4d47703e..72c02a178 100644 --- a/Runtime/Collision/CRayCastResult.cpp +++ b/Runtime/Collision/CRayCastResult.cpp @@ -20,8 +20,7 @@ void CRayCastResult::MakeInvalid() void CRayCastResult::Transform(const zeus::CTransform& xf) { x4_point = xf * x4_point; - x10_plane.vec = xf.rotate(x10_plane.vec); - x10_plane.d = x10_plane.vec.dot(x4_point); + x10_plane = zeus::CPlane(xf.rotate(x10_plane.normal()), x10_plane.normal().dot(x4_point)); } } diff --git a/Runtime/Collision/CollisionUtil.cpp b/Runtime/Collision/CollisionUtil.cpp index 098182d6d..c7ce67bce 100644 --- a/Runtime/Collision/CollisionUtil.cpp +++ b/Runtime/Collision/CollisionUtil.cpp @@ -64,7 +64,7 @@ u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& aabb, zeus::CVector3f vec0 = {-1.f, -1.f, -1.f}; zeus::CVector3f vec1; - if (rayDelta.x != 0.f && rayDelta.y != 0.f && rayDelta.z != 0.f) + if (rayDelta.x() != 0.f && rayDelta.y() != 0.f && rayDelta.z() != 0.f) { for (int i=0 ; i<3 ; ++i) { @@ -97,13 +97,13 @@ u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& aabb, { sign[i] = 1; bad = false; - end[i] = aabbMin[i]; + end[i] = float(aabbMin[i]); } else if (rayStart[i] > aabbMax[i]) { sign[i] = 0; bad = false; - end[i] = aabbMax[i]; + end[i] = float(aabbMax[i]); } } @@ -118,16 +118,16 @@ u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& aabb, vec0[i] = (end[i] - rayStart[i]) / rayDelta[i]; } - float maxComp = vec0.x; + float maxComp = vec0.x(); int maxCompIdx = 0; - if (maxComp < vec0.y) + if (maxComp < vec0.y()) { - maxComp = vec0.y; + maxComp = vec0.y(); maxCompIdx = 1; } - if (maxComp < vec0.z) + if (maxComp < vec0.z()) { - maxComp = vec0.z; + maxComp = vec0.z(); maxCompIdx = 2; } @@ -163,7 +163,7 @@ u32 RayAABoxIntersection_Double(const zeus::CMRay& ray, const zeus::CAABox& aabb zeus::CVector3d vec0 = {-1.0, -1.0, -1.0}; zeus::CVector3d vec1; - if (rayDelta.x != 0.0 && rayDelta.y != 0.0 && rayDelta.z != 0.0) + if (rayDelta.x() != 0.0 && rayDelta.y() != 0.0 && rayDelta.z() != 0.0) { for (int i=0 ; i<3 ; ++i) { @@ -196,13 +196,13 @@ u32 RayAABoxIntersection_Double(const zeus::CMRay& ray, const zeus::CAABox& aabb { sign[i] = 1; bad = false; - end[i] = aabbMin[i]; + end[i] = double(aabbMin[i]); } else if (rayStart[i] > aabbMax[i]) { sign[i] = 0; bad = false; - end[i] = aabbMax[i]; + end[i] = double(aabbMax[i]); } } @@ -217,16 +217,16 @@ u32 RayAABoxIntersection_Double(const zeus::CMRay& ray, const zeus::CAABox& aabb vec0[i] = (end[i] - rayStart[i]) / rayDelta[i]; } - double maxComp = vec0.x; + double maxComp = vec0.x(); int maxCompIdx = 0; - if (maxComp < vec0.y) + if (maxComp < vec0.y()) { - maxComp = vec0.y; + maxComp = vec0.y(); maxCompIdx = 1; } - if (maxComp < vec0.z) + if (maxComp < vec0.z()) { - maxComp = vec0.z; + maxComp = vec0.z(); maxCompIdx = 2; } @@ -389,32 +389,32 @@ bool AABoxAABoxIntersection(const zeus::CAABox& aabb0, const CMaterialList& list const zeus::CAABox& aabb1, const CMaterialList& list1, CCollisionInfoList& infoList) { - zeus::CVector3f maxOfMin(std::max(aabb0.min.x, aabb1.min.x), - std::max(aabb0.min.y, aabb1.min.y), - std::max(aabb0.min.z, aabb1.min.z)); - zeus::CVector3f minOfMax(std::min(aabb0.max.x, aabb1.max.x), - std::min(aabb0.max.y, aabb1.max.y), - std::min(aabb0.max.z, aabb1.max.z)); + zeus::CVector3f maxOfMin(std::max(aabb0.min.x(), aabb1.min.x()), + std::max(aabb0.min.y(), aabb1.min.y()), + std::max(aabb0.min.z(), aabb1.min.z())); + zeus::CVector3f minOfMax(std::min(aabb0.max.x(), aabb1.max.x()), + std::min(aabb0.max.y(), aabb1.max.y()), + std::min(aabb0.max.z(), aabb1.max.z())); - if (maxOfMin.x >= minOfMax.x || maxOfMin.y >= minOfMax.y || maxOfMin.z >= minOfMax.z) + if (maxOfMin.x() >= minOfMax.x() || maxOfMin.y() >= minOfMax.y() || maxOfMin.z() >= minOfMax.z()) return false; zeus::CAABox boolAABB(maxOfMin, minOfMax); int ineqFlags[] = { - (aabb0.min.x <= aabb1.min.x ? 1 << 0 : 0) | - (aabb0.min.x <= aabb1.max.x ? 1 << 1 : 0) | - (aabb0.max.x <= aabb1.min.x ? 1 << 2 : 0) | - (aabb0.max.x <= aabb1.max.x ? 1 << 3 : 0), - (aabb0.min.y <= aabb1.min.y ? 1 << 0 : 0) | - (aabb0.min.y <= aabb1.max.y ? 1 << 1 : 0) | - (aabb0.max.y <= aabb1.min.y ? 1 << 2 : 0) | - (aabb0.max.y <= aabb1.max.y ? 1 << 3 : 0), - (aabb0.min.z <= aabb1.min.z ? 1 << 0 : 0) | - (aabb0.min.z <= aabb1.max.z ? 1 << 1 : 0) | - (aabb0.max.z <= aabb1.min.z ? 1 << 2 : 0) | - (aabb0.max.z <= aabb1.max.z ? 1 << 3 : 0), + (aabb0.min.x() <= aabb1.min.x() ? 1 << 0 : 0) | + (aabb0.min.x() <= aabb1.max.x() ? 1 << 1 : 0) | + (aabb0.max.x() <= aabb1.min.x() ? 1 << 2 : 0) | + (aabb0.max.x() <= aabb1.max.x() ? 1 << 3 : 0), + (aabb0.min.y() <= aabb1.min.y() ? 1 << 0 : 0) | + (aabb0.min.y() <= aabb1.max.y() ? 1 << 1 : 0) | + (aabb0.max.y() <= aabb1.min.y() ? 1 << 2 : 0) | + (aabb0.max.y() <= aabb1.max.y() ? 1 << 3 : 0), + (aabb0.min.z() <= aabb1.min.z() ? 1 << 0 : 0) | + (aabb0.min.z() <= aabb1.max.z() ? 1 << 1 : 0) | + (aabb0.max.z() <= aabb1.min.z() ? 1 << 2 : 0) | + (aabb0.max.z() <= aabb1.max.z() ? 1 << 3 : 0), }; for (int i=0 ; i<3 ; ++i) @@ -505,48 +505,48 @@ static bool planeBoxOverlap(const zeus::CVector3f& normal, float d, const zeus:: /*======================== X-tests ========================*/ #define AXISTEST_X01(a, b, fa, fb) \ - p0 = a*v0.y - b*v0.z; \ - p2 = a*v2.y - b*v2.z; \ + p0 = a*v0.y() - b*v0.z(); \ + p2 = a*v2.y() - b*v2.z(); \ if(p0rad || max<-rad) return false; #define AXISTEST_X2(a, b, fa, fb) \ - p0 = a*v0.y - b*v0.z; \ - p1 = a*v1.y - b*v1.z; \ + p0 = a*v0.y() - b*v0.z(); \ + p1 = a*v1.y() - b*v1.z(); \ if(p0rad || max<-rad) return false; /*======================== Y-tests ========================*/ #define AXISTEST_Y02(a, b, fa, fb) \ - p0 = -a*v0.x + b*v0.z; \ - p2 = -a*v2.x + b*v2.z; \ + p0 = -a*v0.x() + b*v0.z(); \ + p2 = -a*v2.x() + b*v2.z(); \ if(p0rad || max<-rad) return false; #define AXISTEST_Y1(a, b, fa, fb) \ - p0 = -a*v0.x + b*v0.z; \ - p1 = -a*v1.x + b*v1.z; \ + p0 = -a*v0.x() + b*v0.z(); \ + p1 = -a*v1.x() + b*v1.z(); \ if(p0rad || max<-rad) return false; /*======================== Z-tests ========================*/ #define AXISTEST_Z12(a, b, fa, fb) \ - p1 = a*v1.x - b*v1.y; \ - p2 = a*v2.x - b*v2.y; \ + p1 = a*v1.x() - b*v1.y(); \ + p2 = a*v2.x() - b*v2.y(); \ if(p2rad || max<-rad) return false; #define AXISTEST_Z0(a, b, fa, fb) \ - p0 = a*v0.x - b*v0.y; \ - p1 = a*v1.x - b*v1.y; \ + p0 = a*v0.x() - b*v0.y(); \ + p1 = a*v1.x() - b*v1.y(); \ if(p0rad || max<-rad) return false; bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxhalfsize, @@ -578,26 +578,26 @@ bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxh /* Bullet 3: */ /* test the 9 tests first (this was faster) */ - fex = std::fabs(e0.x); - fey = std::fabs(e0.y); - fez = std::fabs(e0.z); - AXISTEST_X01(e0.z, e0.y, fez, fey); - AXISTEST_Y02(e0.z, e0.x, fez, fex); - AXISTEST_Z12(e0.y, e0.x, fey, fex); + fex = std::fabs(e0.x()); + fey = std::fabs(e0.y()); + fez = std::fabs(e0.z()); + AXISTEST_X01(e0.z(), e0.y(), fez, fey); + AXISTEST_Y02(e0.z(), e0.x(), fez, fex); + AXISTEST_Z12(e0.y(), e0.x(), fey, fex); - fex = std::fabs(e1.x); - fey = std::fabs(e1.y); - fez = std::fabs(e1.z); - AXISTEST_X01(e1.z, e1.y, fez, fey); - AXISTEST_Y02(e1.z, e1.x, fez, fex); - AXISTEST_Z0(e1.y, e1.x, fey, fex); + fex = std::fabs(e1.x()); + fey = std::fabs(e1.y()); + fez = std::fabs(e1.z()); + AXISTEST_X01(e1.z(), e1.y(), fez, fey); + AXISTEST_Y02(e1.z(), e1.x(), fez, fex); + AXISTEST_Z0(e1.y(), e1.x(), fey, fex); - fex = std::fabs(e2.x); - fey = std::fabs(e2.y); - fez = std::fabs(e2.z); - AXISTEST_X2(e2.z, e2.y, fez, fey); - AXISTEST_Y1(e2.z, e2.x, fez, fex); - AXISTEST_Z12(e2.y, e2.x, fey, fex); + fex = std::fabs(e2.x()); + fey = std::fabs(e2.y()); + fez = std::fabs(e2.z()); + AXISTEST_X2(e2.z(), e2.y(), fez, fey); + AXISTEST_Y1(e2.z(), e2.x(), fez, fex); + AXISTEST_Z12(e2.y(), e2.x(), fey, fex); /* Bullet 1: */ /* first test overlap in the {x,y,z}-directions */ @@ -606,16 +606,16 @@ bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxh /* the triangle against the AABB */ /* test in X-direction */ - FINDMINMAX(v0.x, v1.x, v2.x, min, max); - if (min>boxhalfsize.x || max<-boxhalfsize.x) return false; + FINDMINMAX(v0.x(), v1.x(), v2.x(), min, max); + if (min>boxhalfsize.x() || max<-boxhalfsize.x()) return false; /* test in Y-direction */ - FINDMINMAX(v0.y, v1.y, v2.y, min, max); - if (min>boxhalfsize.y || max<-boxhalfsize.y) return false; + FINDMINMAX(v0.y(), v1.y(), v2.y(), min, max); + if (min>boxhalfsize.y() || max<-boxhalfsize.y()) return false; /* test in Z-direction */ - FINDMINMAX(v0.z, v1.z, v2.z, min, max); - if (min>boxhalfsize.z || max<-boxhalfsize.z) return false; + FINDMINMAX(v0.z(), v1.z(), v2.z(), min, max); + if (min>boxhalfsize.z() || max<-boxhalfsize.z()) return false; /* Bullet 2: */ /* test if the box intersects the plane of the triangle */ @@ -878,7 +878,7 @@ bool TriSphereIntersection(const zeus::CSphere& sphere, point = zeus::baryToWorld(trivert2, trivert1, trivert0, barys); if (baryX == 0.f || baryX == 1.f || baryY == 0.f || baryY == 1.f || - barys.z == 0.f || barys.z == 1.f) + barys.z() == 0.f || barys.z() == 1.f) normal = -sphere.getSurfaceNormal(point); else normal = (trivert1 - trivert0).cross(trivert2 - trivert0).normalized(); diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index c3dc66681..ffc19457f 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -93,15 +93,15 @@ void Buckets::Sort() bool partial, full; if (planeObj.x3c_25_zOnly) { - partial = drawable.GetBounds().max.z > planeObj.GetPlane().d; - full = drawable.GetBounds().min.z > planeObj.GetPlane().d; + partial = drawable.GetBounds().max.z() > planeObj.GetPlane().d(); + full = drawable.GetBounds().min.z() > planeObj.GetPlane().d(); } else { partial = planeObj.GetPlane().pointToPlaneDist( - drawable.GetBounds().closestPointAlongVector(planeObj.GetPlane().vec)) > 0.f; + drawable.GetBounds().closestPointAlongVector(planeObj.GetPlane().normal())) > 0.f; full = planeObj.GetPlane().pointToPlaneDist( - drawable.GetBounds().furthestPointAlongVector(planeObj.GetPlane().vec)) > 0.f; + drawable.GetBounds().furthestPointAlongVector(planeObj.GetPlane().normal())) > 0.f; } bool cont; if (drawable.GetType() == EDrawableType::Particle) @@ -378,7 +378,7 @@ void CBooRenderer::CalcDrawFogFan(const zeus::CPlane* planes, int numPlanes, con u32 insidePlaneCount = 0; bool outsidePlane[20]; for (int i=0 ; ireset(7 * 6); for (int i=0 ; i<7 ; ++i) @@ -541,23 +541,23 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus:: zeus::CVector3f overW; if (i < 8) { - overW = points[i].toVec3f() * (1.f / points[i].w); + overW = points[i].toVec3f() * (1.f / points[i].w()); } else { const zeus::CVector4f& pt1 = points[s_FogVolumeCtrl.xfc_[i-8][0]]; const zeus::CVector4f& pt2 = points[s_FogVolumeCtrl.xfc_[i-8][1]]; - bool eq1 = (pt1.z / pt1.w) == 1.f; - bool eq2 = (pt2.z / pt2.w) == 1.f; + bool eq1 = (pt1.z() / pt1.w()) == 1.f; + bool eq2 = (pt2.z() / pt2.w()) == 1.f; if (eq1 == eq2) continue; - float interp = -(pt1.w - 1.f) / (pt2.w - pt1.w); + float interp = -(pt1.w() - 1.f) / (pt2.w() - pt1.w()); if (interp <= 0.f || interp >= 1.f) continue; - float wRecip = 1.f / (interp * (pt2.w - pt1.w) + pt1.w); + float wRecip = 1.f / (interp * (pt2.w() - pt1.w()) + pt1.w()); zeus::CVector3f pt1_3 = pt1.toVec3f(); zeus::CVector3f pt2_3 = pt2.toVec3f(); overW = (pt1_3 + interp * (pt2_3 - pt1_3)) * wRecip; @@ -566,8 +566,8 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus:: //if (overW.z > 1.001f) // continue; - int vpX = zeus::clamp(0, int(g_Viewport.x8_width * overW.x * 0.5f + (g_Viewport.x8_width / 2)), int(g_Viewport.x8_width)); - int vpY = zeus::clamp(0, int(g_Viewport.xc_height * overW.y * 0.5f + (g_Viewport.xc_height / 2)), int(g_Viewport.xc_height)); + int vpX = zeus::clamp(0, int(g_Viewport.x8_width * overW.x() * 0.5f + (g_Viewport.x8_width / 2)), int(g_Viewport.x8_width)); + int vpY = zeus::clamp(0, int(g_Viewport.xc_height * overW.y() * 0.5f + (g_Viewport.xc_height / 2)), int(g_Viewport.xc_height)); vpMax.x = std::max(vpMax.x, vpX); vpMin.x = std::min(vpMin.x, vpX); vpMax.y = std::max(vpMax.y, vpY); @@ -758,7 +758,7 @@ void CBooRenderer::AddWorldSurfaces(CBooModel& model) { const MaterialSet::Material& mat = model.GetMaterialByIndex(surf->m_data.matIdx); zeus::CAABox aabb = surf->GetBounds(); - zeus::CVector3f pt = aabb.closestPointAlongVector(xb0_viewPlane.vec); + zeus::CVector3f pt = aabb.closestPointAlongVector(xb0_viewPlane.normal()); Buckets::Insert(pt, aabb, EDrawableType::WorldSurface, surf, xb0_viewPlane, mat.heclIr.m_blendSrc == boo::BlendFactor::SrcAlpha && mat.heclIr.m_blendDst == boo::BlendFactor::InvSrcAlpha); @@ -1026,16 +1026,20 @@ void CBooRenderer::PostRenderFogs() x2ac_fogVolumes.sort([](const CFogVolumeListItem& a, const CFogVolumeListItem& b) { zeus::CAABox aabbA = a.x34_aabb.getTransformedAABox(a.x0_transform); - bool insideA = aabbA.pointInside(zeus::CVector3f(CGraphics::g_ViewPoint.x, CGraphics::g_ViewPoint.y, aabbA.min.z)); + bool insideA = aabbA.pointInside( + zeus::CVector3f(CGraphics::g_ViewPoint.x(), CGraphics::g_ViewPoint.y(), aabbA.min.z())); zeus::CAABox aabbB = b.x34_aabb.getTransformedAABox(b.x0_transform); - bool insideB = aabbB.pointInside(zeus::CVector3f(CGraphics::g_ViewPoint.x, CGraphics::g_ViewPoint.y, aabbB.min.z)); + bool insideB = aabbB.pointInside( + zeus::CVector3f(CGraphics::g_ViewPoint.x(), CGraphics::g_ViewPoint.y(), aabbB.min.z())); if (insideA != insideB) return insideA; - float dotA = aabbA.furthestPointAlongVector(CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]); - float dotB = aabbB.furthestPointAlongVector(CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]); + float dotA = aabbA.furthestPointAlongVector( + CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]); + float dotB = aabbB.furthestPointAlongVector( + CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]); return dotA < dotB; }); for (const CFogVolumeListItem& fog : x2ac_fogVolumes) @@ -1050,7 +1054,7 @@ void CBooRenderer::AddParticleGen(const CParticleGen& gen) { if (auto bounds = gen.GetBounds()) { - zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.vec); + zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.normal()); Buckets::Insert(pt, bounds.value(), EDrawableType::Particle, &gen, xb0_viewPlane, 0); } } @@ -1071,7 +1075,7 @@ void CBooRenderer::AddPlaneObject(const void* obj, const zeus::CAABox& aabb, con bool zOnly = plane.normal() == zeus::CVector3f::skUp; bool invert; if (zOnly) - invert = CGraphics::g_ViewMatrix.origin.z >= plane.d; + invert = CGraphics::g_ViewMatrix.origin.z() >= plane.d(); else invert = plane.pointToPlaneDist(CGraphics::g_ViewMatrix.origin) >= 0.f; Buckets::InsertPlaneObject(closeDist, farDist, aabb, invert, plane, zOnly, EDrawableType(type + 2), obj); @@ -1096,8 +1100,7 @@ void CBooRenderer::SetDrawableCallback(TDrawableCallback cb, const void* ctx) void CBooRenderer::SetWorldViewpoint(const zeus::CTransform& xf) { CGraphics::SetViewPointMatrix(xf); - xb0_viewPlane.vec = xf.basis[1]; - xb0_viewPlane.d = xf.basis[1].dot(xf.origin); + xb0_viewPlane = zeus::CPlane(xf.basis[1], xf.basis[1].dot(xf.origin)); } void CBooRenderer::SetPerspective(float fovy, float width, float height, float znear, float zfar) @@ -1474,7 +1477,7 @@ int CBooRenderer::DrawOverlappingWorldModelIDs(int alphaVal, const std::vector 255) return alphaVal; - flags.x4_color.a = alphaVal / 255.f; + flags.x4_color.a() = alphaVal / 255.f; const CBooModel& model = *item.x10_models[wordModel + j]; const_cast(model).VerifyCurrentShader(0); for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next) @@ -1495,7 +1498,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec const zeus::CAABox& aabb, float alpha) const { CModelFlags flags; - flags.x4_color.a = alpha; + flags.x4_color.a() = alpha; flags.m_extendedShader = EExtendedShader::MorphBallShadow; // Do shadow draw u32 curWord = 0; @@ -1517,7 +1520,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec if (alphaVal > 255) return; - flags.x4_color.r = alphaVal / 255.f; + flags.x4_color.r() = alphaVal / 255.f; const CBooModel& model = *item.x10_models[wordModel + j]; const_cast(model).VerifyCurrentShader(0); for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next) diff --git a/Runtime/Graphics/CGraphics.cpp b/Runtime/Graphics/CGraphics.cpp index a018df554..6d7b1eb31 100644 --- a/Runtime/Graphics/CGraphics.cpp +++ b/Runtime/Graphics/CGraphics.cpp @@ -397,8 +397,8 @@ void CGraphics::FlushProjection() zeus::CVector2i CGraphics::ProjectPoint(const zeus::CVector3f& point) { zeus::CVector3f projPt = GetPerspectiveProjectionMatrix(false).multiplyOneOverW(point); - return {int(projPt.x * g_Viewport.x10_halfWidth) + int(g_Viewport.x10_halfWidth), - int(g_Viewport.xc_height) - (int(projPt.y * g_Viewport.x14_halfHeight) + + return {int(projPt.x() * g_Viewport.x10_halfWidth) + int(g_Viewport.x10_halfWidth), + int(g_Viewport.xc_height) - (int(projPt.y() * g_Viewport.x14_halfHeight) + int(g_Viewport.x14_halfHeight))}; } @@ -413,14 +413,14 @@ SClipScreenRect CGraphics::ClipScreenRectFromMS(const zeus::CVector3f& p1, SClipScreenRect CGraphics::ClipScreenRectFromVS(const zeus::CVector3f& p1, const zeus::CVector3f& p2) { - if (p1.x == 0.f && p1.y == 0.f && p1.z == 0.f) + if (p1.x() == 0.f && p1.y() == 0.f && p1.z() == 0.f) return {}; - if (p2.x == 0.f && p2.y == 0.f && p2.z == 0.f) + if (p2.x() == 0.f && p2.y() == 0.f && p2.z() == 0.f) return {}; - if (-p1.z < GetProjectionState().x14_near || -p2.z < GetProjectionState().x14_near) + if (-p1.z() < GetProjectionState().x14_near || -p2.z() < GetProjectionState().x14_near) return {}; - if (-p1.z > GetProjectionState().x18_far || -p2.z > GetProjectionState().x18_far) + if (-p1.z() > GetProjectionState().x18_far || -p2.z() > GetProjectionState().x18_far) return {}; zeus::CVector2i sp1 = ProjectPoint(p1); diff --git a/Runtime/Graphics/CLight.cpp b/Runtime/Graphics/CLight.cpp index c52fbb4ce..aae8a6a98 100644 --- a/Runtime/Graphics/CLight.cpp +++ b/Runtime/Graphics/CLight.cpp @@ -34,7 +34,7 @@ float CLight::GetIntensity() const if (x1c_type == ELightType::Custom) coef = x30_angleC; const_cast(this)->x48_cachedIntensity = - coef * std::max(x18_color.r, std::max(x18_color.g, x18_color.b)); + coef * std::max(x18_color.r(), std::max(x18_color.g(), x18_color.b())); } return x48_cachedIntensity; } diff --git a/Runtime/Graphics/CLineRenderer.cpp b/Runtime/Graphics/CLineRenderer.cpp index 9e4f369c8..839926873 100644 --- a/Runtime/Graphics/CLineRenderer.cpp +++ b/Runtime/Graphics/CLineRenderer.cpp @@ -102,11 +102,13 @@ static bool IntersectLines(const zeus::CVector2f& pa1, const zeus::CVector2f& pa const zeus::CVector2f& pb1, const zeus::CVector2f& pb2, zeus::CVector3f& intersect) { - float det = (pa1.x - pa2.x) * (pb1.y - pb2.y) - (pa1.y - pa2.y) * (pb1.x - pb2.x); + zeus::CVector2f deltaA = pa1 - pa2; + zeus::CVector2f deltaB = pb1 - pb2; + float det = deltaA.cross(deltaB); if (std::fabs(det) < 0.000001f) return false; - float c0 = pa1.x * pa2.y - pa1.y * pa2.x; - float c1 = pb1.x * pb2.y - pb1.y * pb2.x; + float c0 = pa1.cross(pa2); + float c1 = pb1.cross(pb2); intersect = (c0 * (pb1 - pb2) - c1 * (pa1 - pa2)) / det; return true; } @@ -154,13 +156,13 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo if (!dva.canBeNormalized()) dva = {0.f, 1.f}; dva = dva.normalized().perpendicularVector() * m_lastWidth; - dva.x /= CGraphics::g_ProjAspect; + dva.x() /= CGraphics::g_ProjAspect; zeus::CVector2f dvb = (projPt - m_lastPos).toVec2f(); if (!dvb.canBeNormalized()) dvb = {0.f, 1.f}; dvb = dvb.normalized().perpendicularVector() * m_lastWidth; - dvb.x /= CGraphics::g_ProjAspect; + dvb.x() /= CGraphics::g_ProjAspect; if (m_textured) { @@ -195,8 +197,8 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo if (good1 && good2) { - intersect1.z = m_lastPos.z; - intersect2.z = m_lastPos.z; + intersect1.z() = float(m_lastPos.z()); + intersect2.z() = float(m_lastPos.z()); g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor, m_lastUV}); g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor, m_lastUV}); } @@ -242,8 +244,8 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo if (good1 && good2) { - intersect1.z = m_lastPos.z; - intersect2.z = m_lastPos.z; + intersect1.z() = float(m_lastPos.z()); + intersect2.z() = float(m_lastPos.z()); g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor}); g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor}); } @@ -263,7 +265,7 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo if (!dv.canBeNormalized()) dv = {0.f, 1.f}; dv = dv.normalized().perpendicularVector() * m_lastWidth; - dv.x /= CGraphics::g_ProjAspect; + dv.x() /= CGraphics::g_ProjAspect; if (m_textured) { g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(m_lastPos + dv, m_lastW), m_lastColor, m_lastUV}); @@ -296,13 +298,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) if (!dva.canBeNormalized()) dva = {0.f, 1.f}; dva = dva.normalized().perpendicularVector() * m_lastWidth; - dva.x /= CGraphics::g_ProjAspect; + dva.x() /= CGraphics::g_ProjAspect; zeus::CVector2f dvb = (m_firstPos - m_lastPos).toVec2f(); if (!dvb.canBeNormalized()) dvb = {0.f, 1.f}; dvb = dvb.normalized().perpendicularVector() * m_lastWidth; - dvb.x /= CGraphics::g_ProjAspect; + dvb.x() /= CGraphics::g_ProjAspect; zeus::CVector3f intersect1; bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva, @@ -320,8 +322,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) { if (good1 && good2) { - intersect1.z = m_lastPos.z; - intersect2.z = m_lastPos.z; + intersect1.z() = float(m_lastPos.z()); + intersect2.z() = float(m_lastPos.z()); g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor, m_lastUV}); g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor, m_lastUV}); } @@ -337,8 +339,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) { if (good1 && good2) { - intersect1.z = m_lastPos.z; - intersect2.z = m_lastPos.z; + intersect1.z() = float(m_lastPos.z()); + intersect2.z() = float(m_lastPos.z()); g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor}); g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor}); } @@ -356,13 +358,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) if (!dva.canBeNormalized()) dva = {0.f, 1.f}; dva = dva.normalized().perpendicularVector() * m_firstWidth; - dva.x /= CGraphics::g_ProjAspect; + dva.x() /= CGraphics::g_ProjAspect; zeus::CVector2f dvb = (m_secondPos - m_firstPos).toVec2f(); if (!dvb.canBeNormalized()) dvb = {0.f, 1.f}; dvb = dvb.normalized().perpendicularVector() * m_firstWidth; - dvb.x /= CGraphics::g_ProjAspect; + dvb.x() /= CGraphics::g_ProjAspect; zeus::CVector3f intersect1; bool good1 = IntersectLines(m_lastPos.toVec2f() + dva, m_firstPos.toVec2f() + dva, @@ -380,8 +382,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) { if (good1 && good2) { - intersect1.z = m_firstPos.z; - intersect2.z = m_firstPos.z; + intersect1.z() = float(m_firstPos.z()); + intersect2.z() = float(m_firstPos.z()); g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor, m_lastUV}); g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor, m_lastUV}); } @@ -397,8 +399,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) { if (good1 && good2) { - intersect1.z = m_firstPos.z; - intersect2.z = m_firstPos.z; + intersect1.z() = float(m_firstPos.z()); + intersect2.z() = float(m_firstPos.z()); g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor}); g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor}); } @@ -418,7 +420,7 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) if (!dv.canBeNormalized()) dv = {0.f, 1.f}; dv = dv.normalized().perpendicularVector() * m_lastWidth; - dv.x /= CGraphics::g_ProjAspect; + dv.x() /= CGraphics::g_ProjAspect; if (m_textured) { if (m_mode == EPrimitiveMode::Lines && (m_nextVert & 1)) diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 958ab91a8..f431f0c4a 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -90,7 +90,8 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa else { surfPos = model.x20_aabb.center(); - surfSize = (model.x20_aabb.max.x - model.x20_aabb.min.x) + (model.x20_aabb.max.y - model.x20_aabb.min.y) * 0.5f; + surfSize = (model.x20_aabb.max.x() - model.x20_aabb.min.x()) + + (model.x20_aabb.max.y() - model.x20_aabb.min.y()) * 0.5f; } if (g_Renderer->x318_24_refectionDirty) @@ -131,11 +132,11 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa float f1 = timeScale * g_TransformedTime; float f2 = timeScale * g_TransformedTime2; mtxsOut[1] = ReflectBaseMtx; - mtxsOut[1][0][0] = f1 * v2.x; - mtxsOut[1][1][0] = f1 * v2.y; + mtxsOut[1][0][0] = f1 * v2.x(); + mtxsOut[1][1][0] = f1 * v2.y(); mtxsOut[1][3][0] = -surfPos.dot(v2) * f1 + 0.5f; mtxsOut[1][2][1] = f2; - mtxsOut[1][3][1] = -modelToPlayerLocal.z * f2; + mtxsOut[1][3][1] = -modelToPlayerLocal.z() * f2; switch (CGraphics::g_BooPlatform) { case boo::IGraphicsDataFactory::Platform::OpenGL: @@ -767,28 +768,28 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati case UVAnimation::Mode::MvInvNoTranslation: { texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); - texMtxOut.vec[3].w = 1.f; - postMtxOut.vec[0].x = 0.5f; - postMtxOut.vec[1].y = 0.5f; - postMtxOut.vec[3].x = 0.5f; - postMtxOut.vec[3].y = 0.5f; + texMtxOut.m[3].w() = 1.f; + postMtxOut.m[0].x() = 0.5f; + postMtxOut.m[1].y() = 0.5f; + postMtxOut.m[3].x() = 0.5f; + postMtxOut.m[3].y() = 0.5f; break; } case UVAnimation::Mode::MvInv: { texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); - texMtxOut.vec[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin; - texMtxOut.vec[3].w = 1.f; - postMtxOut.vec[0].x = 0.5f; - postMtxOut.vec[1].y = 0.5f; - postMtxOut.vec[3].x = 0.5f; - postMtxOut.vec[3].y = 0.5f; + texMtxOut.m[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin; + texMtxOut.m[3].w() = 1.f; + postMtxOut.m[0].x() = 0.5f; + postMtxOut.m[1].y() = 0.5f; + postMtxOut.m[3].x() = 0.5f; + postMtxOut.m[3].y() = 0.5f; break; } case UVAnimation::Mode::Scroll: { - texMtxOut.vec[3].x = CGraphics::GetSecondsMod900() * anim.vals[2] + anim.vals[0]; - texMtxOut.vec[3].y = CGraphics::GetSecondsMod900() * anim.vals[3] + anim.vals[1]; + texMtxOut.m[3].x() = CGraphics::GetSecondsMod900() * anim.vals[2] + anim.vals[0]; + texMtxOut.m[3].y() = CGraphics::GetSecondsMod900() * anim.vals[3] + anim.vals[1]; break; } case UVAnimation::Mode::Rotation: @@ -796,35 +797,35 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati float angle = CGraphics::GetSecondsMod900() * anim.vals[1] + anim.vals[0]; float acos = std::cos(angle); float asin = std::sin(angle); - texMtxOut.vec[0].x = acos; - texMtxOut.vec[0].y = asin; - texMtxOut.vec[1].x = -asin; - texMtxOut.vec[1].y = acos; - texMtxOut.vec[3].x = (1.0f - (acos - asin)) * 0.5f; - texMtxOut.vec[3].y = (1.0f - (asin + acos)) * 0.5f; + texMtxOut.m[0].x() = acos; + texMtxOut.m[0].y() = asin; + texMtxOut.m[1].x() = -asin; + texMtxOut.m[1].y() = acos; + texMtxOut.m[3].x() = (1.0f - (acos - asin)) * 0.5f; + texMtxOut.m[3].y() = (1.0f - (asin + acos)) * 0.5f; break; } case UVAnimation::Mode::HStrip: { float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900()); - texMtxOut.vec[3].x = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2]; + texMtxOut.m[3].x() = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2]; break; } case UVAnimation::Mode::VStrip: { float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900()); - texMtxOut.vec[3].y = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2]; + texMtxOut.m[3].y() = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2]; break; } case UVAnimation::Mode::Model: { texMtxOut = CGraphics::g_GXModelMatrix.toMatrix4f(); - texMtxOut.vec[3].zeroOut(); - postMtxOut.vec[0].x = 0.5f; - postMtxOut.vec[1].y = 0.f; - postMtxOut.vec[2].y = 0.5f; - postMtxOut.vec[3].x = CGraphics::g_GXModelMatrix.origin.x * 0.05f; - postMtxOut.vec[3].y = CGraphics::g_GXModelMatrix.origin.y * 0.05f; + texMtxOut.m[3].zeroOut(); + postMtxOut.m[0].x() = 0.5f; + postMtxOut.m[1].y() = 0.f; + postMtxOut.m[2].y() = 0.5f; + postMtxOut.m[3].x() = CGraphics::g_GXModelMatrix.origin.x() * 0.05f; + postMtxOut.m[3].y() = CGraphics::g_GXModelMatrix.origin.y() * 0.05f; break; } case UVAnimation::Mode::CylinderEnvironment: @@ -832,9 +833,9 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); const zeus::CVector3f& viewOrigin = CGraphics::g_ViewMatrix.origin; - float xy = (viewOrigin.x + viewOrigin.y) * 0.025f * anim.vals[1]; + float xy = (viewOrigin.x() + viewOrigin.y()) * 0.025f * anim.vals[1]; xy = (xy - (int)xy); - float z = (viewOrigin.z) * 0.05f * anim.vals[1]; + float z = (viewOrigin.z()) * 0.05f * anim.vals[1]; z = (z - (int)z); float halfA = anim.vals[0] * 0.5f; @@ -879,12 +880,8 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet { /* Special matrices for MorphBall shadow rendering */ zeus::CMatrix4f texMtx = - (zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max.x - flags.mbShadowBox.min.x), - 1.f / (flags.mbShadowBox.max.y - flags.mbShadowBox.min.y), - 1.f / (flags.mbShadowBox.max.z - flags.mbShadowBox.min.z)) * - zeus::CTransform::Translate(-flags.mbShadowBox.min.x, - -flags.mbShadowBox.min.y, - -flags.mbShadowBox.min.z) * CGraphics::g_GXModelView).toMatrix4f(); + (zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max - flags.mbShadowBox.min)) * + zeus::CTransform::Translate(-flags.mbShadowBox.min) * CGraphics::g_GXModelView).toMatrix4f(); for (const MaterialSet::Material& mat : matSet->materials) { (void)mat; @@ -907,11 +904,11 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet 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; + 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 = post0[3].y; + 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) { @@ -941,10 +938,10 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet */ zeus::CMatrix4f& postMtxOut = (*specialMtxOut)[1]; - postMtxOut.vec[0].x = 0.5f; - postMtxOut.vec[1].y = 0.5f; - postMtxOut.vec[3].x = 0.5f; - postMtxOut.vec[3].y = 0.5f; + postMtxOut.m[0].x() = 0.5f; + postMtxOut.m[1].y() = 0.5f; + postMtxOut.m[3].x() = 0.5f; + postMtxOut.m[3].y() = 0.5f; } else if (flags.m_extendedShader == EExtendedShader::WorldShadow) { @@ -953,14 +950,14 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet zeus::CMatrix4f mat = g_shadowTexXf.toMatrix4f(); zeus::CMatrix4f& texMtxOut = (*specialMtxOut)[0]; - texMtxOut[0][0] = mat[0][0]; - texMtxOut[1][0] = mat[1][0]; - texMtxOut[2][0] = mat[2][0]; - texMtxOut[3][0] = mat[3][0]; - texMtxOut[0][1] = mat[0][2]; - texMtxOut[1][1] = mat[1][2]; - texMtxOut[2][1] = mat[2][2]; - texMtxOut[3][1] = mat[3][2]; + 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) @@ -1146,8 +1143,8 @@ boo::ObjToken CBooModel::UpdateUniformData(const CModelFl { CModelShaders::MBShadowUniform& shadowOut = *reinterpret_cast(dataCur); shadowOut.shadowUp = CGraphics::g_GXModelView * zeus::CVector3f::skUp; - shadowOut.shadowUp.w = flags.x4_color.a; - shadowOut.shadowId = flags.x4_color.r; + shadowOut.shadowUp.w() = flags.x4_color.a(); + shadowOut.shadowId = flags.x4_color.r(); } else if (flags.m_extendedShader == EExtendedShader::Disintegrate) { @@ -1470,12 +1467,12 @@ void CModel::ApplyVerticesCPU(const boo::ObjToken& vertBu { const std::pair& avn = vn[i]; float* floats = reinterpret_cast(data + GetPoolVertexOffset(i)); - floats[0] = avn.first.x; - floats[1] = avn.first.y; - floats[2] = avn.first.z; - floats[3] = avn.second.x; - floats[4] = avn.second.y; - floats[5] = avn.second.z; + floats[0] = avn.first.x(); + floats[1] = avn.first.y(); + floats[2] = avn.first.z(); + floats[3] = avn.second.x(); + floats[4] = avn.second.y(); + floats[5] = avn.second.z(); } vertBuf->unmap(); } diff --git a/Runtime/Graphics/CPVSVisOctree.cpp b/Runtime/Graphics/CPVSVisOctree.cpp index ae0b774b8..31667b917 100644 --- a/Runtime/Graphics/CPVSVisOctree.cpp +++ b/Runtime/Graphics/CPVSVisOctree.cpp @@ -44,39 +44,39 @@ s32 CPVSVisOctree::IterateSearch(u8 nodeData, const zeus::CVector3f& tp) const zeus::CVector3f newMax; bool highFlags[3]; - if (tp.x > newMin.x) + if (tp.x() > newMin.x()) { - newMax.x = x2c_searchAabb.max.x; + newMax.x() = x2c_searchAabb.max.x(); highFlags[0] = true; } else { - newMax.x = newMin.x; - newMin.x = x2c_searchAabb.min.x; + newMax.x() = float(newMin.x()); + newMin.x() = float(x2c_searchAabb.min.x()); highFlags[0] = false; } - if (tp.y > newMin.y) + if (tp.y() > newMin.y()) { - newMax.y = x2c_searchAabb.max.y; + newMax.y() = float(x2c_searchAabb.max.y()); highFlags[1] = true; } else { - newMax.y = newMin.y; - newMin.y = x2c_searchAabb.min.y; + newMax.y() = float(newMin.y()); + newMin.y() = float(x2c_searchAabb.min.y()); highFlags[1] = false; } - if (tp.z > newMin.z) + if (tp.z() > newMin.z()) { - newMax.z = x2c_searchAabb.max.z; + newMax.z() = float(x2c_searchAabb.max.z()); highFlags[2] = true; } else { - newMax.z = newMin.z; - newMin.z = x2c_searchAabb.min.z; + newMax.z() = float(newMin.z()); + newMin.z() = float(x2c_searchAabb.min.z()); highFlags[2] = false; } @@ -89,18 +89,18 @@ s32 CPVSVisOctree::IterateSearch(u8 nodeData, const zeus::CVector3f& tp) const zeus::CAABox& newSearch = const_cast(x2c_searchAabb); if (nodeData & 0x1) { - newSearch.min.x = newMin.x; - newSearch.max.x = newMax.x; + newSearch.min.x() = float(newMin.x()); + newSearch.max.x() = float(newMax.x()); } if (nodeData & 0x2) { - newSearch.min.y = newMin.y; - newSearch.max.y = newMax.y; + newSearch.min.y() = float(newMin.y()); + newSearch.max.y() = float(newMax.y()); } if (nodeData & 0x4) { - newSearch.min.z = newMin.z; - newSearch.max.z = newMax.z; + newSearch.min.z() = float(newMin.z()); + newSearch.max.z() = float(newMax.z()); } // Branch node - calculate next relative pointer diff --git a/Runtime/Graphics/CRainSplashGenerator.cpp b/Runtime/Graphics/CRainSplashGenerator.cpp index 2a3f8c8db..fd1de3077 100644 --- a/Runtime/Graphics/CRainSplashGenerator.cpp +++ b/Runtime/Graphics/CRainSplashGenerator.cpp @@ -191,7 +191,7 @@ u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const std::vector maxDist && vert.second.dot(zeus::CVector3f::skUp) >= 0.f && - (vert.first.z <= 0.f || vert.first.z > minZ)) + (vert.first.z() <= 0.f || vert.first.z() > minZ)) { nextPt = idx; maxDist = distSq; diff --git a/Runtime/Graphics/CSimpleShadow.cpp b/Runtime/Graphics/CSimpleShadow.cpp index 3e74b3685..e23662f83 100644 --- a/Runtime/Graphics/CSimpleShadow.cpp +++ b/Runtime/Graphics/CSimpleShadow.cpp @@ -18,16 +18,16 @@ zeus::CAABox CSimpleShadow::GetMaxShadowBox(const zeus::CAABox& aabb) const float extent = x34_radius * x30_scale; zeus::CVector3f center = aabb.center(); zeus::CAABox expandedAABB = aabb; - expandedAABB.accumulateBounds({center.x + extent, center.y + extent, center.z - GetMaxObjectHeight()}); - expandedAABB.accumulateBounds({center.x - extent, center.y - extent, center.z - GetMaxObjectHeight()}); + expandedAABB.accumulateBounds({center.x() + extent, center.y() + extent, center.z() - GetMaxObjectHeight()}); + expandedAABB.accumulateBounds({center.x() - extent, center.y() - extent, center.z() - GetMaxObjectHeight()}); return expandedAABB; } zeus::CAABox CSimpleShadow::GetBounds() const { float extent = x34_radius * x30_scale; - return {{x0_xf.origin.x - extent, x0_xf.origin.y - extent, x0_xf.origin.z - extent}, - {x0_xf.origin.x + extent, x0_xf.origin.y + extent, x0_xf.origin.z + extent}}; + return {{x0_xf.origin.x() - extent, x0_xf.origin.y() - extent, x0_xf.origin.z() - extent}, + {x0_xf.origin.x() + extent, x0_xf.origin.y() + extent, x0_xf.origin.z() + extent}}; } void CSimpleShadow::Render(const TLockedToken& tex) const @@ -55,7 +55,7 @@ void CSimpleShadow::Render(const TLockedToken& tex) const void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform& xf, const CStateManager& mgr) { x48_24_collision = false; - float halfHeight = (aabb.max.z - aabb.min.z) * 0.5f; + float halfHeight = (aabb.max.z() - aabb.min.z()) * 0.5f; zeus::CVector3f pos = xf.origin + zeus::CVector3f(0.f, 0.f, halfHeight); CRayCastResult res = mgr.RayStaticIntersection(pos, zeus::CVector3f::skDown, x40_maxObjHeight, CMaterialFilter::MakeExclude({EMaterialTypes::SeeThrough})); @@ -88,8 +88,8 @@ void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform& x0_xf.origin = res.GetPlane().normal() * x44_displacement + res.GetPoint(); if (x48_25_alwaysCalculateRadius || !x48_26_radiusCalculated) { - float xExtent = aabb.max.x - aabb.min.x; - float yExtent = aabb.max.y - aabb.min.y; + float xExtent = aabb.max.x() - aabb.min.x(); + float yExtent = aabb.max.y() - aabb.min.y(); x34_radius = std::sqrt(xExtent * xExtent + yExtent * yExtent) * 0.5f; x48_26_radiusCalculated = true; } diff --git a/Runtime/Graphics/Shaders/CAABoxShader.cpp b/Runtime/Graphics/Shaders/CAABoxShader.cpp index bd9590f9b..2ba2f19d6 100644 --- a/Runtime/Graphics/Shaders/CAABoxShader.cpp +++ b/Runtime/Graphics/Shaders/CAABoxShader.cpp @@ -39,45 +39,45 @@ void CAABoxShader::setAABB(const zeus::CAABox& aabb) { zeus::CVector3f vboData[] = { - {aabb.max.x, aabb.max.y, aabb.min.z}, - {aabb.max.x, aabb.min.y, aabb.min.z}, - {aabb.max.x, aabb.max.y, aabb.max.z}, - {aabb.max.x, aabb.min.y, aabb.max.z}, - {aabb.max.x, aabb.min.y, aabb.max.z}, + {aabb.max.x(), aabb.max.y(), aabb.min.z()}, + {aabb.max.x(), aabb.min.y(), aabb.min.z()}, + {aabb.max.x(), aabb.max.y(), aabb.max.z()}, + {aabb.max.x(), aabb.min.y(), aabb.max.z()}, + {aabb.max.x(), aabb.min.y(), aabb.max.z()}, - {aabb.min.x, aabb.max.y, aabb.min.z}, - {aabb.min.x, aabb.max.y, aabb.min.z}, - {aabb.max.x, aabb.max.y, aabb.min.z}, - {aabb.min.x, aabb.max.y, aabb.max.z}, - {aabb.max.x, aabb.max.y, aabb.max.z}, - {aabb.max.x, aabb.max.y, aabb.max.z}, + {aabb.min.x(), aabb.max.y(), aabb.min.z()}, + {aabb.min.x(), aabb.max.y(), aabb.min.z()}, + {aabb.max.x(), aabb.max.y(), aabb.min.z()}, + {aabb.min.x(), aabb.max.y(), aabb.max.z()}, + {aabb.max.x(), aabb.max.y(), aabb.max.z()}, + {aabb.max.x(), aabb.max.y(), aabb.max.z()}, - {aabb.min.x, aabb.max.y, aabb.min.z}, - {aabb.min.x, aabb.max.y, aabb.min.z}, - {aabb.min.x, aabb.min.y, aabb.min.z}, - {aabb.min.x, aabb.max.y, aabb.max.z}, - {aabb.min.x, aabb.min.y, aabb.max.z}, - {aabb.min.x, aabb.min.y, aabb.max.z}, + {aabb.min.x(), aabb.max.y(), aabb.min.z()}, + {aabb.min.x(), aabb.max.y(), aabb.min.z()}, + {aabb.min.x(), aabb.min.y(), aabb.min.z()}, + {aabb.min.x(), aabb.max.y(), aabb.max.z()}, + {aabb.min.x(), aabb.min.y(), aabb.max.z()}, + {aabb.min.x(), aabb.min.y(), aabb.max.z()}, - {aabb.min.x, aabb.min.y, aabb.min.z}, - {aabb.min.x, aabb.min.y, aabb.min.z}, - {aabb.max.x, aabb.min.y, aabb.min.z}, - {aabb.min.x, aabb.min.y, aabb.max.z}, - {aabb.max.x, aabb.min.y, aabb.max.z}, - {aabb.max.x, aabb.min.y, aabb.max.z}, + {aabb.min.x(), aabb.min.y(), aabb.min.z()}, + {aabb.min.x(), aabb.min.y(), aabb.min.z()}, + {aabb.max.x(), aabb.min.y(), aabb.min.z()}, + {aabb.min.x(), aabb.min.y(), aabb.max.z()}, + {aabb.max.x(), aabb.min.y(), aabb.max.z()}, + {aabb.max.x(), aabb.min.y(), aabb.max.z()}, - {aabb.min.x, aabb.min.y, aabb.max.z}, - {aabb.min.x, aabb.min.y, aabb.max.z}, - {aabb.max.x, aabb.min.y, aabb.max.z}, - {aabb.min.x, aabb.max.y, aabb.max.z}, - {aabb.max.x, aabb.max.y, aabb.max.z}, - {aabb.max.x, aabb.max.y, aabb.max.z}, + {aabb.min.x(), aabb.min.y(), aabb.max.z()}, + {aabb.min.x(), aabb.min.y(), aabb.max.z()}, + {aabb.max.x(), aabb.min.y(), aabb.max.z()}, + {aabb.min.x(), aabb.max.y(), aabb.max.z()}, + {aabb.max.x(), aabb.max.y(), aabb.max.z()}, + {aabb.max.x(), aabb.max.y(), aabb.max.z()}, - {aabb.min.x, aabb.min.y, aabb.min.z}, - {aabb.min.x, aabb.min.y, aabb.min.z}, - {aabb.max.x, aabb.min.y, aabb.min.z}, - {aabb.min.x, aabb.max.y, aabb.min.z}, - {aabb.max.x, aabb.max.y, aabb.min.z}, + {aabb.min.x(), aabb.min.y(), aabb.min.z()}, + {aabb.min.x(), aabb.min.y(), aabb.min.z()}, + {aabb.max.x(), aabb.min.y(), aabb.min.z()}, + {aabb.min.x(), aabb.max.y(), aabb.min.z()}, + {aabb.max.x(), aabb.max.y(), aabb.min.z()}, }; m_vbo->load(vboData, sizeof(zeus::CVector3f) * 34); diff --git a/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp b/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp index 4cfb6c861..17d2c959f 100644 --- a/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp +++ b/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp @@ -64,10 +64,10 @@ CColoredQuadFilter::CColoredQuadFilter(EFilterType type) void CColoredQuadFilter::draw(const zeus::CColor& color, const zeus::CRectangle& rect) { - m_uniform.m_matrix[0][0] = rect.size.x * 2.f; - m_uniform.m_matrix[1][1] = rect.size.y * 2.f; - m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f; - m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f; + m_uniform.m_matrix[0][0] = rect.size.x() * 2.f; + m_uniform.m_matrix[1][1] = rect.size.y() * 2.f; + m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f; + m_uniform.m_matrix[3][1] = rect.position.y() * 2.f - 1.f; m_uniform.m_color = color; m_uniBuf->load(&m_uniform, sizeof(m_uniform)); @@ -85,7 +85,7 @@ void CWideScreenFilter::draw(const zeus::CColor& color, float t) delta /= float(g_Viewport.xc_height); zeus::CRectangle rect(0.f, 0.f, 1.f, delta); m_bottom.draw(color, rect); - rect.position.y = 1.f - delta; + rect.position.y() = 1.f - delta; m_top.draw(color, rect); } } diff --git a/Runtime/Graphics/Shaders/CEnvFxShaders.cpp b/Runtime/Graphics/Shaders/CEnvFxShaders.cpp index 688229afb..e6fa5cb86 100644 --- a/Runtime/Graphics/Shaders/CEnvFxShaders.cpp +++ b/Runtime/Graphics/Shaders/CEnvFxShaders.cpp @@ -26,7 +26,7 @@ void CEnvFxShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& c auto iBufInfo = grid.m_instBuf.getBufferInfo(); boo::ObjToken uniforms[] = {uBufInfo.first.get(), fxMgr.m_fogUniformBuf.get()}; - size_t ubufOffsets[] = {uBufInfo.second, 0}; + size_t ubufOffsets[] = {size_t(uBufInfo.second), 0}; size_t ubufSizes[] = {sizeof(CEnvFxShaders::Uniform), sizeof(CGraphics::g_Fog)}; boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment}; boo::ObjToken textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(), diff --git a/Runtime/Graphics/Shaders/CFluidPlaneShader.cpp b/Runtime/Graphics/Shaders/CFluidPlaneShader.cpp index 53056f9e6..c3bc45091 100644 --- a/Runtime/Graphics/Shaders/CFluidPlaneShader.cpp +++ b/Runtime/Graphics/Shaders/CFluidPlaneShader.cpp @@ -264,23 +264,23 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info, continue; } zeus::CVector3f localPos = ripple.GetCenter() - waterCenter; - rOut.center.x = localPos.x; - rOut.center.y = localPos.y; - rOut.center.z = ripple.GetTime() * ripple.GetOOTimeFalloff(); - rOut.center.w = ripple.GetOODistanceFalloff(); - rOut.params.x = ripple.GetAmplitude(); - rOut.params.y = ripple.GetPhase(); - rOut.params.z = (1.f - ripple.GetTime() * ripple.GetOOTimeFalloff() * - ripple.GetOOTimeFalloff()) * ripple.GetFrequency(); + rOut.center.x() = float(localPos.x()); + rOut.center.y() = float(localPos.y()); + rOut.center.z() = ripple.GetTime() * ripple.GetOOTimeFalloff(); + rOut.center.w() = ripple.GetOODistanceFalloff(); + rOut.params.x() = ripple.GetAmplitude(); + rOut.params.y() = ripple.GetPhase(); + rOut.params.z() = (1.f - ripple.GetTime() * ripple.GetOOTimeFalloff() * + ripple.GetOOTimeFalloff()) * ripple.GetFrequency(); } uni.m_colorMul = colorMul; - uni.m_pad[0].x = rippleNormResolution; + uni.m_pad[0].x() = rippleNormResolution; uni.m_lighting.ActivateLights(info.lights); for (i=0 ; i<3 ; ++i) uni.m_lighting.colorRegs[i] = info.kColors[i]; uni.m_lighting.mulColor = info.kColors[3]; uni.m_lighting.fog = CGraphics::g_Fog; - uni.m_pad2.x = info.indScale; + uni.m_pad2.x() = info.indScale; m_uniBuf->unmap(); } diff --git a/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp b/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp index abceddde7..a377f0322 100644 --- a/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp +++ b/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp @@ -35,8 +35,8 @@ void CSpaceWarpFilter::GenerateWarpRampTex(boo::IGraphicsDataFactory::Context& c vec.normalize(); vec *= zeus::CVector2f(std::sqrt(mag)); } - data[y][x][0] = zeus::clamp(0, int((((vec.x / 2.f + 0.5f) - x / float(WARP_RAMP_RES)) + 0.5f) * 255), 255); - data[y][x][1] = zeus::clamp(0, int((((vec.y / 2.f + 0.5f) - y / float(WARP_RAMP_RES)) + 0.5f) * 255), 255); + data[y][x][0] = zeus::clamp(0, int((((vec.x() / 2.f + 0.5f) - x / float(WARP_RAMP_RES)) + 0.5f) * 255), 255); + data[y][x][1] = zeus::clamp(0, int((((vec.y() / 2.f + 0.5f) - y / float(WARP_RAMP_RES)) + 0.5f) * 255), 255); } } m_warpTex = ctx.newStaticTexture(WARP_RAMP_RES+1, WARP_RAMP_RES+1, 1, @@ -132,14 +132,14 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt) /* Transform UV coordinates of rectangle within viewport and sampled scene texels (clamped to viewport bounds) */ zeus::CVector2f vp{float(CGraphics::g_CroppedViewport.xc_width), float(CGraphics::g_CroppedViewport.x10_height)}; - m_uniform.m_matrix[0][0] = clipRect.xc_width / vp.x; - m_uniform.m_matrix[1][1] = clipRect.x10_height / vp.y; - m_uniform.m_matrix[3][0] = pt.x + (1.f / vp.x); - m_uniform.m_matrix[3][1] = pt.y + (1.f / vp.y); + m_uniform.m_matrix[0][0] = clipRect.xc_width / vp.x(); + m_uniform.m_matrix[1][1] = clipRect.x10_height / vp.y(); + m_uniform.m_matrix[3][0] = pt.x() + (1.f / vp.x()); + m_uniform.m_matrix[3][1] = pt.y() + (1.f / vp.y()); if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) - m_uniform.m_matrix[3][2] = pt.z * 2.f - 1.f; + m_uniform.m_matrix[3][2] = pt.z() * 2.f - 1.f; else - m_uniform.m_matrix[3][2] = pt.z; + m_uniform.m_matrix[3][2] = pt.z(); if (clipRect.x4_left) { @@ -161,9 +161,9 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt) clipRect.x8_top = g_Viewport.xc_height - clipRect.x10_height - clipRect.x8_top; CGraphics::ResolveSpareTexture(clipRect); - m_uniform.m_strength.x = m_uniform.m_matrix[0][0] * m_strength * 0.5f * - (clipRect.x10_height / float(clipRect.xc_width)); - m_uniform.m_strength.y = m_uniform.m_matrix[1][1] * m_strength * 0.5f; + m_uniform.m_strength.x() = m_uniform.m_matrix[0][0] * m_strength * 0.5f * + (clipRect.x10_height / float(clipRect.xc_width)); + m_uniform.m_strength.y() = m_uniform.m_matrix[1][1] * m_strength * 0.5f; m_uniBuf->load(&m_uniform, sizeof(m_uniform)); CGraphics::SetShaderDataBinding(m_dataBind); diff --git a/Runtime/Graphics/Shaders/CTextSupportShader.cpp b/Runtime/Graphics/Shaders/CTextSupportShader.cpp index c078ebab8..740d23ba4 100644 --- a/Runtime/Graphics/Shaders/CTextSupportShader.cpp +++ b/Runtime/Graphics/Shaders/CTextSupportShader.cpp @@ -66,22 +66,22 @@ void CTextSupportShader::ImageInstance::SetMetrics(const CFontImageDef& imgDef, if (imgDef.x4_texs.size()) { const CTexture& tex = *imgDef.x4_texs[0].GetObj(); - imgSize.assign(tex.GetWidth() * imgDef.x14_cropFactor.x, - tex.GetHeight() * imgDef.x14_cropFactor.y); + imgSize.assign(tex.GetWidth() * imgDef.x14_cropFactor.x(), + tex.GetHeight() * imgDef.x14_cropFactor.y()); } zeus::CVector2f cropPad = imgDef.x14_cropFactor * 0.5f; m_pos[0].assign(offset.x, 0.f, offset.y); - m_uv[0].assign(0.5f - cropPad.x, 0.5f + cropPad.y); + m_uv[0].assign(0.5f - cropPad.x(), 0.5f + cropPad.y()); - m_pos[1].assign(offset.x + imgSize.x, 0.f, offset.y); - m_uv[1].assign(0.5f + cropPad.x, 0.5f + cropPad.y); + m_pos[1].assign(offset.x + imgSize.x(), 0.f, offset.y); + m_uv[1].assign(0.5f + cropPad.x(), 0.5f + cropPad.y()); - m_pos[2].assign(offset.x, 0.f, offset.y + imgSize.y); - m_uv[2].assign(0.5f - cropPad.x, 0.5f - cropPad.y); + m_pos[2].assign(offset.x, 0.f, offset.y + imgSize.y()); + m_uv[2].assign(0.5f - cropPad.x(), 0.5f - cropPad.y()); - m_pos[3].assign(offset.x + imgSize.x, 0.f, offset.y + imgSize.y); - m_uv[3].assign(0.5f + cropPad.x, 0.5f - cropPad.y); + m_pos[3].assign(offset.x + imgSize.x(), 0.f, offset.y + imgSize.y()); + m_uv[3].assign(0.5f + cropPad.x(), 0.5f - cropPad.y()); } } diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp index 92100e408..80defc734 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp @@ -231,17 +231,17 @@ void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const z if (!m_flipRect) { - m_uniform.m_matrix[0][0] = rect.size.x * 2.f; - m_uniform.m_matrix[1][1] = rect.size.y * 2.f; - m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f; - m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f; + m_uniform.m_matrix[0][0] = rect.size.x() * 2.f; + m_uniform.m_matrix[1][1] = rect.size.y() * 2.f; + m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f; + m_uniform.m_matrix[3][1] = rect.position.y() * 2.f - 1.f; } else { - m_uniform.m_matrix[0][0] = rect.size.x * 2.f; - m_uniform.m_matrix[1][1] = rect.size.y * -2.f; - m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f; - m_uniform.m_matrix[3][1] = rect.position.y * -2.f + 1.f; + m_uniform.m_matrix[0][0] = rect.size.x() * 2.f; + m_uniform.m_matrix[1][1] = rect.size.y() * -2.f; + m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f; + m_uniform.m_matrix[3][1] = rect.position.y() * -2.f + 1.f; } m_uniform.m_color = color; m_uniBuf->load(&m_uniform, sizeof(m_uniform)); diff --git a/Runtime/GuiSys/CAuiEnergyBarT01.cpp b/Runtime/GuiSys/CAuiEnergyBarT01.cpp index 45cad1e3f..49e74b47b 100644 --- a/Runtime/GuiSys/CAuiEnergyBarT01.cpp +++ b/Runtime/GuiSys/CAuiEnergyBarT01.cpp @@ -79,15 +79,15 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const float shadowT = xe0_maxEnergy > 0.f ? xfc_shadowEnergy / xe0_maxEnergy : 0.f; zeus::CColor filledColor = xd0_filledColor; - filledColor.a *= drawParms.x0_alphaMod; + filledColor.a() *= drawParms.x0_alphaMod; filledColor *= xa8_color2; zeus::CColor shadowColor = xd4_shadowColor; - shadowColor.a *= drawParms.x0_alphaMod; + shadowColor.a() *= drawParms.x0_alphaMod; shadowColor *= xa8_color2; zeus::CColor emptyColor = xcc_emptyColor; - emptyColor.a *= drawParms.x0_alphaMod; + emptyColor.a() *= drawParms.x0_alphaMod; emptyColor *= xa8_color2; for (int i=0 ; i<3 ; ++i) diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index 3b5e916b2..593b94298 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -38,12 +38,12 @@ std::shared_ptr CAuiImagePane::Create(CGuiFrame* frame, CInputStream void CAuiImagePane::Update(float dt) { - xd0_uvBias0.x = std::fmod(xd0_uvBias0.x, 1.f); - xd0_uvBias0.y = std::fmod(xd0_uvBias0.y, 1.f); + xd0_uvBias0.x() = std::fmod(xd0_uvBias0.x(), 1.f); + xd0_uvBias0.y() = std::fmod(xd0_uvBias0.y(), 1.f); if (x138_tileSize != zeus::CVector2f::skZero && xb8_tex0Tok.IsLoaded()) { zeus::CVector2f tmp = zeus::CVector2f(xb8_tex0Tok->GetWidth(), xb8_tex0Tok->GetHeight()) / x138_tileSize; - x144_frameTimer = std::fmod(x144_frameTimer + dt * x140_interval, std::floor(tmp.x) * std::floor(tmp.y)); + x144_frameTimer = std::fmod(x144_frameTimer + dt * x140_interval, std::floor(tmp.x()) * std::floor(tmp.y())); } CGuiWidget::Update(dt); @@ -62,7 +62,7 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t int frame, float alpha, bool noBlur, CTexturedQuadFilterAlpha& quad) const { zeus::CColor useColor = color; - useColor.a *= alpha; + useColor.a() *= alpha; rstl::reserved_vector vec; const rstl::reserved_vector* useUVs; @@ -71,10 +71,10 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t zeus::CVector2f res(xb8_tex0Tok->GetWidth(), xb8_tex0Tok->GetHeight()); zeus::CVector2f tmp = res / x138_tileSize; zeus::CVector2f tmpRecip = x138_tileSize / res; - float x0 = tmpRecip.x * (frame % int(tmp.x)); - float x1 = x0 + tmpRecip.x; - float y0 = tmpRecip.y * (frame % int(tmp.y)); - float y1 = y0 + tmpRecip.y; + float x0 = tmpRecip.x() * (frame % int(tmp.x())); + float x1 = x0 + tmpRecip.x(); + float y0 = tmpRecip.y() * (frame % int(tmp.y())); + float y1 = y0 + tmpRecip.y(); vec.push_back(zeus::CVector2f(x0, y0)); vec.push_back(zeus::CVector2f(x0, y1)); vec.push_back(zeus::CVector2f(x1, y0)); @@ -121,7 +121,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const const_cast(this)->m_filters.emplace(const_cast(this)->xb8_tex0Tok); Filters& filters = const_cast(*m_filters); zeus::CColor color = xa8_color2; - color.a *= params.x0_alphaMod; + color.a() *= params.x0_alphaMod; //SetZUpdate(xac_drawFlags == EGuiModelDrawFlags::Shadeless || xac_drawFlags == EGuiModelDrawFlags::Opaque); float blur0 = 1.f; float blur1 = 0.f; @@ -130,7 +130,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const if (x140_interval < 1.f && x140_interval > 0.f) { zeus::CVector2f tmp = zeus::CVector2f(xb8_tex0Tok->GetWidth(), xb8_tex0Tok->GetHeight()) / x138_tileSize; - frame1 = (frame0 + 1) % int(tmp.x * tmp.y); + frame1 = (frame0 + 1) % int(tmp.x() * tmp.y()); if (x148_fadeDuration == 0.f) blur1 = 1.f; else @@ -145,7 +145,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const { // Additive blend zeus::CColor color2 = xa8_color2; - color2.a = x150_flashFactor; + color2.a() = x150_flashFactor; DoDrawImagePane(color2, *xb8_tex0Tok, frame0, blur0, false, filters.m_flashQuad[0]); if (blur1 > 0.f) DoDrawImagePane(color2, *xb8_tex0Tok, frame1, blur1, false, filters.m_flashQuad[1]); diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index 710a4f65d..03c159b84 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -610,7 +610,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetLockConfirmColor(); - color.a *= lockBreakAlpha; + color.a() *= lockBreakAlpha; CModelFlags flags(7, 0, 0, lockBreakColor + color); x4c_lockConfirm->Draw(flags); } @@ -630,7 +630,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetTargetFlowerColor(); - color.a *= lockBreakAlpha * visorFactor; + color.a() *= lockBreakAlpha * visorFactor; CModelFlags flags(7, 0, 0, lockBreakColor + color); x58_targetFlower->Draw(flags); } @@ -657,7 +657,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetMissileBracketColor(); - color.a *= lockBreakAlpha * visorFactor; + color.a() *= lockBreakAlpha * visorFactor; CModelFlags flags(7, 0, 0, lockBreakColor + color); x64_missileBracket->Draw(flags); } @@ -679,7 +679,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetOuterBeamSquareColor(); - color.a *= lockBreakAlpha * visorFactor; + color.a() *= lockBreakAlpha * visorFactor; CModelFlags flags(7, 0, 0, lockBreakColor + color); info.x0_model->Draw(flags); } @@ -707,7 +707,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con zeus::CTransform modelXf(lockBreakXf * chargeGaugeXf, x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = gaugeColor; - color.a *= lockBreakAlpha * visorFactor; + color.a() *= lockBreakAlpha * visorFactor; CModelFlags flags(7, 0, 0, lockBreakColor + color); xc4_chargeGauge.x0_model->Draw(flags); @@ -754,7 +754,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con zeus::CTransform modelXf(lockBreakXf * rot * scale, x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = *iconColor; - color.a *= lockBreakAlpha * visorFactor; + color.a() *= lockBreakAlpha * visorFactor; CModelFlags flags(7, 0, 0, lockBreakColor + color); x70_innerBeamIcon->Draw(flags); } @@ -771,7 +771,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetLockFireColor(); - color.a *= visorFactor * lockBreakAlpha * (x210_lockFireTimer / g_tweakTargeting->GetLockFireDuration()); + color.a() *= visorFactor * lockBreakAlpha * (x210_lockFireTimer / g_tweakTargeting->GetLockFireDuration()); CModelFlags flags(7, 0, 0, lockBreakColor + color); x7c_lockFire->Draw(flags); } @@ -808,7 +808,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con x10c_currGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetLockDaggerColor(); - color.a *= visorFactor * lockBreakAlpha; + color.a() *= visorFactor * lockBreakAlpha; CModelFlags flags(7, 0, 0, lockBreakColor + color); x88_lockDagger->Draw(flags); } @@ -854,7 +854,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con x174_nextGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetSeekerColor(); - color.a *= x174_nextGroupInterp.GetFactor(); + color.a() *= x174_nextGroupInterp.GetFactor(); CModelFlags flags(7, 0, 0, color); x40_seeker->Draw(flags); } @@ -871,7 +871,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con x174_nextGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetXRayRetRingColor(); - color.a *= visorFactor; + color.a() *= visorFactor; CModelFlags flags(7, 0, 0, color); xac_xrayRetRing->Draw(flags); } @@ -887,7 +887,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con zeus::CTransform modelXf(rot * scale, x174_nextGroupInterp.GetTargetPositionWorld()); CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetThermalReticuleColor(); - color.a *= visorFactor; + color.a() *= visorFactor; CModelFlags flags(7, 0, 0, color); xb8_thermalReticle->Draw(flags); } @@ -906,7 +906,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con // compare, GX_LESS, no update float alpha = 0.5f * factor; zeus::CColor color = g_tweakGuiColors->GetScanReticuleColor(); - color.a *= alpha; + color.a() *= alpha; for (int i=0 ; i<2 ; ++i) { float lineWidth = i ? 2.5f : 1.f; @@ -948,7 +948,7 @@ void CCompoundTargetReticle::DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, cons { CGraphics::SetModelMatrix(zeus::CTransform(rot, xf4_targetPos) * zeus::CTransform::Scale(x1e8_crosshairsScale)); zeus::CColor color = g_tweakTargeting->GetCrosshairsColor(); - color.a *= x1e8_crosshairsScale; + color.a() *= x1e8_crosshairsScale; CModelFlags flags(7, 0, 0, color); x34_crosshairs->Draw(flags); } @@ -980,17 +980,17 @@ float CCompoundTargetReticle::CalculateRadiusWorld(const CActor& act, const CSta { case 0: { - radius = std::min(delta.x, std::min(delta.y, delta.z)) * 0.5f; + radius = std::min(delta.x(), std::min(delta.y(), delta.z())) * 0.5f; break; } case 1: { - radius = std::max(delta.x, std::max(delta.y, delta.z)) * 0.5f; + radius = std::max(delta.x(), std::max(delta.y(), delta.z())) * 0.5f; break; } default: { - radius = (delta.x + delta.y + delta.z) / 6.f; + radius = (delta.x() + delta.y() + delta.z()) / 6.f; break; } } @@ -1030,9 +1030,9 @@ float CCompoundTargetReticle::CalculateClampedScale(const zeus::CVector3f& pos, const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); zeus::CVector3f viewPos = cam->GetTransform().transposeRotate(pos - cam->GetTransform().origin); - viewPos = zeus::CVector3f(viewPos.x, viewPos.z, -viewPos.y); - float realX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x; - float offsetX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x; + viewPos = zeus::CVector3f(viewPos.x(), viewPos.z(), -viewPos.y()); + float realX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x(); + float offsetX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x(); float unclampedX = (offsetX - realX) * 640; return zeus::clamp(clampMin, unclampedX, clampMax) / unclampedX * scale; } diff --git a/Runtime/GuiSys/CFontImageDef.cpp b/Runtime/GuiSys/CFontImageDef.cpp index 58abe8372..02cf1b5e2 100644 --- a/Runtime/GuiSys/CFontImageDef.cpp +++ b/Runtime/GuiSys/CFontImageDef.cpp @@ -30,13 +30,13 @@ bool CFontImageDef::IsLoaded() const s32 CFontImageDef::CalculateBaseline() const { const CTexture* tex = x4_texs.front().GetObj(); - return s32(tex->GetHeight() * x14_cropFactor.y) * 2.5f / 3.f; + return s32(tex->GetHeight() * x14_cropFactor.y()) * 2.5f / 3.f; } s32 CFontImageDef::CalculateHeight() const { const CTexture* tex = x4_texs.front().GetObj(); - s32 scaledH = tex->GetHeight() * x14_cropFactor.y; + s32 scaledH = tex->GetHeight() * x14_cropFactor.y(); return scaledH - (scaledH - CalculateBaseline()); } diff --git a/Runtime/GuiSys/CGuiCamera.cpp b/Runtime/GuiSys/CGuiCamera.cpp index 32f10dc3a..5d8e28668 100644 --- a/Runtime/GuiSys/CGuiCamera.cpp +++ b/Runtime/GuiSys/CGuiCamera.cpp @@ -30,7 +30,7 @@ zeus::CVector3f CGuiCamera::ConvertToScreenSpace(const zeus::CVector3f& vec) con zeus::CMatrix4f mat = CGraphics::CalculatePerspectiveMatrix(m_proj.xbc_fov, m_proj.xc0_aspect, m_proj.xc4_znear, m_proj.xc8_zfar, false); - local = zeus::CVector3f(local.x, local.z, -local.y); + local = zeus::CVector3f(local.x(), local.z(), -local.y()); return mat.multiplyOneOverW(local); } diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp index d04ed6d9d..3fabe5f2a 100644 --- a/Runtime/GuiSys/CGuiFrame.cpp +++ b/Runtime/GuiSys/CGuiFrame.cpp @@ -48,7 +48,7 @@ void CGuiFrame::SortDrawOrder() std::sort(x2c_widgets.begin(), x2c_widgets.end(), [](const std::shared_ptr& a, const std::shared_ptr& b) -> bool { - return a->GetWorldPosition().y > b->GetWorldPosition().y; + return a->GetWorldPosition().y() > b->GetWorldPosition().y(); }); } diff --git a/Runtime/GuiSys/CGuiModel.cpp b/Runtime/GuiSys/CGuiModel.cpp index 72d84d548..0f92d0fd6 100644 --- a/Runtime/GuiSys/CGuiModel.cpp +++ b/Runtime/GuiSys/CGuiModel.cpp @@ -55,7 +55,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const if (GetIsVisible()) { zeus::CColor moduCol = xa8_color2; - moduCol.a *= parms.x0_alphaMod; + moduCol.a() *= parms.x0_alphaMod; xb0_frame->EnableLights(xcc_lightMask, const_cast(model->GetInstance())); //if (xb6_29_cullFaces) // CGraphics::SetCullMode(ERglCullMode::Front); diff --git a/Runtime/GuiSys/CGuiPane.cpp b/Runtime/GuiSys/CGuiPane.cpp index 48d8e997a..a7e7abbf5 100644 --- a/Runtime/GuiSys/CGuiPane.cpp +++ b/Runtime/GuiSys/CGuiPane.cpp @@ -39,10 +39,10 @@ void CGuiPane::InitializeBuffers() if (xc0_verts.size() < 4) xc0_verts.resize(4); - xc0_verts[0].m_pos.assign(-xb8_dim.x * 0.5f, 0.f, xb8_dim.y * 0.5f); - xc0_verts[1].m_pos.assign(-xb8_dim.x * 0.5f, 0.f, -xb8_dim.y * 0.5f); - xc0_verts[2].m_pos.assign(xb8_dim.x * 0.5f, 0.f, xb8_dim.y * 0.5f); - xc0_verts[3].m_pos.assign(xb8_dim.x * 0.5f, 0.f, -xb8_dim.y * 0.5f); + xc0_verts[0].m_pos.assign(-xb8_dim.x() * 0.5f, 0.f, xb8_dim.y() * 0.5f); + xc0_verts[1].m_pos.assign(-xb8_dim.x() * 0.5f, 0.f, -xb8_dim.y() * 0.5f); + xc0_verts[2].m_pos.assign(xb8_dim.x() * 0.5f, 0.f, xb8_dim.y() * 0.5f); + xc0_verts[3].m_pos.assign(xb8_dim.x() * 0.5f, 0.f, -xb8_dim.y() * 0.5f); } void CGuiPane::WriteData(COutputStream& out, bool flag) const diff --git a/Runtime/GuiSys/CGuiTextPane.cpp b/Runtime/GuiSys/CGuiTextPane.cpp index 6a09b8371..2ba2d9892 100644 --- a/Runtime/GuiSys/CGuiTextPane.cpp +++ b/Runtime/GuiSys/CGuiTextPane.cpp @@ -46,22 +46,22 @@ void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) const zeus::CVector2f dims = GetDimensions(); if (xd4_textSupport.x34_extentX) - dims.x /= float(xd4_textSupport.x34_extentX); + dims.x() /= float(xd4_textSupport.x34_extentX); else - dims.x = 0.f; + dims.x() = 0.f; if (xd4_textSupport.x38_extentY) - dims.y /= float(xd4_textSupport.x38_extentY); + dims.y() /= float(xd4_textSupport.x38_extentY); else - dims.y = 0.f; + dims.y() = 0.f; zeus::CTransform local = zeus::CTransform::Translate(xc0_verts.front().m_pos + xc8_scaleCenter) * - zeus::CTransform::Scale(dims.x, 1.f, dims.y); + zeus::CTransform::Scale(dims.x(), 1.f, dims.y()); CGraphics::SetModelMatrix(x34_worldXF * local); zeus::CColor geomCol = xa8_color2; - geomCol.a *= parms.x0_alphaMod; + geomCol.a() *= parms.x0_alphaMod; const_cast(this)->xd4_textSupport.SetGeometryColor(geomCol); #if 0 diff --git a/Runtime/GuiSys/CHudBossEnergyInterface.cpp b/Runtime/GuiSys/CHudBossEnergyInterface.cpp index d6a7a7c66..4919df76f 100644 --- a/Runtime/GuiSys/CHudBossEnergyInterface.cpp +++ b/Runtime/GuiSys/CHudBossEnergyInterface.cpp @@ -32,7 +32,7 @@ void CHudBossEnergyInterface::Update(float dt) if (x4_fader > 0.f) { zeus::CColor color = zeus::CColor::skWhite; - color.a = x0_alpha * x4_fader; + color.a() = x0_alpha * x4_fader; x14_basewidget_bossenergystuff->SetColor(color); x14_basewidget_bossenergystuff->SetVisibility(true, ETraversalMode::Children); } diff --git a/Runtime/GuiSys/CHudDecoInterface.cpp b/Runtime/GuiSys/CHudDecoInterface.cpp index cbf402840..f0683036f 100644 --- a/Runtime/GuiSys/CHudDecoInterface.cpp +++ b/Runtime/GuiSys/CHudDecoInterface.cpp @@ -88,14 +88,14 @@ void CHudDecoInterfaceCombat::Update(float dt, const CStateManager& stateMgr) void CHudDecoInterfaceCombat::UpdateCameraDebugSettings(float fov, float y, float z) { x6c_camera->SetFov(fov); - x2c_camPos.y = y; - x2c_camPos.z = z; + x2c_camPos.y() = y; + x2c_camPos.z() = z; } void CHudDecoInterfaceCombat::UpdateHudAlpha() { zeus::CColor color = zeus::CColor::skWhite; - color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f; + color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f; x70_basewidget_pivot->SetColor(color); } @@ -316,7 +316,7 @@ void CHudDecoInterfaceScan::UpdateScanDisplay(const CStateManager& stateMgr, flo if (x238_scanningTextAlpha > 0.f) { zeus::CColor color = zeus::CColor::skWhite; - color.a = std::min(x238_scanningTextAlpha, 1.f); + color.a() = std::min(x238_scanningTextAlpha, 1.f); x254_flat_textpane_scanning->SetColor(color); x254_flat_textpane_scanning->SetIsVisible(true); } @@ -333,7 +333,7 @@ void CHudDecoInterfaceScan::UpdateScanDisplay(const CStateManager& stateMgr, flo if (x23c_scanBarAlpha > 0.f) { zeus::CColor color = zeus::CColor::skWhite; - color.a = std::min(x23c_scanBarAlpha, 1.f); + color.a() = std::min(x23c_scanBarAlpha, 1.f); x258_flat_basewidget_scanguage->SetColor(color); x258_flat_basewidget_scanguage->SetVisibility(true, ETraversalMode::Children); } @@ -398,14 +398,14 @@ void CHudDecoInterfaceScan::ProcessInput(const CFinalInput& input) void CHudDecoInterfaceScan::UpdateCameraDebugSettings(float fov, float y, float z) { x244_camera->SetFov(fov); - x20c_camPos.y = y; - x20c_camPos.z = z; + x20c_camPos.y() = y; + x20c_camPos.z() = z; } void CHudDecoInterfaceScan::UpdateHudAlpha() { zeus::CColor color = zeus::CColor::skWhite; - color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f; + color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f; x248_basewidget_pivot->SetColor(color); } @@ -511,14 +511,14 @@ void CHudDecoInterfaceXRay::Update(float dt, const CStateManager& stateMgr) void CHudDecoInterfaceXRay::UpdateCameraDebugSettings(float fov, float y, float z) { xa0_camera->SetFov(fov); - x30_camPos.y = y; - x30_camPos.z = z; + x30_camPos.y() = y; + x30_camPos.z() = z; } void CHudDecoInterfaceXRay::UpdateHudAlpha() { zeus::CColor color = zeus::CColor::skWhite; - color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f; + color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f; xa4_basewidget_pivot->SetColor(color); } @@ -627,7 +627,7 @@ void CHudDecoInterfaceThermal::Update(float dt, const CStateManager& stateMgr) x6c_retflashTimer -= 2.f; zeus::CColor flashColor = zeus::CColor::skWhite; - flashColor.a = std::fabs(x6c_retflashTimer) * 0.5f + 0.5f; + flashColor.a() = std::fabs(x6c_retflashTimer) * 0.5f + 0.5f; x80_model_retflash->SetColor(flashColor); x74_camera->SetO2WTransform( @@ -639,14 +639,14 @@ void CHudDecoInterfaceThermal::Update(float dt, const CStateManager& stateMgr) void CHudDecoInterfaceThermal::UpdateCameraDebugSettings(float fov, float y, float z) { x74_camera->SetFov(fov); - x2c_camPos.y = y; - x2c_camPos.z = z; + x2c_camPos.y() = y; + x2c_camPos.z() = z; } void CHudDecoInterfaceThermal::UpdateHudAlpha() { zeus::CColor color = zeus::CColor::skWhite; - color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f; + color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f; x78_basewidget_pivot->SetColor(color); } diff --git a/Runtime/GuiSys/CHudEnergyInterface.cpp b/Runtime/GuiSys/CHudEnergyInterface.cpp index 551d96751..c6a64a80d 100644 --- a/Runtime/GuiSys/CHudEnergyInterface.cpp +++ b/Runtime/GuiSys/CHudEnergyInterface.cpp @@ -87,18 +87,18 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse) { x4_energyLowFader = std::min(x4_energyLowFader + 2.f * dt, 1.f); zeus::CColor color = zeus::CColor::skWhite; - color.a = x4_energyLowFader * energyLowPulse; + color.a() = x4_energyLowFader * energyLowPulse; x28_textpane_energywarning->SetColor(color); } else { x4_energyLowFader = std::max(0.f, x4_energyLowFader - 2.f * dt); zeus::CColor color = zeus::CColor::skWhite; - color.a = x4_energyLowFader * energyLowPulse; + color.a() = x4_energyLowFader * energyLowPulse; x28_textpane_energywarning->SetColor(color); } - if (x28_textpane_energywarning->GetGeometryColor().a) + if (x28_textpane_energywarning->GetGeometryColor().a()) x28_textpane_energywarning->SetIsVisible(true); else x28_textpane_energywarning->SetIsVisible(false); diff --git a/Runtime/GuiSys/CHudFreeLookInterface.cpp b/Runtime/GuiSys/CHudFreeLookInterface.cpp index 1f77d4623..2749c0c1f 100644 --- a/Runtime/GuiSys/CHudFreeLookInterface.cpp +++ b/Runtime/GuiSys/CHudFreeLookInterface.cpp @@ -82,13 +82,13 @@ void CHudFreeLookInterface::SetFreeLookState(bool inFreeLook, bool lookControlHe zeus::CColor color = zeus::CColor::skWhite; float totalInterp = x68_freeLookInterp * (1.f - x6c_lockOnInterp); - color.a = totalInterp; + color.a() = totalInterp; x74_basewidget_freelookleft->SetColor(color); x80_basewidget_freelookright->SetColor(color); if (x8c_basewidget_outlinesb) { - color.a = 0.7f * totalInterp + 0.3f; + color.a() = 0.7f * totalInterp + 0.3f; x8c_basewidget_outlinesb->SetColor(color); } @@ -160,7 +160,7 @@ void CHudFreeLookInterfaceXRay::SetFreeLookState(bool inFreeLook, bool lookContr zeus::CTransform(zeus::CMatrix3f::RotateY(-vertLookAngle), x10_freeLookRightPos)); zeus::CColor color = zeus::CColor::skWhite; - color.a = x1c_freeLookInterp; + color.a() = x1c_freeLookInterp; x24_basewidget_freelook->SetColor(color); if (x1c_freeLookInterp == 0.f) diff --git a/Runtime/GuiSys/CHudHelmetInterface.cpp b/Runtime/GuiSys/CHudHelmetInterface.cpp index c9a346cbb..f8be4eb01 100644 --- a/Runtime/GuiSys/CHudHelmetInterface.cpp +++ b/Runtime/GuiSys/CHudHelmetInterface.cpp @@ -63,7 +63,7 @@ void CHudHelmetInterface::UpdateCameraDebugSettings(float fov, float y, float z) void CHudHelmetInterface::UpdateHelmetAlpha() { zeus::CColor color = zeus::CColor::skWhite; - color.a = g_GameState->GameOptions().GetHelmetAlpha() / 255.f; + color.a() = g_GameState->GameOptions().GetHelmetAlpha() / 255.f; x44_BaseWidget_Pivot->SetColor(color); } diff --git a/Runtime/GuiSys/CHudMissileInterface.cpp b/Runtime/GuiSys/CHudMissileInterface.cpp index 40581409e..d81879628 100644 --- a/Runtime/GuiSys/CHudMissileInterface.cpp +++ b/Runtime/GuiSys/CHudMissileInterface.cpp @@ -151,7 +151,7 @@ void CHudMissileInterface::Update(float dt, const CStateManager& mgr) { xc_arrowTimer = std::max(0.f, xc_arrowTimer - dt); zeus::CColor color = g_tweakGuiColors->GetMissileIconColorActive(); - color.a *= xc_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); + color.a() *= xc_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); x6c_model_missilearrowup->SetColor(color); x70_model_missilearrowdown->SetIsVisible(false); } @@ -159,7 +159,7 @@ void CHudMissileInterface::Update(float dt, const CStateManager& mgr) { xc_arrowTimer = std::min(0.f, xc_arrowTimer + dt); zeus::CColor color = g_tweakGuiColors->GetMissileIconColorActive(); - color.a *= -xc_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); + color.a() *= -xc_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); x70_model_missilearrowdown->SetColor(color); x6c_model_missilearrowup->SetIsVisible(false); } @@ -216,9 +216,9 @@ void CHudMissileInterface::Update(float dt, const CStateManager& mgr) tmp = (0.5f - tmp) / 0.25f; zeus::CColor color = zeus::CColor::skWhite; - color.a = x40_missileWarningAlpha * tmp * warnPulse; + color.a() = x40_missileWarningAlpha * tmp * warnPulse; x68_textpane_missilewarning->SetColor(color); - if (x68_textpane_missilewarning->GetGeometryColor().a) + if (x68_textpane_missilewarning->GetGeometryColor().a()) x68_textpane_missilewarning->SetIsVisible(true); else x68_textpane_missilewarning->SetIsVisible(false); diff --git a/Runtime/GuiSys/CHudRadarInterface.cpp b/Runtime/GuiSys/CHudRadarInterface.cpp index 91d27bb78..27ac5e029 100644 --- a/Runtime/GuiSys/CHudRadarInterface.cpp +++ b/Runtime/GuiSys/CHudRadarInterface.cpp @@ -47,10 +47,10 @@ void CHudRadarInterface::DoDrawRadarPaint(float radius, const zeus::CColor& colo void CHudRadarInterface::DrawRadarPaint(const zeus::CVector3f& enemyPos, float radius, float alpha, const SRadarPaintDrawParms& parms) const { - zeus::CVector2f playerToEnemy(enemyPos.x - parms.x0_playerPos.x, - enemyPos.y - parms.x0_playerPos.y); + zeus::CVector2f playerToEnemy(enemyPos.x() - parms.x0_playerPos.x(), + enemyPos.y() - parms.x0_playerPos.y()); - float zDelta = std::fabs(enemyPos.z - parms.x0_playerPos.z); + float zDelta = std::fabs(enemyPos.z() - parms.x0_playerPos.z()); if (playerToEnemy.magnitude() <= parms.x78_xyRadius && zDelta <= parms.x7c_zRadius) { @@ -58,10 +58,10 @@ void CHudRadarInterface::DrawRadarPaint(const zeus::CVector3f& enemyPos, float r alpha *= 1.f - (zDelta - parms.x80_ZCloseRadius) / (parms.x7c_zRadius - parms.x80_ZCloseRadius); zeus::CVector2f scopeScaled = playerToEnemy * parms.x70_scopeScalar; zeus::CTransform modelMatrix = parms.x3c_postTranslate * zeus::CTransform::Translate( - parms.xc_preTranslate * zeus::CVector3f(scopeScaled.x, 0.f, scopeScaled.y)); + parms.xc_preTranslate * zeus::CVector3f(scopeScaled.x(), 0.f, scopeScaled.y())); CGraphics::SetModelMatrix(modelMatrix); zeus::CColor color = g_tweakGuiColors->GetRadarEnemyPaintColor(); - color.a *= alpha; + color.a() *= alpha; DoDrawRadarPaint(radius, color); } } @@ -79,7 +79,7 @@ void CHudRadarInterface::Update(float dt, const CStateManager& mgr) float visorTransFactor = (playerState.GetCurrentVisor() == CPlayerState::EPlayerVisor::Combat) ? playerState.GetVisorTransitionFactor() : 0.f; zeus::CColor color = g_tweakGuiColors->GetRadarStuffColor(); - color.a *= g_GameState->GameOptions().GetHUDAlpha() / 255.f * visorTransFactor; + color.a() *= g_GameState->GameOptions().GetHUDAlpha() / 255.f * visorTransFactor; x40_BaseWidget_RadarStuff->SetColor(color); bool tweakVis = g_tweakGui->GetHudVisMode() >= ITweakGui::EHudVisMode::Three; if (tweakVis != x3c_25_visibleDebug) @@ -117,7 +117,7 @@ void CHudRadarInterface::Draw(const CStateManager& mgr, float alpha) const drawParms.x70_scopeScalar = drawParms.x6c_scopeRadius / drawParms.x78_xyRadius; float camZ = zeus::CEulerAngles(zeus::CQuaternion( - mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis)).z; + mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis)).z(); zeus::CRelAngle angleZ(camZ); drawParms.xc_preTranslate = zeus::CTransform::RotateY(angleZ); drawParms.x3c_postTranslate = x40_BaseWidget_RadarStuff->GetWorldTransform(); @@ -128,15 +128,15 @@ void CHudRadarInterface::Draw(const CStateManager& mgr, float alpha) const CGraphics::SetModelMatrix(drawParms.x3c_postTranslate); zeus::CColor playerColor = g_tweakGuiColors->GetRadarPlayerPaintColor(); - playerColor.a *= alpha; + playerColor.a() *= alpha; DoDrawRadarPaint(g_tweakGui->GetRadarPlayerPaintRadius(), playerColor); - zeus::CAABox radarBounds(player.GetTranslation().x - drawParms.x78_xyRadius, - player.GetTranslation().y - drawParms.x78_xyRadius, - player.GetTranslation().z - drawParms.x7c_zRadius, - player.GetTranslation().x + drawParms.x78_xyRadius, - player.GetTranslation().y + drawParms.x78_xyRadius, - player.GetTranslation().z + drawParms.x7c_zRadius); + zeus::CAABox radarBounds(player.GetTranslation().x() - drawParms.x78_xyRadius, + player.GetTranslation().y() - drawParms.x78_xyRadius, + player.GetTranslation().z() - drawParms.x7c_zRadius, + player.GetTranslation().x() + drawParms.x78_xyRadius, + player.GetTranslation().y() + drawParms.x78_xyRadius, + player.GetTranslation().z() + drawParms.x7c_zRadius); rstl::reserved_vector nearList; mgr.BuildNearList(nearList, radarBounds, diff --git a/Runtime/GuiSys/CHudThreatInterface.cpp b/Runtime/GuiSys/CHudThreatInterface.cpp index 127b2b8d1..ffb373f98 100644 --- a/Runtime/GuiSys/CHudThreatInterface.cpp +++ b/Runtime/GuiSys/CHudThreatInterface.cpp @@ -120,7 +120,7 @@ void CHudThreatInterface::Update(float dt) x60_model_threatarrowup->SetIsVisible(true); x14_arrowTimer = std::max(0.f, x14_arrowTimer - dt); zeus::CColor color = warningColor; - color.a = x14_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); + color.a() = x14_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); x60_model_threatarrowup->SetColor(color); x64_model_threatarrowdown->SetIsVisible(false); } @@ -129,7 +129,7 @@ void CHudThreatInterface::Update(float dt) x64_model_threatarrowdown->SetIsVisible(true); x14_arrowTimer = std::min(0.f, x14_arrowTimer + dt); zeus::CColor color = warningColor; - color.a = -x14_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); + color.a() = -x14_arrowTimer / g_tweakGui->GetMissileArrowVisTime(); x64_model_threatarrowdown->SetColor(color); x60_model_threatarrowup->SetIsVisible(false); } @@ -221,17 +221,17 @@ void CHudThreatInterface::Update(float dt) { x48_warningLerpAlpha = std::min(x48_warningLerpAlpha + 2.f * dt, 1.f); zeus::CColor color = zeus::CColor::skWhite; - color.a = x48_warningLerpAlpha * xc_damagePulse; + color.a() = x48_warningLerpAlpha * xc_damagePulse; x68_textpane_threatwarning->SetColor(color); } else { x48_warningLerpAlpha = std::max(0.f, x48_warningLerpAlpha - 2.f * dt); zeus::CColor color = zeus::CColor::skWhite; - color.a = x48_warningLerpAlpha * xc_damagePulse; + color.a() = x48_warningLerpAlpha * xc_damagePulse; x68_textpane_threatwarning->SetColor(color); } - if (x68_textpane_threatwarning->GetGeometryColor().a > 0.f) + if (x68_textpane_threatwarning->GetGeometryColor().a() > 0.f) x68_textpane_threatwarning->SetIsVisible(true); else x68_textpane_threatwarning->SetIsVisible(false); diff --git a/Runtime/GuiSys/CHudVisorBeamMenu.cpp b/Runtime/GuiSys/CHudVisorBeamMenu.cpp index 1599383c8..7bdecb063 100644 --- a/Runtime/GuiSys/CHudVisorBeamMenu.cpp +++ b/Runtime/GuiSys/CHudVisorBeamMenu.cpp @@ -96,7 +96,7 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type, } zeus::CColor titleColor = zeus::CColor::skWhite; - titleColor.a = 0.f; + titleColor.a() = 0.f; x1c_basewidget_menutitle->SetColor(titleColor); x20_textpane_menu->TextSupport().SetText(g_MainStringTable->GetString(MenuStringIdx[int(x4_type)][x8_selectedItem])); @@ -215,7 +215,7 @@ void CHudVisorBeamMenu::Update(float dt, bool init) case EAnimPhase::SelectFlash: { zeus::CColor color = zeus::CColor::skWhite; - color.a = 0.f; + color.a() = 0.f; x1c_basewidget_menutitle->SetColor(color); zeus::CColor& color0 = std::fmod(x10_interp, 0.1f) > 0.05f ? activeColor : inactiveColor; @@ -254,7 +254,7 @@ void CHudVisorBeamMenu::Update(float dt, bool init) { x78_textFader = std::max(0.f, x78_textFader - dt); zeus::CColor color = zeus::CColor::skWhite; - color.a = x78_textFader / x7c_animDur; + color.a() = x78_textFader / x7c_animDur; x1c_basewidget_menutitle->SetColor(color); } @@ -273,19 +273,19 @@ void CHudVisorBeamMenu::Update(float dt, bool init) return; x1c_basewidget_menutitle->SetVisibility - (x1c_basewidget_menutitle->GetGeometryColor().a != 0.f, ETraversalMode::Children); + (x1c_basewidget_menutitle->GetGeometryColor().a() != 0.f, ETraversalMode::Children); for (int i=0 ; i<4 ; ++i) { SMenuItem& item = x28_menuItems[i]; - item.x4_model_icon->SetIsVisible(item.x4_model_icon->GetGeometryColor().a != 0.f); + item.x4_model_icon->SetIsVisible(item.x4_model_icon->GetGeometryColor().a() != 0.f); } } void CHudVisorBeamMenu::UpdateHudAlpha(float alpha) { zeus::CColor color = zeus::CColor::skWhite; - color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f * alpha; + color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f * alpha; x18_basewidget_menu->SetColor(color); } diff --git a/Runtime/GuiSys/CInstruction.cpp b/Runtime/GuiSys/CInstruction.cpp index a76e3e3bd..175ea518c 100644 --- a/Runtime/GuiSys/CInstruction.cpp +++ b/Runtime/GuiSys/CInstruction.cpp @@ -252,11 +252,11 @@ void CImageInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf) zeus::CVector2i coords(state.xd4_curX, y); buf->AddImage(coords, x4_image); } - state.xd4_curX = state.xd4_curX + tex->GetWidth() * x4_image.x14_cropFactor.x; + state.xd4_curX = state.xd4_curX + tex->GetWidth() * x4_image.x14_cropFactor.x(); } else { - int scale = state.xdc_currentLineInst->x8_curX - tex->GetWidth() * x4_image.x14_cropFactor.x; + int scale = state.xdc_currentLineInst->x8_curX - tex->GetWidth() * x4_image.x14_cropFactor.x(); if (buf) { zeus::CVector2i coords(scale / 2 + state.xd4_curX, state.xd8_curY); diff --git a/Runtime/GuiSys/COrbitPointMarker.cpp b/Runtime/GuiSys/COrbitPointMarker.cpp index 441f07f83..91d4bc993 100644 --- a/Runtime/GuiSys/COrbitPointMarker.cpp +++ b/Runtime/GuiSys/COrbitPointMarker.cpp @@ -37,10 +37,10 @@ void COrbitPointMarker::Update(float dt, const CStateManager& mgr) if (!x4_camRelZPos) x10_lagTargetPos = orbitTargetPosition + zeus::CVector3f(0.f, 0.f, x0_zOffset); else - x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x, orbitTargetPosition.y, - curCam->GetTranslation().z + x0_zOffset); + x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x(), orbitTargetPosition.y(), + curCam->GetTranslation().z() + x0_zOffset); x8_lagAzimuth = - zeus::CEulerAngles(zeus::CQuaternion(curCam->GetTransform().basis)).z + zeus::degToRad(45.f); + zeus::CEulerAngles(zeus::CQuaternion(curCam->GetTransform().basis)).z() + zeus::degToRad(45.f); } else { @@ -55,23 +55,23 @@ void COrbitPointMarker::Update(float dt, const CStateManager& mgr) if (!x4_camRelZPos) { zeus::CVector3f orbitTargetPosition = mgr.GetPlayer().GetHUDOrbitTargetPosition(); - if ((orbitTargetPosition.z + x0_zOffset) - x10_lagTargetPos.z < 0.1f) + if ((orbitTargetPosition.z() + x0_zOffset) - x10_lagTargetPos.z() < 0.1f) x10_lagTargetPos = orbitTargetPosition + zeus::CVector3f(0.f, 0.f, x0_zOffset); - else if ((orbitTargetPosition.z + x0_zOffset) - x10_lagTargetPos.z < 0.f) - x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x, orbitTargetPosition.y, x10_lagTargetPos.z - 0.1f); + else if ((orbitTargetPosition.z() + x0_zOffset) - x10_lagTargetPos.z() < 0.f) + x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x(), orbitTargetPosition.y(), x10_lagTargetPos.z() - 0.1f); else - x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x, orbitTargetPosition.y, x10_lagTargetPos.z + 0.1f); + x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x(), orbitTargetPosition.y(), x10_lagTargetPos.z() + 0.1f); } else { zeus::CVector3f orbitTargetPosition = mgr.GetPlayer().GetHUDOrbitTargetPosition(); - x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x, orbitTargetPosition.y, - x0_zOffset + orbitTargetPosition.z); + x10_lagTargetPos = zeus::CVector3f(orbitTargetPosition.x(), orbitTargetPosition.y(), + x0_zOffset + orbitTargetPosition.z()); } if (x1c_lastFreeOrbit) { - float newAzimuth = zeus::CEulerAngles(zeus::CQuaternion(curCam->GetTransform().basis)).z + zeus::degToRad(45.f); + float newAzimuth = zeus::CEulerAngles(zeus::CQuaternion(curCam->GetTransform().basis)).z() + zeus::degToRad(45.f); float aziDelta = newAzimuth - xc_azimuth; if (mgr.GetPlayer().IsInFreeLook()) x8_lagAzimuth += aziDelta; @@ -103,7 +103,7 @@ void COrbitPointMarker::Draw(const CStateManager& mgr) const modelXf.origin += x10_lagTargetPos; CGraphics::SetModelMatrix(modelXf); zeus::CColor color = g_tweakTargeting->GetOrbitPointColor(); - color.a *= scale; + color.a() *= scale; CModelFlags flags(7, 0, 0, color); x28_orbitPointModel->Draw(flags); } diff --git a/Runtime/GuiSys/CScanDisplay.cpp b/Runtime/GuiSys/CScanDisplay.cpp index 734bfd085..2890159cf 100644 --- a/Runtime/GuiSys/CScanDisplay.cpp +++ b/Runtime/GuiSys/CScanDisplay.cpp @@ -46,10 +46,10 @@ void CScanDisplay::CDataDot::Draw(const zeus::CColor& col, float radius) const if (x0_dotState != EDotState::Hidden) { - zeus::CTransform xf = zeus::CTransform::Translate(xc_curPos.x, 0.f, xc_curPos.y); + zeus::CTransform xf = zeus::CTransform::Translate(xc_curPos.x(), 0.f, xc_curPos.y()); CGraphics::SetModelMatrix(xf); zeus::CColor useColor = col; - useColor.a *= x24_alpha; + useColor.a() *= x24_alpha; CTexturedQuadFilter::Vert verts[4] = { {{-radius, 0.f, radius}, {0.f, 1.f}}, @@ -215,7 +215,7 @@ void CScanDisplay::StartScan(TUniqueId id, const CScannableObjectInfo& scanInfo, CAuiImagePane* pane = static_cast( xa0_selHud.FindWidget(MP1::CPauseScreenBase::GetImagePaneName(i))); zeus::CColor color = g_tweakGuiColors->GetScanDisplayImagePaneColor(); - color.a = 0.f; + color.a() = 0.f; pane->SetColor(color); pane->SetTextureID0(-1, g_SimplePool); pane->SetAnimationParms(zeus::CVector2f::skZero, 0.f, 0.f); @@ -384,7 +384,7 @@ void CScanDisplay::Update(float dt, float scanningTime) } float alphaMul = ((xc_state == EScanState::Downloading) ? GetDownloadFraction(i, scanningTime) : 1.f) * x1a8_bodyAlpha; zeus::CColor color = g_tweakGuiColors->GetScanDisplayImagePaneColor(); - color.a *= alphaMul; + color.a() *= alphaMul; x170_paneStates[i].second->SetColor(color); x170_paneStates[i].second->SetDeResFactor(1.f - alphaMul); if (GetDownloadStartTime(i) - g_tweakGui->GetScanAppearanceDuration() < scanningTime) @@ -431,8 +431,8 @@ void CScanDisplay::Update(float dt, float scanningTime) float posRand = g_tweakGui->GetScanDataDotPosRandMagnitude() * vpRatio; float durMin = dot.GetDotState() == CDataDot::EDotState::Hold ? g_tweakGui->GetScanDataDotHoldDurationMin() : g_tweakGui->GetScanDataDotSeekDurationMin(); float durMax = dot.GetDotState() == CDataDot::EDotState::Hold ? g_tweakGui->GetScanDataDotHoldDurationMax() : g_tweakGui->GetScanDataDotSeekDurationMax(); - zeus::CVector2f vec(dot.GetDotState() == CDataDot::EDotState::Hold ? dot.GetCurrPosition().x : (posRand * (rand() / float(RAND_MAX)) - 0.5f * posRand), - dot.GetDotState() == CDataDot::EDotState::Hold ? dot.GetCurrPosition().y : (posRand * (rand() / float(RAND_MAX)) - 0.5f * posRand)); + zeus::CVector2f vec(dot.GetDotState() == CDataDot::EDotState::Hold ? dot.GetCurrPosition().x() : (posRand * (rand() / float(RAND_MAX)) - 0.5f * posRand), + dot.GetDotState() == CDataDot::EDotState::Hold ? dot.GetCurrPosition().y() : (posRand * (rand() / float(RAND_MAX)) - 0.5f * posRand)); float dur = (durMax - durMin) * (rand() / float(RAND_MAX)) + durMin; dot.StartTransitionTo(vec, dur); dot.SetDotState(dot.GetDotState() == CDataDot::EDotState::Hold ? CDataDot::EDotState::Seek : CDataDot::EDotState::Hold); @@ -444,8 +444,8 @@ void CScanDisplay::Update(float dt, float scanningTime) { const zeus::CVector3f& panePos = x170_paneStates[i].second->GetWorldPosition(); zeus::CVector3f screenPos = xa0_selHud.GetFrameCamera()->ConvertToScreenSpace(panePos); - zeus::CVector2f viewportCoords(screenPos.x * g_Viewport.x8_width * 0.5f, - screenPos.y * g_Viewport.xc_height * 0.5f); + zeus::CVector2f viewportCoords(screenPos.x() * g_Viewport.x8_width * 0.5f, + screenPos.y() * g_Viewport.xc_height * 0.5f); dot.SetDestPosition(viewportCoords); break; } diff --git a/Runtime/GuiSys/CSplashScreen.cpp b/Runtime/GuiSys/CSplashScreen.cpp index ff224c9fa..27c50987e 100644 --- a/Runtime/GuiSys/CSplashScreen.cpp +++ b/Runtime/GuiSys/CSplashScreen.cpp @@ -68,16 +68,16 @@ void CSplashScreen::Draw() const color = zeus::CColor{0.86f, 0.f, 0.f, 1.f}; if (x18_splashTimeout > 1.5f) - color.a = 1.f - (x18_splashTimeout - 1.5f) * 2.f; + color.a() = 1.f - (x18_splashTimeout - 1.5f) * 2.f; else if (x18_splashTimeout < 0.5f) - color.a = x18_splashTimeout * 2.f; + color.a() = x18_splashTimeout * 2.f; zeus::CRectangle rect; float aspect = g_Viewport.x8_width / float(g_Viewport.xc_height); - rect.size.x = m_quad.GetTex()->GetWidth() / (480.f * aspect); - rect.size.y = m_quad.GetTex()->GetHeight() / 480.f; - rect.position.x = 0.5f - rect.size.x / 2.f; - rect.position.y = 0.5f - rect.size.y / 2.f; + rect.size.x() = m_quad.GetTex()->GetWidth() / (480.f * aspect); + rect.size.y() = m_quad.GetTex()->GetHeight() / 480.f; + rect.position.x() = 0.5f - rect.size.x() / 2.f; + rect.position.y() = 0.5f - rect.size.y() / 2.f; const_cast(m_quad).draw(color, 1.f, rect); } diff --git a/Runtime/GuiSys/CTextExecuteBuffer.cpp b/Runtime/GuiSys/CTextExecuteBuffer.cpp index cf96b3fe0..eb3a0466f 100644 --- a/Runtime/GuiSys/CTextExecuteBuffer.cpp +++ b/Runtime/GuiSys/CTextExecuteBuffer.cpp @@ -391,8 +391,8 @@ void CTextExecuteBuffer::AddImage(const CFontImageDef& image) if (xa0_curBlock) { const CTexture* tex = image.x4_texs[0].GetObj(); - int width = tex->GetWidth() * image.x14_cropFactor.x; - int height = tex->GetHeight() * image.x14_cropFactor.y; + int width = tex->GetWidth() * image.x14_cropFactor.x(); + int height = tex->GetHeight() * image.x14_cropFactor.y(); if (x18_textState.x7c_enableWordWrap && xa4_curLine->x8_curX + width > xa0_curBlock->xc_blockExtentX && xa4_curLine->x4_wordCount > 1) diff --git a/Runtime/GuiSys/CTextRenderBuffer.cpp b/Runtime/GuiSys/CTextRenderBuffer.cpp index 5ceaff363..1dc2349af 100644 --- a/Runtime/GuiSys/CTextRenderBuffer.cpp +++ b/Runtime/GuiSys/CTextRenderBuffer.cpp @@ -29,14 +29,14 @@ void CTextRenderBuffer::BooPrimitiveMark::SetOpacity(CTextRenderBuffer& rb, floa { BooFontCharacters& fc = rb.m_fontCharacters[m_bindIdx]; CTextSupportShader::CharacterInstance& inst = fc.m_charData[m_instIdx]; - inst.m_mulColor.a = opacity; + inst.m_mulColor.a() = opacity; fc.m_dirty = true; break; } case Command::ImageRender: { BooImage& img = rb.m_images[m_bindIdx]; - img.m_imageData.m_color.a = opacity; + img.m_imageData.m_color.a() = opacity; img.m_dirty = true; break; } @@ -159,8 +159,8 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const CTextSupportShader::Uniform{mat, col}; if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw) { - zeus::CColor colPremul = col * col.a; - colPremul.a = col.a; + zeus::CColor colPremul = col * col.a(); + colPremul.a() = col.a(); const_cast(this)->m_uniBuf2.access() = CTextSupportShader::Uniform{mat, colPremul}; } @@ -277,19 +277,19 @@ std::pair CTextRenderBuffer::AccumulateTextBou { for (const CTextSupportShader::CharacterInstance& charInst : chars.m_charData) { - ret.first.x = std::min(ret.first.x, int(charInst.m_pos[0].x)); - ret.first.y = std::min(ret.first.y, int(charInst.m_pos[0].z)); - ret.second.x = std::max(ret.second.x, int(charInst.m_pos[3].x)); - ret.second.y = std::max(ret.second.y, int(charInst.m_pos[3].z)); + ret.first.x = std::min(ret.first.x, int(charInst.m_pos[0].x())); + ret.first.y = std::min(ret.first.y, int(charInst.m_pos[0].z())); + ret.second.x = std::max(ret.second.x, int(charInst.m_pos[3].x())); + ret.second.y = std::max(ret.second.y, int(charInst.m_pos[3].z())); } } for (const BooImage& imgs : m_images) { - ret.first.x = std::min(ret.first.x, int(imgs.m_imageData.m_pos[0].x)); - ret.first.y = std::min(ret.first.y, int(imgs.m_imageData.m_pos[0].z)); - ret.second.x = std::max(ret.second.x, int(imgs.m_imageData.m_pos[3].x)); - ret.second.y = std::max(ret.second.y, int(imgs.m_imageData.m_pos[3].z)); + ret.first.x = std::min(ret.first.x, int(imgs.m_imageData.m_pos[0].x())); + ret.first.y = std::min(ret.first.y, int(imgs.m_imageData.m_pos[0].z())); + ret.second.x = std::max(ret.second.x, int(imgs.m_imageData.m_pos[3].x())); + ret.second.y = std::max(ret.second.y, int(imgs.m_imageData.m_pos[3].z())); } return ret; diff --git a/Runtime/MP1/CArtifactDoll.cpp b/Runtime/MP1/CArtifactDoll.cpp index 860ff81c3..297e31124 100644 --- a/Runtime/MP1/CArtifactDoll.cpp +++ b/Runtime/MP1/CArtifactDoll.cpp @@ -130,7 +130,7 @@ void CArtifactDoll::Draw(float alpha, const CStateManager& mgr, { float interp = (std::sin(CGraphics::GetSecondsMod900() * 2.f * M_PIF) + 1.f) * 0.5f; color = zeus::CColor::lerp(zeus::CColor::skWhite, color, interp); - color.a *= zeus::clamp(0.f, 1.25f - interp, 1.f); + color.a() *= zeus::clamp(0.f, 1.25f - interp, 1.f); } CModelFlags flags(7, 0, 3, zeus::CColor(1.f, 0.f)); @@ -139,7 +139,7 @@ void CArtifactDoll::Draw(float alpha, const CStateManager& mgr, model->Draw(flags); flags.x4_color = color; - flags.x4_color.a *= alpha; + flags.x4_color.a() *= alpha; flags.m_extendedShader = EExtendedShader::ForcedAdditive; model->Draw(flags); } diff --git a/Runtime/MP1/CFaceplateDecoration.cpp b/Runtime/MP1/CFaceplateDecoration.cpp index e3f49e9c1..d1944a488 100644 --- a/Runtime/MP1/CFaceplateDecoration.cpp +++ b/Runtime/MP1/CFaceplateDecoration.cpp @@ -43,7 +43,7 @@ void CFaceplateDecoration::Draw(CStateManager& stateMgr) if (xc_ready && m_texFilter) { zeus::CColor color = zeus::CColor::skWhite; - color.a = stateMgr.GetPlayer().GetVisorSteam().GetAlpha(); + color.a() = stateMgr.GetPlayer().GetVisorSteam().GetAlpha(); m_texFilter->draw(color, 1.f); } } diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 12d562e94..d57019600 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -124,7 +124,7 @@ void CFrontEndUI::SNewFileSelectFrame::FinishedLoading() x64_fileSelections[i] = FindFileSelectOption(x1c_loadedFrame, i); x104_rowPitch = (x64_fileSelections[1].x0_base->GetLocalPosition() - - x64_fileSelections[0].x0_base->GetLocalPosition()).z; + x64_fileSelections[0].x0_base->GetLocalPosition()).z(); } bool CFrontEndUI::SNewFileSelectFrame::PumpLoad() @@ -432,7 +432,7 @@ void CFrontEndUI::SNewFileSelectFrame::ActivateErase() x8_subMenu = ESubMenu::EraseGame; x28_textpane_erase.x0_panes[0]->SetIsSelectable(false); zeus::CColor color = zeus::CColor::skGrey; - color.a = 0.5f; + color.a() = 0.5f; x28_textpane_erase.x0_panes[0]->TextSupport().SetFontColor(color); x38_textpane_gba.x0_panes[0]->TextSupport().SetFontColor(color); x30_textpane_cheats.x0_panes[0]->TextSupport().SetFontColor(color); @@ -489,7 +489,7 @@ void CFrontEndUI::SNewFileSelectFrame::ClearFrameContents() { x28_textpane_erase.x0_panes[0]->SetIsSelectable(false); zeus::CColor color = zeus::CColor::skGrey; - color.a = 0.5f; + color.a() = 0.5f; x28_textpane_erase.x0_panes[0]->TextSupport().SetFontColor(color); } @@ -504,7 +504,7 @@ void CFrontEndUI::SNewFileSelectFrame::ClearFrameContents() { cheats->SetIsSelectable(false); zeus::CColor color = zeus::CColor::skGrey; - color.a = 0.5f; + color.a() = 0.5f; x30_textpane_cheats.x0_panes[0]->TextSupport().SetFontColor(color); } @@ -1322,7 +1322,7 @@ void CFrontEndUI::SFrontEndFrame::Update(float dt) { imageGallery->SetIsSelectable(false); zeus::CColor color = zeus::CColor::skGrey; - color.a = 0.5f; + color.a() = 0.5f; x24_cheatPair.x0_panes[0]->TextSupport().SetFontColor(color); } @@ -1487,7 +1487,7 @@ bool CFrontEndUI::SNesEmulatorFrame::Update(float dt, CSaveGameScreen* saveUi) x10_remTime = std::max(x10_remTime - dt, 0.f); zeus::CColor geomCol(zeus::CColor::skWhite); - geomCol.a = std::min(x10_remTime, 1.f); + geomCol.a() = std::min(x10_remTime, 1.f); xc_textSupport->SetGeometryColor(geomCol); if (xc_textSupport->GetIsTextSupportFinishedLoading()) { @@ -1775,8 +1775,8 @@ void CFrontEndUI::SOptionsFrontEndFrame::FinishedLoading() x24_tablegroup_leftmenu->SetMenuSelectionChangeCallback( std::bind(&SOptionsFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1, std::placeholders::_2)); - x38_rowPitch = x24_tablegroup_leftmenu->GetWorkerWidget(1)->GetIdlePosition().z - - x24_tablegroup_leftmenu->GetWorkerWidget(0)->GetIdlePosition().z; + x38_rowPitch = x24_tablegroup_leftmenu->GetWorkerWidget(1)->GetIdlePosition().z() - + x24_tablegroup_leftmenu->GetWorkerWidget(0)->GetIdlePosition().z(); x28_tablegroup_rightmenu->SetMenuSelectionChangeCallback( std::bind(&SOptionsFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1, std::placeholders::_2)); @@ -2237,7 +2237,7 @@ void CFrontEndUI::Draw() const x38_pressStart->GetWidth() / 640.f * hPad, x38_pressStart->GetHeight() / 480.f * vPad); zeus::CColor color = zeus::CColor::skWhite; - color.a = x64_pressStartAlpha; + color.a() = x64_pressStartAlpha; const_cast(*m_pressStartQuad).draw(color, 1.f, rect); } @@ -2249,7 +2249,7 @@ void CFrontEndUI::Draw() const { /* To black */ zeus::CColor color = zeus::CColor::skBlack; - color.a = 1.f - x58_fadeBlackTimer; + color.a() = 1.f - x58_fadeBlackTimer; const_cast(m_fadeToBlack).draw(color); } } @@ -2261,14 +2261,14 @@ void CFrontEndUI::Draw() const { /* To black */ zeus::CColor color = zeus::CColor::skBlack; - color.a = zeus::clamp(0.f, 1.f - x58_fadeBlackTimer, 1.f); + color.a() = zeus::clamp(0.f, 1.f - x58_fadeBlackTimer, 1.f); const_cast(m_fadeToBlack).draw(color); } else if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::Title) { /* From black with 30-sec skip to title */ zeus::CColor color = zeus::CColor::skBlack; - color.a = 1.f - zeus::clamp(0.f, 30.f - x58_fadeBlackTimer, 1.f); + color.a() = 1.f - zeus::clamp(0.f, 30.f - x58_fadeBlackTimer, 1.f); const_cast(m_fadeToBlack).draw(color); } } diff --git a/Runtime/MP1/CInGameGuiManager.cpp b/Runtime/MP1/CInGameGuiManager.cpp index 33e250ea1..01ab0c8e5 100644 --- a/Runtime/MP1/CInGameGuiManager.cpp +++ b/Runtime/MP1/CInGameGuiManager.cpp @@ -495,8 +495,8 @@ void CInGameGuiManager::Update(CStateManager& stateMgr, float dt, CArchitectureQ else { stateMgr.SetViewportScale(zeus::CVector2f( - std::min(x30_playerVisor->GetDesiredViewportScaleX(stateMgr), x34_samusHud->GetViewportScale().x), - std::min(x30_playerVisor->GetDesiredViewportScaleY(stateMgr), x34_samusHud->GetViewportScale().y))); + std::min(x30_playerVisor->GetDesiredViewportScaleX(stateMgr), x34_samusHud->GetViewportScale().x()), + std::min(x30_playerVisor->GetDesiredViewportScaleY(stateMgr), x34_samusHud->GetViewportScale().y()))); } x1f8_25_playerAlive = stateMgr.GetPlayerState()->IsPlayerAlive(); diff --git a/Runtime/MP1/CInventoryScreen.cpp b/Runtime/MP1/CInventoryScreen.cpp index b92763bc2..8b66a762d 100644 --- a/Runtime/MP1/CInventoryScreen.cpp +++ b/Runtime/MP1/CInventoryScreen.cpp @@ -475,7 +475,7 @@ void CInventoryScreen::UpdateRightTable() x84_tablegroup_rightlog->GetWorkerWidget(0)->SetIsSelectable(false); x84_tablegroup_rightlog->GetWorkerWidget(x84_tablegroup_rightlog->GetElementCount() - 1)->SetIsSelectable(false); zeus::CColor inactiveColor = g_tweakGuiColors->GetPauseItemAmberColor(); - inactiveColor.a = 0.5f; + inactiveColor.a() = 0.5f; UpdateRightLogColors(false, g_tweakGuiColors->GetPauseItemAmberColor(), inactiveColor); } diff --git a/Runtime/MP1/CMessageScreen.cpp b/Runtime/MP1/CMessageScreen.cpp index 651bbb8cb..defebc938 100644 --- a/Runtime/MP1/CMessageScreen.cpp +++ b/Runtime/MP1/CMessageScreen.cpp @@ -110,7 +110,7 @@ bool CMessageScreen::Update(float dt, float blurAmt) float alpha = std::max(0.f, (x70_blurAmt - 0.7f) / 0.3f); zeus::CColor color = g_tweakGuiColors->GetHudFrameColor(); - color.a *= alpha; + color.a() *= alpha; x20_basewidget_top->SetColor(color); x28_basewidget_bottom->SetColor(zeus::CColor(1.f, alpha)); diff --git a/Runtime/MP1/COptionsScreen.cpp b/Runtime/MP1/COptionsScreen.cpp index 522841288..e1ecc582a 100644 --- a/Runtime/MP1/COptionsScreen.cpp +++ b/Runtime/MP1/COptionsScreen.cpp @@ -135,7 +135,7 @@ void COptionsScreen::Update(float dt, CRandom16& rand, CArchitectureQueue& archQ } zeus::CColor color = g_tweakGuiColors->GetPauseItemAmberColor(); - color.a = x29c_optionAlpha; + color.a() = x29c_optionAlpha; x18c_slidergroup_slider->SetColor(color); x190_tablegroup_double->SetColor(color); x194_tablegroup_triple->SetColor(color); diff --git a/Runtime/MP1/CPauseScreen.cpp b/Runtime/MP1/CPauseScreen.cpp index 615286368..ed2e8e1e6 100644 --- a/Runtime/MP1/CPauseScreen.cpp +++ b/Runtime/MP1/CPauseScreen.cpp @@ -72,7 +72,7 @@ void CPauseScreen::InitializeFrameGlue() if (CGuiWidget* deco = x34_loadedPauseScreenInstructions->FindWidget("basewidget_deco")) { zeus::CColor color = g_tweakGuiColors->GetPauseItemAmberColor(); - color.a *= 0.75f; + color.a() *= 0.75f; deco->SetColor(color); } } @@ -257,7 +257,7 @@ void CPauseScreen::Update(float dt, const CStateManager& mgr, CRandom16& rand, C { curScreen->Update(dt, rand, archQueue); zeus::CColor color = zeus::CColor::skWhite; - color.a = std::min(curScreen->GetAlpha(), x8_curSubscreen != xc_nextSubscreen ? x10_alphaInterp / 0.5f : 1.f); + color.a() = std::min(curScreen->GetAlpha(), x8_curSubscreen != xc_nextSubscreen ? x10_alphaInterp / 0.5f : 1.f); x40_textpane_a->SetColor(color); x44_textpane_b->SetColor(color); } diff --git a/Runtime/MP1/CPauseScreenBase.cpp b/Runtime/MP1/CPauseScreenBase.cpp index f8849bb12..c0bff1eb4 100644 --- a/Runtime/MP1/CPauseScreenBase.cpp +++ b/Runtime/MP1/CPauseScreenBase.cpp @@ -68,7 +68,7 @@ void CPauseScreenBase::InitializeFrameGlue() x194_tablegroup_triple = static_cast(x8_frame.FindWidget("tablegroup_triple")); x2c_rightTableStart = x84_tablegroup_rightlog->GetWorkerWidget(0)->GetIdlePosition(); - x38_highlightPitch = x84_tablegroup_rightlog->GetWorkerWidget(1)->GetIdlePosition().z - x2c_rightTableStart.z; + x38_highlightPitch = x84_tablegroup_rightlog->GetWorkerWidget(1)->GetIdlePosition().z() - x2c_rightTableStart.z(); x3c_sliderStart = x18c_slidergroup_slider->GetIdlePosition(); x48_tableDoubleStart = x190_tablegroup_double->GetIdlePosition(); x54_tableTripleStart = x194_tablegroup_triple->GetIdlePosition(); @@ -107,7 +107,7 @@ void CPauseScreenBase::InitializeFrameGlue() if (IsRightLogDynamic()) { zeus::CColor color = g_tweakGuiColors->GetPauseItemAmberColor(); - color.a = 0.5f; + color.a() = 0.5f; UpdateRightLogColors(false, g_tweakGuiColors->GetPauseItemAmberColor(), color); } else @@ -119,7 +119,7 @@ void CPauseScreenBase::InitializeFrameGlue() static_cast(obj)->SetColor(g_tweakGuiColors->GetPauseItemAmberColor()); zeus::CColor dimColor = g_tweakGuiColors->GetPauseItemAmberColor(); - dimColor.a = 0.2f; + dimColor.a() = 0.2f; x98_model_scrollleftup->SetColor(dimColor); x9c_model_scrollleftdown->SetColor(dimColor); xa0_model_scrollrightup->SetColor(dimColor); @@ -182,7 +182,7 @@ void CPauseScreenBase::ChangeMode(EMode mode) EMode oldMode = x10_mode; zeus::CColor color = g_tweakGuiColors->GetPauseItemAmberColor(); zeus::CColor colorDim = color; - colorDim.a = 0.5f; + colorDim.a() = 0.5f; switch (x10_mode) { @@ -296,7 +296,7 @@ void CPauseScreenBase::Update(float dt, CRandom16& rand, CArchitectureQueue& arc float rightDownT = pulseRightDown ? CGraphics::GetSecondsMod900() : 0.f; zeus::CColor lowC = g_tweakGuiColors->GetPauseItemAmberColor(); - lowC.a = 0.2f; + lowC.a() = 0.2f; xa0_model_scrollrightup->SetColor( zeus::CColor::lerp(lowC, g_tweakGuiColors->GetPauseItemAmberColor(), zeus::clamp(0.f, (std::sin(5.f * rightUpT - M_PIF / 2.f) + 1.f) * 0.5f, 1.f))); @@ -324,9 +324,9 @@ void CPauseScreenBase::ProcessControllerInput(const CFinalInput& input) void CPauseScreenBase::Draw(float mainAlpha, float frameAlpha, float yOff) { zeus::CColor color = zeus::CColor::skWhite; - color.a = mainAlpha * x14_alpha; + color.a() = mainAlpha * x14_alpha; x60_basewidget_pivot->SetColor(color); - color.a = frameAlpha; + color.a() = frameAlpha; x64_basewidget_bgframe->SetColor(color); CGuiWidgetDrawParms parms(1.f, zeus::CVector3f{0.f, 15.f * yOff, 0.f}); diff --git a/Runtime/MP1/CPlayerVisor.cpp b/Runtime/MP1/CPlayerVisor.cpp index 7742986da..b4e43f1e1 100644 --- a/Runtime/MP1/CPlayerVisor.cpp +++ b/Runtime/MP1/CPlayerVisor.cpp @@ -74,7 +74,8 @@ bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const float vpScale = g_Viewport.xc_height / 448.f; CGraphics::SetModelMatrix( - zeus::CTransform::Scale(x48_interpWindowDims.x * 17.f * vpScale, 1.f, x48_interpWindowDims.y * 17.f * vpScale)); + zeus::CTransform::Scale(x48_interpWindowDims.x() * 17.f * vpScale, 1.f, + x48_interpWindowDims.y() * 17.f * vpScale)); x114_scanShield->Draw(CModelFlags(5, 0, 3, zeus::CColor::skClear)); @@ -142,7 +143,7 @@ bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const } CGraphics::SetModelMatrix(xf); - iconColor.a *= iconAlpha * farT; + iconColor.a() *= iconAlpha * farT; useModel->Draw(CModelFlags(7, 0, 1, iconColor)); } } @@ -169,8 +170,8 @@ void CPlayerVisor::UpdateScanObjectIndicators(const CStateManager& mgr, float dt const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); zeus::CVector3f orbitPos = act->GetOrbitPosition(mgr); orbitPos = cam->ConvertToScreenSpace(orbitPos); - orbitPos.x = orbitPos.x * g_Viewport.x8_width / 2.f + g_Viewport.x8_width / 2.f; - orbitPos.y = orbitPos.y * g_Viewport.xc_height / 2.f + g_Viewport.xc_height / 2.f; + orbitPos.x() = orbitPos.x() * g_Viewport.x8_width / 2.f + g_Viewport.x8_width / 2.f; + orbitPos.y() = orbitPos.y() * g_Viewport.xc_height / 2.f + g_Viewport.xc_height / 2.f; bool inBox = mgr.GetPlayer().WithinOrbitScreenBox(orbitPos, mgr.GetPlayer().GetOrbitZone(), mgr.GetPlayer().GetOrbitType()); @@ -382,9 +383,9 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana float vpScale = g_Viewport.xc_height / 448.f; float divisor = (transFactor * ((1.f - t) * x58_scanMagInterp + t * g_tweakGui->GetScanWindowScanningAspect()) + (1.f - transFactor)); divisor = 1.f / divisor; - float vpW = 169.218f * x48_interpWindowDims.x * divisor; + float vpW = 169.218f * x48_interpWindowDims.x() * divisor; vpW = zeus::clamp(0.f, vpW, 640.f) * vpScale; - float vpH = 152.218f * x48_interpWindowDims.y * divisor; + float vpH = 152.218f * x48_interpWindowDims.y() * divisor; vpH = zeus::clamp(0.f, vpH, 448.f) * vpScale; SClipScreenRect rect; @@ -398,7 +399,7 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana g_Renderer->SetViewportOrtho(true, -1.f, 1.f); - zeus::CTransform windowScale = zeus::CTransform::Scale(x48_interpWindowDims.x, 1.f, x48_interpWindowDims.y); + zeus::CTransform windowScale = zeus::CTransform::Scale(x48_interpWindowDims.x(), 1.f, x48_interpWindowDims.y()); zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f * vpScale, 1.f, 17.f * vpScale); CGraphics::SetModelMatrix(seventeenScale * windowScale); @@ -415,10 +416,10 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana }; if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) { - rttVerts[0].m_uv.y = uvY1; - rttVerts[1].m_uv.y = uvY1; - rttVerts[2].m_uv.y = uvY0; - rttVerts[3].m_uv.y = uvY0; + rttVerts[0].m_uv.y() = uvY1; + rttVerts[1].m_uv.y() = uvY1; + rttVerts[2].m_uv.y() = uvY0; + rttVerts[3].m_uv.y() = uvY0; } const_cast(x108_newScanPane).drawVerts(zeus::CColor(1.f, transFactor), rttVerts); @@ -428,7 +429,7 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana g_tweakGuiColors->GetScanFrameInactiveColor(), g_tweakGuiColors->GetScanFrameActiveColor(), x54c_scanFrameColorInterp); - frameColor.a = transFactor; + frameColor.a() = transFactor; CModelFlags flags(5, 0, 0, frameColor + g_tweakGuiColors->GetScanFrameImpulseColor() * diff --git a/Runtime/MP1/CSamusDoll.cpp b/Runtime/MP1/CSamusDoll.cpp index 172050f81..01415fee0 100644 --- a/Runtime/MP1/CSamusDoll.cpp +++ b/Runtime/MP1/CSamusDoll.cpp @@ -475,12 +475,12 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) flags.m_extendedShader = EExtendedShader::ForcedAlpha; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = alpha * ballAlpha; + flags.x4_color.a() = alpha * ballAlpha; x184_ballModelData->Render(mgr, x10_ballXf, x24c_actorLights.get(), flags); flags.m_extendedShader = EExtendedShader::ForcedAdditive; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = x6c_ballPulseFactor * alpha * ballAlpha * itemPulse; + flags.x4_color.a() = x6c_ballPulseFactor * alpha * ballAlpha * itemPulse; x184_ballModelData->Render(mgr, x10_ballXf, x24c_actorLights.get(), flags); } @@ -526,12 +526,12 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) flags.m_extendedShader = EExtendedShader::ForcedAlpha; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = alpha; + flags.x4_color.a() = alpha; x1d4_spiderBallGlass->Draw(flags); flags.m_extendedShader = EExtendedShader::ForcedAdditive; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse; + flags.x4_color.a() = x6c_ballPulseFactor * alpha * itemPulse; x1d4_spiderBallGlass->Draw(flags); } } @@ -541,7 +541,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) float radius = zeus::clamp(0.2f, (10.f - (xc0_userZoom >= 0.f ? xc0_userZoom : -xc0_userZoom)) / 20.f, 1.f); float offset = std::sin(x260_phazonOffsetAngle); zeus::CColor color = g_tweakGuiColors->GetPauseBlurFilterColor(); - color.a = alpha; + color.a() = alpha; g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, alpha), x250_phazonIndirectTexture, color, radius, 0.1f, offset, offset); } @@ -556,12 +556,12 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) flags.m_extendedShader = EExtendedShader::ForcedAlpha; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = alpha; + flags.x4_color.a() = alpha; x184_ballModelData->Render(mgr, x10_ballXf, x24c_actorLights.get(), flags); flags.m_extendedShader = EExtendedShader::ForcedAdditive; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse; + flags.x4_color.a() = x6c_ballPulseFactor * alpha * itemPulse; x184_ballModelData->Render(mgr, x10_ballXf, x24c_actorLights.get(), flags); const u8* c = CMorphBall::BallGlowColors[x1e8_ballGlowColorIdx]; @@ -599,12 +599,12 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) flags.m_extendedShader = EExtendedShader::ForcedAlpha; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = alpha; + flags.x4_color.a() = alpha; x1d4_spiderBallGlass->Draw(flags); flags.m_extendedShader = EExtendedShader::ForcedAdditive; flags.x4_color = zeus::CColor::skWhite; - flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse; + flags.x4_color.a() = x6c_ballPulseFactor * alpha * itemPulse; x1d4_spiderBallGlass->Draw(flags); } } @@ -718,8 +718,8 @@ void CSamusDoll::SetRotation(float xDelta, float zDelta, float dt) SetRotationSfxPlaying(xDelta != 0.f || zDelta != 0.f); zeus::CEulerAngles angles(xb0_userRot); - zeus::CRelAngle angX(angles.x); - zeus::CRelAngle angZ(angles.z); + zeus::CRelAngle angX(angles.x()); + zeus::CRelAngle angZ(angles.z()); angX += xDelta; angZ += zDelta; @@ -745,12 +745,12 @@ void CSamusDoll::SetOffset(const zeus::CVector3f& offset, float dt) return; zeus::CVector3f oldOffset = xa4_offset; zeus::CMatrix3f rotMtx = xb0_userRot.toTransform().basis; - xa4_offset += rotMtx * zeus::CVector3f(offset.x, 0.f, offset.z); + xa4_offset += rotMtx * zeus::CVector3f(offset.x(), 0.f, offset.z()); SetOffsetSfxPlaying((oldOffset - xa4_offset).magnitude() > dt); float oldZoom = xc0_userZoom; - xc0_userZoom = zeus::clamp(-4.f, xc0_userZoom + offset.y, -2.2f); + xc0_userZoom = zeus::clamp(-4.f, xc0_userZoom + offset.y(), -2.2f); bool zoomSfx = std::fabs(xc0_userZoom - oldZoom) > dt; - float zoomDelta = offset.y - (xc0_userZoom - oldZoom); + float zoomDelta = offset.y() - (xc0_userZoom - oldZoom); zeus::CVector3f newOffset = rotMtx[1] * zoomDelta + xa4_offset; zeus::CVector3f delta = newOffset - xa4_offset; oldOffset = xa4_offset; diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index 5f5f64617..ed5eacac2 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -323,10 +323,8 @@ void CSamusHud::InitializeDamageLight() x3d4_damageLight->SetColor(zeus::CColor::skBlack); zeus::CColor lightColor = g_tweakGuiColors->GetHudFrameColor(); - lightColor.r *= lightColor.a; - lightColor.g *= lightColor.a; - lightColor.b *= lightColor.a; - lightColor.a = 1.f; + lightColor *= lightColor.a(); + lightColor.a() = 1.f; x3d4_damageLight->SetAmbientLightColor(lightColor); x3d4_damageLight->SetDistC(1.f); @@ -491,12 +489,13 @@ void CSamusHud::UpdateFreeLook(float dt, const CStateManager& mgr) { zeus::CMatrix3f camRot = fpCam->GetTransform().buildMatrix3f(); zeus::CVector3f camDir(camRot[1]); - zeus::CUnitVector3f camDirNoZ(camDir.x, camDir.y, 0.f); + zeus::CUnitVector3f camDirNoZ = camDir; + camDirNoZ.z() = 0.f; float offHorizonDot = camDir.dot(camDirNoZ); if (std::fabs(offHorizonDot) > 1.f) offHorizonDot = (offHorizonDot >= 0.f) ? 1.f : -1.f; float offHorizonAngle = std::fabs(std::acos(offHorizonDot)); - if (camDir.z < 0.f) + if (camDir.z() < 0.f) offHorizonAngle = -offHorizonAngle; if (x298_freeLookIntf) @@ -647,8 +646,8 @@ void CSamusHud::UpdateCameraDebugSettings() if (x29c_decoIntf) x29c_decoIntf->UpdateCameraDebugSettings(fov, y, z); x274_loadedFrmeBaseHud->GetFrameCamera()->SetFov(fov); - x310_cameraPos.y = y; - x310_cameraPos.z = z; + x310_cameraPos.y() = y; + x310_cameraPos.z() = z; } void CSamusHud::UpdateEnergyLow(float dt, const CStateManager& mgr) @@ -740,7 +739,7 @@ void CSamusHud::UpdateHudLag(float dt, const CStateManager& mgr) zeus::CQuaternion lagRot = x44c_hudLagShakeRot * x31c_hudLag; zeus::CVector3f lagOff = x41c_decoShakeTranslate * g_tweakGui->GetHudLagOffsetScale(); - lagOff.z += bobTranslation.z; + lagOff.z() += bobTranslation.z(); if (x2a0_helmetIntf) { x2a0_helmetIntf->SetHudLagRotation(lagRot); @@ -970,11 +969,9 @@ void CSamusHud::UpdateHudDamage(float dt, const CStateManager& mgr, x3ec_damageLightPulser = zeus::clamp(0.f, g_tweakGui->GetHudDamageColorGain() * x3ec_damageLightPulser * std::min(0.5f, player.GetDamageAmount()), 1.f); zeus::CColor damageAmbColor = g_tweakGuiColors->GetHudFrameColor(); - damageAmbColor.r *= damageAmbColor.a; - damageAmbColor.g *= damageAmbColor.a; - damageAmbColor.b *= damageAmbColor.a; + damageAmbColor *= damageAmbColor.a(); damageAmbColor += zeus::CColor(x3ec_damageLightPulser); - damageAmbColor.a = 1.f; + damageAmbColor.a() = 1.f; if (x3d4_damageLight) x3d4_damageLight->SetAmbientLightColor(damageAmbColor); @@ -998,16 +995,16 @@ void CSamusHud::UpdateHudDamage(float dt, const CStateManager& mgr, colorGain = zeus::clamp(0.f, colorGain * x3f8_damageFilterAmtGain, 1.f); zeus::CColor color0 = g_tweakGuiColors->GetDamageAmbientColor(); - color0.a *= colorGain; + color0.a() *= colorGain; zeus::CColor color1 = g_tweakGuiColors->GetDamageAmbientPulseColor(); - color1.a *= x3ec_damageLightPulser; + color1.a() *= x3ec_damageLightPulser; zeus::CColor color2 = color0 + color1; - if (color2.a) + if (color2.a()) { if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Unmorphed) - color2.a *= 0.75f; + color2.a() *= 0.75f; x3a8_camFilter.SetFilter(EFilterType::Add, EFilterShape::Fullscreen, 0.f, color2, -1); } @@ -1121,7 +1118,7 @@ void CSamusHud::UpdateStaticInterference(float dt, const CStateManager& mgr) if (x510_staticInterp > 0.f) { zeus::CColor color = zeus::CColor::skWhite; - color.a = x510_staticInterp; + color.a() = x510_staticInterp; x51c_camFilter2.SetFilter(EFilterType::Blend, EFilterShape::RandomStatic, 0.f, color, -1); } @@ -1141,8 +1138,8 @@ int CSamusHud::GetRelativeDirection(const zeus::CVector3f& position, const CStat return 0; float y = std::cos(2.f * M_PIF * 0.0027777778f * 0.5f * fpCam->GetFov()); float x = std::cos(2.f * M_PIF * 0.0027777778f * 0.5f * fpCam->GetFov() * fpCam->GetAspectRatio()); - zeus::CVector2f camToPosXY = zeus::CVector2f(camToPosLocal.x, camToPosLocal.y).normalized(); - zeus::CVector2f camToPosYZ = zeus::CVector2f(camToPosLocal.y, camToPosLocal.z).normalized(); + zeus::CVector2f camToPosXY = zeus::CVector2f(camToPosLocal.x(), camToPosLocal.y()).normalized(); + zeus::CVector2f camToPosYZ = zeus::CVector2f(camToPosLocal.y(), camToPosLocal.z()).normalized(); if (camToPosXY.dot(zeus::CVector2f(0.f, 1.f)) > x && camToPosYZ.dot(zeus::CVector2f(1.f, 0.f)) > y) return 0; if (camToPosXY.dot(zeus::CVector2f(0.f, -1.f)) > x && camToPosYZ.dot(zeus::CVector2f(-1.f, 0.f)) > y) @@ -1271,7 +1268,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, float aspect = g_Viewport.x8_width / float(g_Viewport.xc_height); float scaleMul = 1.f - zeus::clamp(0.f, (aspect - 1.33f) / (1.77f - 1.33f), 1.f); - x500_viewportScale.y = 1.f - scaleMul * morphT * g_tweakGui->GetBallViewportYReduction() * 1.2f; + x500_viewportScale.y() = 1.f - scaleMul * morphT * g_tweakGui->GetBallViewportYReduction() * 1.2f; if (x2b0_ballIntf) x2b0_ballIntf->SetBallModeFactor(morphT); @@ -1358,7 +1355,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, } zeus::CColor abuttonColor = zeus::CColor::skWhite; - abuttonColor.a = std::fabs(x584_abuttonPulse); + abuttonColor.a() = std::fabs(x584_abuttonPulse); x5a0_base_model_abutton->SetColor(abuttonColor); if (!mgr.GetCameraManager()->IsInCinematicCamera() && oldAPulse < 0.f && x584_abuttonPulse >= 0.f && @@ -1406,7 +1403,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, zeus::CColor messageColor = zeus::CColor::skWhite; float textScale = 1.f; - messageColor.a = std::min(allTextAlpha, messageTextAlpha); + messageColor.a() = std::min(allTextAlpha, messageTextAlpha); messageWidget->SetColor(messageColor); if (messageWidget == x598_base_basewidget_message) @@ -1450,7 +1447,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, x594_base_textpane_counter->SetIsVisible(true); zeus::CColor counterColor = zeus::CColor::skWhite; - counterColor.a = zeus::clamp(0.f, std::min(1.f - std::min(x558_messageTextTime, 1.f), allTextAlpha), 1.f); + counterColor.a() = zeus::clamp(0.f, std::min(1.f - std::min(x558_messageTextTime, 1.f), allTextAlpha), 1.f); x594_base_textpane_counter->SetColor(counterColor); } else @@ -1541,7 +1538,7 @@ void CSamusHud::DrawAttachedEnemyEffect(const CStateManager& mgr) const } zeus::CColor filterColor = g_tweakGuiColors->GetEnergyDrainFilterColor(); - filterColor.a *= alpha; + filterColor.a() *= alpha; const_cast(m_energyDrainFilter).draw(filterColor); } diff --git a/Runtime/MP1/CSlideShow.cpp b/Runtime/MP1/CSlideShow.cpp index 627c38add..7497d187d 100644 --- a/Runtime/MP1/CSlideShow.cpp +++ b/Runtime/MP1/CSlideShow.cpp @@ -154,8 +154,8 @@ void CSlideShow::SSlideData::Draw() const zeus::CRectangle rect; const_cast(*m_texQuad).draw(x30_mulColor, 1.f, rect); - zeus::CVector2f centeredOffset((x28_canvasSize.x - m_texQuad->GetTex()->GetWidth()) * 0.5f, - (x28_canvasSize.y - m_texQuad->GetTex()->GetHeight()) * 0.5f); + zeus::CVector2f centeredOffset((x28_canvasSize.x() - m_texQuad->GetTex()->GetWidth()) * 0.5f, + (x28_canvasSize.y() - m_texQuad->GetTex()->GetHeight()) * 0.5f); } void CSlideShow::Draw() const diff --git a/Runtime/MP1/CSlideShow.hpp b/Runtime/MP1/CSlideShow.hpp index dc5147f25..52bfec149 100644 --- a/Runtime/MP1/CSlideShow.hpp +++ b/Runtime/MP1/CSlideShow.hpp @@ -38,7 +38,7 @@ public: SSlideData(CSlideShow& parent) : x0_parent(parent) { - x30_mulColor.a = 0.f; + x30_mulColor.a() = 0.f; } void SetTexture(const TLockedToken& tex) diff --git a/Runtime/MP1/World/CMetaree.cpp b/Runtime/MP1/World/CMetaree.cpp index 2cf7d8570..764b08811 100644 --- a/Runtime/MP1/World/CMetaree.cpp +++ b/Runtime/MP1/World/CMetaree.cpp @@ -205,6 +205,6 @@ bool CMetaree::InRange(CStateManager& mgr, float arg) bool CMetaree::ShouldAttack(CStateManager&, float) { - return GetTranslation().z < x584_lookPos.z; + return GetTranslation().z() < x584_lookPos.z(); } } diff --git a/Runtime/MP1/World/CNewIntroBoss.hpp b/Runtime/MP1/World/CNewIntroBoss.hpp index 58cf5f00d..d47a3f2db 100644 --- a/Runtime/MP1/World/CNewIntroBoss.hpp +++ b/Runtime/MP1/World/CNewIntroBoss.hpp @@ -63,7 +63,7 @@ public: zeus::CAABox GetSortingBounds(const CStateManager&) const { zeus::CAABox box = GetModelData()->GetBounds(); - return zeus::CAABox({-0.5f, -0.5f, box.min.z}, {0.5f, 0.5f, box.max.z}).getTransformedAABox(x34_transform); + return zeus::CAABox({-0.5f, -0.5f, box.min.z()}, {0.5f, 0.5f, box.max.z()}).getTransformedAABox(x34_transform); } std::experimental::optional GetTouchBounds() const { return {}; } diff --git a/Runtime/MP1/World/CParasite.cpp b/Runtime/MP1/World/CParasite.cpp index 6c5e49846..2c9e12a4f 100644 --- a/Runtime/MP1/World/CParasite.cpp +++ b/Runtime/MP1/World/CParasite.cpp @@ -188,7 +188,8 @@ void CParasite::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM { float distSq = (act->GetTranslation() - GetTranslation()).magSquared(); auto tb = GetTouchBounds(); - float maxComp = std::max(std::max(tb->max.y - tb->min.y, tb->max.z - tb->min.z), tb->max.x - tb->min.x); + float maxComp = std::max(std::max(tb->max.y() - tb->min.y(), tb->max.z() - tb->min.z()), + tb->max.x() - tb->min.x()); float maxCompSq = maxComp * maxComp + 1.f; if (distSq < maxCompSq * maxCompSq) x743_26_oculusShotAt = true; @@ -863,7 +864,7 @@ void CParasite::Retreat(CStateManager& mgr, EStateMsg msg, float) case EStateMsg::Activate: { zeus::CVector3f dir = mgr.GetPlayer().GetTranslation() - GetTranslation(); - dir.z = 0.f; + dir.z() = 0.f; if (dir.canBeNormalized()) dir.normalize(); else @@ -980,18 +981,18 @@ void CParasite::UpdateJumpVelocity() if (!x742_30_attackOver) { vec = skAttackVelocity * GetTransform().frontVector(); - vec.z = 0.5f * skRetreatVelocity; + vec.z() = 0.5f * skRetreatVelocity; } else { vec = skRetreatVelocity * GetTransform().frontVector(); - vec.z = 0.5f * skAttackVelocity; + vec.z() = 0.5f * skAttackVelocity; } - float f30 = x150_momentum.z / xe8_mass; - float f31 = x5f8_targetPos.z - GetTranslation().z; + float f30 = x150_momentum.z() / xe8_mass; + float f31 = x5f8_targetPos.z() - GetTranslation().z(); zeus::CVector3f vec2 = x5f8_targetPos - GetTranslation(); - vec2.z = 0.f; + vec2.z() = 0.f; float f29 = vec2.magnitude(); if (f29 > FLT_EPSILON) @@ -1003,7 +1004,7 @@ void CParasite::UpdateJumpVelocity() float f27 = 0.f; bool isNeg = f31 < 0.f; float xPos, xNeg; - if (CSteeringBehaviors::SolveQuadratic(f30, vec.z, -f31, xPos, xNeg)) + if (CSteeringBehaviors::SolveQuadratic(f30, vec.z(), -f31, xPos, xNeg)) f27 = isNeg ? xPos : xNeg; if (!isNeg) @@ -1012,7 +1013,7 @@ void CParasite::UpdateJumpVelocity() if (f27 < 10.f) { vec = f29 / f27 * vec2; - vec.z = (0.5f * f30 * f27 + f31 / f27); + vec.z() = (0.5f * f30 * f27 + f31 / f27); } } } diff --git a/Runtime/MP1/World/CSpacePirate.cpp b/Runtime/MP1/World/CSpacePirate.cpp index 8b223ec8d..faab88f05 100644 --- a/Runtime/MP1/World/CSpacePirate.cpp +++ b/Runtime/MP1/World/CSpacePirate.cpp @@ -10,6 +10,9 @@ #include "CTimeProvider.hpp" #include "GameGlobalObjects.hpp" #include "Graphics/CBooRenderer.hpp" +#include "World/CScriptCoverPoint.hpp" +#include "World/CScriptTargetingPoint.hpp" +#include "World/CWorld.hpp" #include "TCastTo.hpp" namespace urde::MP1 @@ -80,7 +83,7 @@ CPirateRagDoll::CPirateRagDoll(CStateManager& mgr, CSpacePirate* sp, u16 thudSfx { CSegId id = aData->GetLocatorSegId(skParts[i]); AddParticle(id, center, x6c_spacePirate->GetTransform() * (aData->GetPose().GetOffset(id) * scale), - skRadii[i] * scale.z); + skRadii[i] * scale.z()); } SatisfyWorldConstraintsOnConstruction(mgr); AddLengthConstraint(0, 1); @@ -197,7 +200,7 @@ void CPirateRagDoll::Update(CStateManager& mgr, float dt, float waterTop) if (x6c_spacePirate->x7b4_ != kInvalidUniqueId) { // Shoulder height delta - float f2 = x4_particles[2].GetPosition().z - x4_particles[5].GetPosition().z; + float f2 = x4_particles[2].GetPosition().z() - x4_particles[5].GetPosition().z(); if (f2 * f2 > 0.0625f) { zeus::CVector3f vec(0.f, 0.f, ((f2 > 0.f) ? f2 - 0.25f : f2 + 0.25f) * 0.1f); @@ -205,8 +208,8 @@ void CPirateRagDoll::Update(CStateManager& mgr, float dt, float waterTop) x4_particles[5].Position() += vec; } // Collar-hips height delta - f2 = x4_particles[0].GetPosition().z - - (x4_particles[8].GetPosition().z + x4_particles[11].GetPosition().z) * 0.5f; + f2 = x4_particles[0].GetPosition().z() - + (x4_particles[8].GetPosition().z() + x4_particles[11].GetPosition().z()) * 0.5f; if (f2 * f2 > 0.0625f) { zeus::CVector3f vec(0.f, 0.f, ((f2 > 0.f) ? f2 - 0.25f : f2 + 0.25f) * 0.1f); @@ -219,11 +222,11 @@ void CPirateRagDoll::Update(CStateManager& mgr, float dt, float waterTop) zeus::CVector3f oldTorsoCenter = x4_particles[8].GetPosition() * 0.25f + x4_particles[11].GetPosition() * 0.25f + x4_particles[0].GetPosition() * 0.5f; - oldTorsoCenter.z = - std::min(x4_particles[0].GetPosition().z - x4_particles[0].GetRadius(), - std::min(x4_particles[8].GetPosition().z - x4_particles[8].GetRadius(), - x4_particles[11].GetPosition().z - x4_particles[11].GetRadius())); - if (oldTorsoCenter.z < 0.5f + waterTop) + oldTorsoCenter.z() = + std::min(x4_particles[0].GetPosition().z() - x4_particles[0].GetRadius(), + std::min(x4_particles[8].GetPosition().z() - x4_particles[8].GetRadius(), + x4_particles[11].GetPosition().z() - x4_particles[11].GetRadius())); + if (oldTorsoCenter.z() < 0.5f + waterTop) x84_torsoImpulse = x84_torsoImpulse * 1000.f; zeus::CVector3f accDelta = x84_torsoImpulse * 0.333f * (1.f / x6c_spacePirate->GetMass()); x4_particles[11].Velocity() += accDelta; @@ -243,10 +246,10 @@ void CPirateRagDoll::Update(CStateManager& mgr, float dt, float waterTop) zeus::CVector3f newTorsoCenter = x4_particles[8].GetPosition() * 0.25f + x4_particles[11].GetPosition() * 0.25f + x4_particles[0].GetPosition() * 0.5f; - newTorsoCenter.z = - std::min(x4_particles[0].GetPosition().z - x4_particles[0].GetRadius(), - std::min(x4_particles[8].GetPosition().z - x4_particles[8].GetRadius(), - x4_particles[11].GetPosition().z - x4_particles[11].GetRadius())); + newTorsoCenter.z() = + std::min(x4_particles[0].GetPosition().z() - x4_particles[0].GetRadius(), + std::min(x4_particles[8].GetPosition().z() - x4_particles[8].GetRadius(), + x4_particles[11].GetPosition().z() - x4_particles[11].GetRadius())); x6c_spacePirate->SetTransform({}); x6c_spacePirate->SetTranslation(newTorsoCenter); x6c_spacePirate->SetVelocityWR((newTorsoCenter - oldTorsoCenter) * (1.f / dt)); @@ -272,7 +275,7 @@ void CPirateRagDoll::Prime(CStateManager& mgr, const zeus::CTransform& xf, CMode { const auto& aabb = x6c_spacePirate->GetBaseBoundingBox(); zeus::CVector3f newMax = aabb.max; - newMax.z = (aabb.max.z - aabb.min.z) * 0.5f + aabb.min.z; + newMax.z() = (aabb.max.z() - aabb.min.z()) * 0.5f + aabb.min.z(); x6c_spacePirate->SetBoundingBox({aabb.min, newMax}); CRagDoll::Prime(mgr, xf, mData); } @@ -423,7 +426,7 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn x635_27_shadowPirate = bool(x568_pirateData.x18_flags & 0x2000); x635_28_ = bool(x568_pirateData.x18_flags & 0x4000); x635_29_ = bool(x568_pirateData.x18_flags & 0x8000); - x635_30_ragdollKeepAlive = bool(x568_pirateData.x18_flags & 0x10000); + x635_30_floatingCorpse = bool(x568_pirateData.x18_flags & 0x10000); x635_31_ragdollNoAiCollision = bool(x568_pirateData.x18_flags & 0x20000); x636_24_trooper = bool(x568_pirateData.x18_flags & 0x40000); @@ -448,7 +451,7 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn } const auto& baseAABB = GetBaseBoundingBox(); - x7a8_ = (baseAABB.max.z - baseAABB.min.z) * 0.6f; + x7a8_ = (baseAABB.max.z() - baseAABB.min.z()) * 0.6f; if (x90_actorLights) x90_actorLights->SetAmbienceGenerated(false); @@ -511,16 +514,16 @@ void CSpacePirate::UpdateCloak(float dt, CStateManager& mgr) if (x450_bodyController->IsFrozen()) x3e8_alphaDelta = 2.f; - if (x3e8_alphaDelta < 0.f && x42c_color.a < x8b8_minCloakAlpha) + if (x3e8_alphaDelta < 0.f && x42c_color.a() < x8b8_minCloakAlpha) { - x42c_color.a = x8b8_minCloakAlpha; + x42c_color.a() = x8b8_minCloakAlpha; x3e8_alphaDelta = 0.f; RemoveMaterial(EMaterialTypes::Target, mgr); } - if (x3e8_alphaDelta > 0.f && x42c_color.a > x8bc_maxCloakAlpha) + if (x3e8_alphaDelta > 0.f && x42c_color.a() > x8bc_maxCloakAlpha) { - x42c_color.a = x8bc_maxCloakAlpha; + x42c_color.a() = x8bc_maxCloakAlpha; AddMaterial(EMaterialTypes::Target, mgr); } @@ -530,17 +533,17 @@ void CSpacePirate::UpdateCloak(float dt, CStateManager& mgr) x8b0_cloakStepTime = (1.f - mgr.GetActiveRandom()->Float()) * 0.08f; if (x3e8_alphaDelta < 0.f) { - x8b4_shadowPirateAlpha = x42c_color.a; + x8b4_shadowPirateAlpha = x42c_color.a(); if (x400_25_alive) - x8b4_shadowPirateAlpha -= (x42c_color.a - x8b8_minCloakAlpha) * x8b0_cloakStepTime; + x8b4_shadowPirateAlpha -= (x42c_color.a() - x8b8_minCloakAlpha) * x8b0_cloakStepTime; } else if (x3e8_alphaDelta > 0.f) { - x8b4_shadowPirateAlpha = x42c_color.a + x8b0_cloakStepTime * (x8bc_maxCloakAlpha - x42c_color.a); + x8b4_shadowPirateAlpha = x42c_color.a() + x8b0_cloakStepTime * (x8bc_maxCloakAlpha - x42c_color.a()); } else { - x8b4_shadowPirateAlpha = x42c_color.a; + x8b4_shadowPirateAlpha = x42c_color.a(); } } } @@ -579,6 +582,35 @@ void CSpacePirate::ResetTeamAiRole(CStateManager& mgr) mgr, x8c8_teamAiMgrId, GetUniqueId(), true); } +void CSpacePirate::AssignTeamAiRole(CStateManager& mgr) +{ + if (x8c8_teamAiMgrId == kInvalidUniqueId) + x8c8_teamAiMgrId = CTeamAiMgr::GetTeamAiMgr(*this, mgr); + if (x8c8_teamAiMgrId != kInvalidUniqueId) + { + if (TCastToPtr aimgr = mgr.ObjectById(x8c8_teamAiMgrId)) + { + aimgr->AssignTeamAiRole(*this, x634_27_melee ? CTeamAiRole::ETeamAiRole::Melee : + CTeamAiRole::ETeamAiRole::Projectile, CTeamAiRole::ETeamAiRole::Unknown, CTeamAiRole::ETeamAiRole::Invalid); + } + } +} + +void CSpacePirate::RemoveTeamAiRole(CStateManager& mgr) +{ + if (x8c8_teamAiMgrId != kInvalidUniqueId) + { + if (TCastToPtr aimgr = mgr.ObjectById(x8c8_teamAiMgrId)) + { + if (aimgr->IsPartOfTeam(GetUniqueId())) + { + aimgr->RemoveTeamAiRole(GetUniqueId()); + x8c8_teamAiMgrId = kInvalidUniqueId; + } + } + } +} + bool CSpacePirate::CheckTargetable(CStateManager& mgr) { return GetModelAlphau8(mgr) > 127; @@ -598,7 +630,7 @@ void CSpacePirate::UpdateAttacks(float dt, CStateManager& mgr) { bool reset = true; if ((!x400_25_alive || (x450_bodyController->GetBodyStateInfo().GetCurrentState()->CanShoot() && - x637_29_ && !x634_27_melee && !x634_25_ceilingAmbush && !x639_26_ && + x637_29_ && !x634_27_melee && !x634_25_ceilingAmbush && !x639_26_started && !x450_bodyController->IsElectrocuting())) && x7c4_burstFire.GetBurstType() != -1) { if (x400_25_alive) @@ -687,7 +719,7 @@ zeus::CVector3f CSpacePirate::GetTargetPos(CStateManager& mgr) void CSpacePirate::UpdateAimBodyState(float dt, CStateManager& mgr) { if (x400_25_alive && x637_25_ && !x637_29_ && !x450_bodyController->IsFrozen() && - !x634_27_melee && !x85c_ragDoll && (!x635_26_ || x639_28_) && x31c_faceVec.z <= 0.f) + !x634_27_melee && !x85c_ragDoll && (!x635_26_ || x639_28_) && x31c_faceVec.z() <= 0.f) { x8c4_aimDelayTimer = std::max(0.f, x8c4_aimDelayTimer - dt); if (x8c4_aimDelayTimer == 0.f) @@ -853,7 +885,7 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) if (xc4_fluidId != kInvalidUniqueId) if (TCastToConstPtr water = mgr.GetObjectById(xc4_fluidId)) if (water->GetActive()) - waterTop = water->GetTriggerBoundsWR().max.z; + waterTop = water->GetTriggerBoundsWR().max.z(); x85c_ragDoll->Update(mgr, dt * CalcDyingThinkRate(), waterTop); x64_modelData->AdvanceParticles(x34_transform, dt, mgr); } @@ -877,7 +909,7 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) { x85c_ragDoll = std::make_unique( mgr, this, x568_pirateData.x98_ragdollThudSfx, - (x635_30_ragdollKeepAlive ? 3 : 0) | + (x635_30_floatingCorpse ? 3 : 0) | (x635_31_ragdollNoAiCollision ? 4 : 0)); RemoveMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr); } @@ -886,11 +918,207 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) } } -void CSpacePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) +void CSpacePirate::SetEyeParticleActive(CStateManager& mgr, bool active) +{ + if (!x636_24_trooper) + { + if (!x634_29_onlyAttackInRange || x635_26_) + { + if (!x635_27_shadowPirate) + x64_modelData->AnimationData()->SetParticleEffectState("TwoEyes"sv, active, mgr); + } + else + { + x64_modelData->AnimationData()->SetParticleEffectState("OneEye"sv, active, mgr); + } + } +} + +void CSpacePirate::SetVelocityForJump() { } +void CSpacePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) +{ + if (x637_29_ || x634_25_ceilingAmbush) + { + switch (msg) + { + case EScriptObjectMessage::Falling: + if (!x637_29_ || x450_bodyController->GetCurrentStateId() != pas::EAnimationState::WallHang || + x450_bodyController->GetBodyStateInfo().GetCurrentState()->ApplyGravity()) + { + if (x634_25_ceilingAmbush) + { + if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Locomotion || + (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Jump && + !x450_bodyController->GetBodyStateInfo().GetCurrentState()->IsMoving())) + { + CPhysicsActor::Stop(); + SetMomentumWR(zeus::CVector3f::skZero); + return; + } + } + } + break; + case EScriptObjectMessage::OnFloor: + x850_timeSinceHitByPlayer = FLT_MAX; + break; + default: + break; + } + } + switch (msg) + { + case EScriptObjectMessage::OnNormalSurface: + case EScriptObjectMessage::Activate: + if (GetActive()) + { + if (x634_29_onlyAttackInRange) + x638_31_ = true; + else + x400_24_hitByPlayerProjectile = true; + AssignTeamAiRole(mgr); + } + else if (x634_25_ceilingAmbush) + { + RemoveMaterial(EMaterialTypes::GroundCollider, mgr); + x328_27_onGround = false; + } + break; + default: + break; + } + CPatterned::AcceptScriptMsg(msg, sender, mgr); + switch (msg) + { + case EScriptObjectMessage::InitializedInArea: + for (const auto& conn : GetConnectionList()) + { + if (conn.x0_state == EScriptObjectState::Retreat && conn.x4_msg == EScriptObjectMessage::Next) + { + TUniqueId id = mgr.GetIdForScript(conn.x8_objId); + if (TCastToPtr cp = mgr.ObjectById(id)) + cp->Reserve(GetUniqueId()); + } + else if (conn.x0_state == EScriptObjectState::Patrol && conn.x4_msg == EScriptObjectMessage::Follow) + { + x637_24_ = true; + } + } + x660_pathFindSearch.SetArea( + mgr.GetWorld()->GetAreaAlways(x4_areaId)->GetPostConstructed()->x10bc_pathArea); + if (x635_30_floatingCorpse) + { + x858_ragdollDelayTimer = 0.01f; + RemoveMaterial(EMaterialTypes::Character, mgr); + x400_25_alive = false; + HealthInfo(mgr)->SetHP(-1.f); + } + else + { + SetEyeParticleActive(mgr, true); + } + break; + case EScriptObjectMessage::Decrement: + if (x85c_ragDoll) + { + x85c_ragDoll->SetNoOverTimer(false); + x85c_ragDoll->SetContinueSmallMovements(false); + } + break; + case EScriptObjectMessage::Registered: + { + if (x634_25_ceilingAmbush) + { + x634_24_pendingAmbush = true; + if (x635_27_shadowPirate) + { + x42c_color.a() = x568_pirateData.xb0_minCloakAlpha; + x3e8_alphaDelta = -1.f; + } + } + x75c_ = mgr.GetActiveRandom()->Next() % 6; + CMaterialFilter filter = GetMaterialFilter(); + filter.IncludeList().Remove(EMaterialTypes::AIPassthrough); + filter.ExcludeList().Add(EMaterialTypes::AIPassthrough); + SetMaterialFilter(filter); + break; + } + case EScriptObjectMessage::SetToZero: + if (x30_24_active) + x636_29_ = true; + break; + case EScriptObjectMessage::Falling: + if (!x450_bodyController->IsFrozen()) + { + float zMom = GetGravityConstant() * xe8_mass; + if (x634_25_ceilingAmbush) + zMom *= 3.f; + SetMomentumWR({0.f, 0.f, -zMom}); + } + if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Step) + SetVelocityWR({0.f, 0.f, x138_velocity.z()}); + x7c4_burstFire.SetBurstType(3); + break; + case EScriptObjectMessage::Jumped: + CPatterned::AcceptScriptMsg(msg, sender, mgr); + SetMomentumWR({0.f, 0.f, -GetGravityConstant() * xe8_mass}); + SetVelocityForJump(); + break; + case EScriptObjectMessage::OnFloor: + if (!x634_29_onlyAttackInRange) + x7c4_burstFire.SetBurstType(1); + else + x7c4_burstFire.SetBurstType(4); + x637_30_ = false; + if (x635_27_shadowPirate && x138_velocity.z() < -1.f) + { + x3e8_alphaDelta = 1.f; + x8a8_cloakDelayTimer += -0.05f * x138_velocity.z(); + x8a8_cloakDelayTimer = zeus::clamp(0.f, x8a8_cloakDelayTimer, 1.f); + x8bc_maxCloakAlpha = 0.5f; + if (x400_25_alive) + { + mgr.GetActorModelParticles()->sub_801e51d0(*this); + x8ac_electricParticleTimer = 1.f + x8a8_cloakDelayTimer; + } + } + break; + case EScriptObjectMessage::Action: + if (TCastToPtr tp = mgr.ObjectById(sender)) + { + if (tp->GetActive()) + { + x764_boneTracking.SetTarget(sender); + x7c0_targetId = sender; + x400_24_hitByPlayerProjectile = true; + } + else + { + x764_boneTracking.SetTarget(mgr.GetPlayer().GetUniqueId()); + x7c0_targetId = mgr.GetPlayer().GetUniqueId(); + } + x7bc_ = 0.f; + } + break; + case EScriptObjectMessage::Deactivate: + case EScriptObjectMessage::Deleted: + RemoveTeamAiRole(mgr); + mChargePlayerList.remove(GetUniqueId()); + break; + case EScriptObjectMessage::Start: + x639_26_started = false; + break; + case EScriptObjectMessage::Stop: + x639_26_started = true; + break; + default: + break; + } +} + void CSpacePirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { if (x85c_ragDoll && x85c_ragDoll->IsPrimed()) @@ -928,7 +1156,19 @@ void CSpacePirate::CalculateRenderBounds() void CSpacePirate::Touch(CActor& other, CStateManager& mgr) { - + CPatterned::Touch(other, mgr); + if (x85c_ragDoll && x85c_ragDoll->IsPrimed()) + { + if (TCastToPtr trig = other) + { + if (trig->GetActive() && + (trig->GetTriggerFlags() & ETriggerFlags::DetectAI) != ETriggerFlags::None && + trig->GetForceMagnitude() > 0.f) + { + x85c_ragDoll->TorsoImpulse() += trig->GetForceVector(); + } + } + } } zeus::CAABox CSpacePirate::GetSortingBounds(const CStateManager& mgr) const @@ -941,7 +1181,56 @@ zeus::CAABox CSpacePirate::GetSortingBounds(const CStateManager& mgr) const void CSpacePirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) { - + bool handled = false; + switch (type) + { + case EUserEventType::BeginAction: + RemoveMaterial(EMaterialTypes::Solid, mgr); + x638_30_ragdollOver = true; + handled = true; + break; + case EUserEventType::EndAction: + x639_30_ = false; + handled = true; + break; + case EUserEventType::Projectile: + case EUserEventType::BecomeRagDoll: + if (x634_29_onlyAttackInRange || HealthInfo(mgr)->GetHP() <= 0.f) + x858_ragdollDelayTimer = mgr.GetActiveRandom()->Float() * 0.05f + 0.001f; + handled = true; + break; + case EUserEventType::IkLock: + if (!x860_ikChain.GetActive()) + { + CSegId lctrId = x64_modelData->GetAnimationData()->GetLocatorSegId(node.GetLocatorName()); + if (lctrId != 3) + { + zeus::CTransform xf = GetLctrTransform(lctrId); + x860_ikChain.Activate(*x64_modelData->AnimationData(), lctrId, xf); + x639_28_ = true; + } + } + handled = true; + break; + case EUserEventType::IkRelease: + x860_ikChain.Deactivate(); + handled = true; + break; + case EUserEventType::ScreenShake: + SendScriptMsgs(EScriptObjectState::Play, mgr, EScriptObjectMessage::None); + handled = true; + break; + case EUserEventType::FadeOut: + x3e8_alphaDelta = -0.8f; + mgr.GetActorModelParticles()->sub_801e51d0(*this); + x8ac_electricParticleTimer = 1.f; + handled = true; + break; + default: + break; + } + if (!handled) + CPatterned::DoUserAnimEvent(mgr, node, type, dt); } void CSpacePirate::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) @@ -968,7 +1257,7 @@ bool CSpacePirate::Listen(const zeus::CVector3f& pos, EListenNoiseType type) zeus::CVector3f delta = pos - GetTranslation(); if (delta.magSquared() < x568_pirateData.x14_hearNoiseRange * x568_pirateData.x14_hearNoiseRange && (x3c0_detectionHeightRange == 0.f || - delta.z * delta.z < x3c0_detectionHeightRange * x3c0_detectionHeightRange)) + delta.z() * delta.z() < x3c0_detectionHeightRange * x3c0_detectionHeightRange)) x636_25_hearNoise = true; if (type == EListenNoiseType::PlayerFire) x637_26_hearPlayerFire = true; @@ -1318,7 +1607,7 @@ u8 CSpacePirate::GetModelAlphau8(const CStateManager& mgr) const !x400_25_alive) { if (!x635_27_shadowPirate) - return u8(x42c_color.a * 255.f); + return u8(x42c_color.a() * 255.f); else return u8(x8b4_shadowPirateAlpha * 255.f); } diff --git a/Runtime/MP1/World/CSpacePirate.hpp b/Runtime/MP1/World/CSpacePirate.hpp index a6c27e72b..d25cbfc6e 100644 --- a/Runtime/MP1/World/CSpacePirate.hpp +++ b/Runtime/MP1/World/CSpacePirate.hpp @@ -28,6 +28,7 @@ public: void PreRender(const zeus::CVector3f& v, CModelData& mData); void Update(CStateManager& mgr, float dt, float waterTop); void Prime(CStateManager& mgr, const zeus::CTransform& xf, CModelData& mData); + zeus::CVector3f& TorsoImpulse() { return x84_torsoImpulse; } }; class CSpacePirate : public CPatterned @@ -90,7 +91,7 @@ private: bool x635_27_shadowPirate : 1; bool x635_28_ : 1; bool x635_29_ : 1; - bool x635_30_ragdollKeepAlive : 1; + bool x635_30_floatingCorpse : 1; bool x635_31_ragdollNoAiCollision : 1; bool x636_24_trooper : 1; bool x636_25_hearNoise : 1; @@ -118,7 +119,7 @@ private: bool x638_31_ : 1; bool x639_24_ : 1; bool x639_25_ : 1; - bool x639_26_ : 1; + bool x639_26_started : 1; bool x639_27_ : 1; bool x639_28_ : 1; bool x639_29_ : 1; @@ -206,6 +207,8 @@ private: void UpdateCloak(float dt, CStateManager& mgr); bool ShouldFrenzy(CStateManager& mgr); void ResetTeamAiRole(CStateManager& mgr); + void AssignTeamAiRole(CStateManager& mgr); + void RemoveTeamAiRole(CStateManager& mgr); bool CheckTargetable(CStateManager& mgr); void FireProjectile(float dt, CStateManager& mgr); void UpdateAttacks(float dt, CStateManager& mgr); @@ -214,6 +217,8 @@ private: void SetCinematicCollision(CStateManager& mgr); void SetNonCinematicCollision(CStateManager& mgr); void CheckForProjectiles(CStateManager& mgr); + void SetEyeParticleActive(CStateManager& mgr, bool active); + void SetVelocityForJump(); public: CSpacePirate(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, diff --git a/Runtime/Particle/CDecal.cpp b/Runtime/Particle/CDecal.cpp index ace1f344c..89ae413f9 100644 --- a/Runtime/Particle/CDecal.cpp +++ b/Runtime/Particle/CDecal.cpp @@ -108,7 +108,7 @@ void CDecal::RenderQuad(CQuadDecal& decal, const SQuadDescr& desc) const if (CVectorElement* off = desc.xc_OFF.get()) { off->GetValue(x58_frameIdx, offset); - offset.y = 0.f; + offset.y() = 0.f; } zeus::CTransform modXf = xc_transform; modXf.origin += offset; @@ -215,9 +215,9 @@ void CDecal::RenderMdl() const if (dmrtIsConst) { desc.x50_DMRT->GetValue(x58_frameIdx, const_cast(x60_rotation)); - dmrtXf = zeus::CTransform::RotateZ(zeus::degToRad(x60_rotation.z)); - dmrtXf.rotateLocalY(zeus::degToRad(x60_rotation.y)); - dmrtXf.rotateLocalX(zeus::degToRad(x60_rotation.x)); + dmrtXf = zeus::CTransform::RotateZ(zeus::degToRad(x60_rotation.z())); + dmrtXf.rotateLocalY(zeus::degToRad(x60_rotation.y())); + dmrtXf.rotateLocalX(zeus::degToRad(x60_rotation.x())); } dmrtXf = rotXf * dmrtXf; @@ -237,9 +237,9 @@ void CDecal::RenderMdl() const { zeus::CVector3f dmrtVec; dmrt->GetValue(x58_frameIdx, dmrtVec); - dmrtXf = zeus::CTransform::RotateZ(zeus::degToRad(dmrtVec.z)); - dmrtXf.rotateLocalY(zeus::degToRad(dmrtVec.y)); - dmrtXf.rotateLocalX(zeus::degToRad(dmrtVec.x)); + dmrtXf = zeus::CTransform::RotateZ(zeus::degToRad(dmrtVec.z())); + dmrtXf.rotateLocalY(zeus::degToRad(dmrtVec.y())); + dmrtXf.rotateLocalX(zeus::degToRad(dmrtVec.x())); worldXf = worldXf * rotXf * dmrtXf; } else @@ -267,7 +267,7 @@ void CDecal::RenderMdl() const } else { - if (color.a == 1.f) + if (color.a() == 1.f) { CModelFlags flags(0, 0, 3, zeus::CColor::skWhite); desc.x38_DMDL.m_token->Draw(flags); diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index 32c63c758..b5b92bd07 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -371,14 +371,14 @@ bool CElementGen::InternalUpdate(double dt) return false; } -void CElementGen::AccumulateBounds(zeus::CVector3f& pos, float size) +void CElementGen::AccumulateBounds(const zeus::CVector3f& pos, float size) { - x2e0_aabbMax[0] = std::max(pos[0], x2e0_aabbMax[0]); - x2e0_aabbMax[1] = std::max(pos[1], x2e0_aabbMax[1]); - x2e0_aabbMax[2] = std::max(pos[2], x2e0_aabbMax[2]); - x2d4_aabbMin[0] = std::min(pos[0], x2d4_aabbMin[0]); - x2d4_aabbMin[1] = std::min(pos[1], x2d4_aabbMin[1]); - x2d4_aabbMin[2] = std::min(pos[2], x2d4_aabbMin[2]); + x2e0_aabbMax[0] = std::max(pos[0], float(x2e0_aabbMax[0])); + x2e0_aabbMax[1] = std::max(pos[1], float(x2e0_aabbMax[1])); + x2e0_aabbMax[2] = std::max(pos[2], float(x2e0_aabbMax[2])); + x2d4_aabbMin[0] = std::min(pos[0], float(x2d4_aabbMin[0])); + x2d4_aabbMin[1] = std::min(pos[1], float(x2d4_aabbMin[1])); + x2d4_aabbMin[2] = std::min(pos[2], float(x2d4_aabbMin[2])); x2ec_maxSize = std::max(size, x2ec_maxSize); } @@ -1162,7 +1162,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) } else { - if (1.f == col.a) + if (1.f == col.a()) model->Draw({0, 0, 3, zeus::CColor::skWhite}); else model->Draw({5, 0, 1, col}); @@ -1494,10 +1494,10 @@ void CElementGen::RenderParticles() { g_instTexData.emplace_back(); SParticleInstanceTex& inst = g_instTexData.back(); - inst.pos[0] = zeus::CVector4f{viewPoint.x + size, viewPoint.y, viewPoint.z + size, 1.f}; - inst.pos[1] = zeus::CVector4f{viewPoint.x - size, viewPoint.y, viewPoint.z + size, 1.f}; - inst.pos[2] = zeus::CVector4f{viewPoint.x + size, viewPoint.y, viewPoint.z - size, 1.f}; - inst.pos[3] = zeus::CVector4f{viewPoint.x - size, viewPoint.y, viewPoint.z - size, 1.f}; + inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f}; + inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f}; + inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f}; + inst.pos[3] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() - size, 1.f}; inst.color = particle.x34_color; inst.uvs[0] = {uvs.xMax, uvs.yMax}; inst.uvs[1] = {uvs.xMin, uvs.yMax}; @@ -1509,10 +1509,10 @@ void CElementGen::RenderParticles() { g_instNoTexData.emplace_back(); SParticleInstanceNoTex& inst = g_instNoTexData.back(); - inst.pos[0] = zeus::CVector4f{viewPoint.x + size, viewPoint.y, viewPoint.z + size, 1.f}; - inst.pos[1] = zeus::CVector4f{viewPoint.x - size, viewPoint.y, viewPoint.z + size, 1.f}; - inst.pos[2] = zeus::CVector4f{viewPoint.x + size, viewPoint.y, viewPoint.z - size, 1.f}; - inst.pos[3] = zeus::CVector4f{viewPoint.x - size, viewPoint.y, viewPoint.z - size, 1.f}; + inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f}; + inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f}; + inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f}; + inst.pos[3] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() - size, 1.f}; inst.color = particle.x34_color; break; } @@ -1532,11 +1532,11 @@ void CElementGen::RenderParticles() { g_instTexData.emplace_back(); SParticleInstanceTex& inst = g_instTexData.back(); - inst.pos[0] = zeus::CVector4f{viewPoint.x + sinT + cosT, viewPoint.y, viewPoint.z + cosT - sinT, 1.f}; - inst.pos[1] = zeus::CVector4f{viewPoint.x + sinT - cosT, viewPoint.y, viewPoint.z + sinT + cosT, 1.f}; - inst.pos[2] = zeus::CVector4f{viewPoint.x + (cosT - sinT), viewPoint.y, viewPoint.z + (-cosT - sinT), + inst.pos[0] = zeus::CVector4f{viewPoint.x() + sinT + cosT, viewPoint.y(), viewPoint.z() + cosT - sinT, 1.f}; + inst.pos[1] = zeus::CVector4f{viewPoint.x() + sinT - cosT, viewPoint.y(), viewPoint.z() + sinT + cosT, 1.f}; + inst.pos[2] = zeus::CVector4f{viewPoint.x() + (cosT - sinT), viewPoint.y(), viewPoint.z() + (-cosT - sinT), 1.f}; - inst.pos[3] = zeus::CVector4f{viewPoint.x - (sinT + cosT), viewPoint.y, viewPoint.z - (cosT - sinT), + inst.pos[3] = zeus::CVector4f{viewPoint.x() - (sinT + cosT), viewPoint.y(), viewPoint.z() - (cosT - sinT), 1.f}; inst.color = particle.x34_color; inst.uvs[0] = {uvs.xMax, uvs.yMax}; @@ -1549,11 +1549,11 @@ void CElementGen::RenderParticles() { g_instNoTexData.emplace_back(); SParticleInstanceNoTex& inst = g_instNoTexData.back(); - inst.pos[0] = zeus::CVector4f{viewPoint.x + sinT + cosT, viewPoint.y, viewPoint.z + cosT - sinT, 1.f}; - inst.pos[1] = zeus::CVector4f{viewPoint.x + sinT - cosT, viewPoint.y, viewPoint.z + sinT + cosT, 1.f}; - inst.pos[2] = zeus::CVector4f{viewPoint.x + (cosT - sinT), viewPoint.y, viewPoint.z + (-cosT - sinT), + inst.pos[0] = zeus::CVector4f{viewPoint.x() + sinT + cosT, viewPoint.y(), viewPoint.z() + cosT - sinT, 1.f}; + inst.pos[1] = zeus::CVector4f{viewPoint.x() + sinT - cosT, viewPoint.y(), viewPoint.z() + sinT + cosT, 1.f}; + inst.pos[2] = zeus::CVector4f{viewPoint.x() + (cosT - sinT), viewPoint.y(), viewPoint.z() + (-cosT - sinT), 1.f}; - inst.pos[3] = zeus::CVector4f{viewPoint.x - (sinT + cosT), viewPoint.y, viewPoint.z - (cosT - sinT), + inst.pos[3] = zeus::CVector4f{viewPoint.x() - (sinT + cosT), viewPoint.y(), viewPoint.z() - (cosT - sinT), 1.f}; inst.color = particle.x34_color; break; @@ -1720,10 +1720,10 @@ void CElementGen::RenderParticles() { g_instTexData.emplace_back(); SParticleInstanceTex& inst = g_instTexData.back(); - inst.pos[0] = zeus::CVector4f{vec2.x + size, vec2.y, vec2.z + size, 1.f}; - inst.pos[1] = zeus::CVector4f{vec2.x - size, vec2.y, vec2.z + size, 1.f}; - inst.pos[2] = zeus::CVector4f{vec2.x + size, vec2.y, vec2.z - size, 1.f}; - inst.pos[3] = zeus::CVector4f{vec2.x - size, vec2.y, vec2.z - size, 1.f}; + inst.pos[0] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() + size, 1.f}; + inst.pos[1] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() + size, 1.f}; + inst.pos[2] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() - size, 1.f}; + inst.pos[3] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() - size, 1.f}; inst.color = particle.x34_color; inst.uvs[0] = {uvs.xMax, uvs.yMax}; inst.uvs[1] = {uvs.xMin, uvs.yMax}; @@ -1735,10 +1735,10 @@ void CElementGen::RenderParticles() { g_instNoTexData.emplace_back(); SParticleInstanceNoTex& inst = g_instNoTexData.back(); - inst.pos[0] = zeus::CVector4f{vec2.x + size, vec2.y, vec2.z + size, 1.f}; - inst.pos[1] = zeus::CVector4f{vec2.x - size, vec2.y, vec2.z + size, 1.f}; - inst.pos[2] = zeus::CVector4f{vec2.x + size, vec2.y, vec2.z - size, 1.f}; - inst.pos[3] = zeus::CVector4f{vec2.x - size, vec2.y, vec2.z - size, 1.f}; + inst.pos[0] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() + size, 1.f}; + inst.pos[1] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() + size, 1.f}; + inst.pos[2] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() - size, 1.f}; + inst.pos[3] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() - size, 1.f}; inst.color = particle.x34_color; break; } @@ -1763,10 +1763,10 @@ void CElementGen::RenderParticles() { g_instTexData.emplace_back(); SParticleInstanceTex& inst = g_instTexData.back(); - inst.pos[0] = zeus::CVector4f{vec2.x + sinT + cosT, vec2.y, vec2.z + cosT - sinT, 1.f}; - inst.pos[1] = zeus::CVector4f{vec2.x + sinT - cosT, vec2.y, vec2.z + sinT + cosT, 1.f}; - inst.pos[2] = zeus::CVector4f{vec2.x + (cosT - sinT), vec2.y, vec2.z + (-cosT - sinT), 1.f}; - inst.pos[3] = zeus::CVector4f{vec2.x - (sinT + cosT), vec2.y, vec2.z - (cosT - sinT), 1.f}; + inst.pos[0] = zeus::CVector4f{vec2.x() + sinT + cosT, vec2.y(), vec2.z() + cosT - sinT, 1.f}; + inst.pos[1] = zeus::CVector4f{vec2.x() + sinT - cosT, vec2.y(), vec2.z() + sinT + cosT, 1.f}; + inst.pos[2] = zeus::CVector4f{vec2.x() + (cosT - sinT), vec2.y(), vec2.z() + (-cosT - sinT), 1.f}; + inst.pos[3] = zeus::CVector4f{vec2.x() - (sinT + cosT), vec2.y(), vec2.z() - (cosT - sinT), 1.f}; inst.color = particle.x34_color; inst.uvs[0] = {uvs.xMax, uvs.yMax}; inst.uvs[1] = {uvs.xMin, uvs.yMax}; @@ -1778,10 +1778,10 @@ void CElementGen::RenderParticles() { g_instNoTexData.emplace_back(); SParticleInstanceNoTex& inst = g_instNoTexData.back(); - inst.pos[0] = zeus::CVector4f{vec2.x + sinT + cosT, vec2.y, vec2.z + cosT - sinT, 1.f}; - inst.pos[1] = zeus::CVector4f{vec2.x + sinT - cosT, vec2.y, vec2.z + sinT + cosT, 1.f}; - inst.pos[2] = zeus::CVector4f{vec2.x + (cosT - sinT), vec2.y, vec2.z + (-cosT - sinT), 1.f}; - inst.pos[3] = zeus::CVector4f{vec2.x - (sinT + cosT), vec2.y, vec2.z - (cosT - sinT), 1.f}; + inst.pos[0] = zeus::CVector4f{vec2.x() + sinT + cosT, vec2.y(), vec2.z() + cosT - sinT, 1.f}; + inst.pos[1] = zeus::CVector4f{vec2.x() + sinT - cosT, vec2.y(), vec2.z() + sinT + cosT, 1.f}; + inst.pos[2] = zeus::CVector4f{vec2.x() + (cosT - sinT), vec2.y(), vec2.z() + (-cosT - sinT), 1.f}; + inst.pos[3] = zeus::CVector4f{vec2.x() - (sinT + cosT), vec2.y(), vec2.z() - (cosT - sinT), 1.f}; inst.color = particle.x34_color; break; } @@ -1919,8 +1919,8 @@ void CElementGen::RenderParticlesIndirectTexture() tind->GetValueUV(partFrame, uvsInd); float size = 0.5f * particle.x2c_lineLengthOrSize; - zeus::CVector3f p1 = {viewPoint.x - size, viewPoint.y, viewPoint.z - size}; - zeus::CVector3f p2 = {viewPoint.x + size, viewPoint.y, viewPoint.z + size}; + zeus::CVector3f p1 = {viewPoint.x() - size, viewPoint.y(), viewPoint.z() - size}; + zeus::CVector3f p2 = {viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size}; SClipScreenRect clipRect = CGraphics::ClipScreenRectFromMS(p1, p2); if (!clipRect.x0_valid) @@ -1930,10 +1930,10 @@ void CElementGen::RenderParticlesIndirectTexture() g_instIndTexData.emplace_back(); SParticleInstanceIndTex& inst = g_instIndTexData.back(); - inst.pos[0] = zeus::CVector4f{viewPoint.x + size, viewPoint.y, viewPoint.z + size, 1.f}; - inst.pos[1] = zeus::CVector4f{viewPoint.x - size, viewPoint.y, viewPoint.z + size, 1.f}; - inst.pos[2] = zeus::CVector4f{viewPoint.x + size, viewPoint.y, viewPoint.z - size, 1.f}; - inst.pos[3] = zeus::CVector4f{viewPoint.x - size, viewPoint.y, viewPoint.z - size, 1.f}; + inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f}; + inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f}; + inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f}; + inst.pos[3] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() - size, 1.f}; inst.color = particle.x34_color; inst.texrTindUVs[0] = zeus::CVector4f{uvs.xMax, uvs.yMax, uvsInd.xMax, uvsInd.yMax}; inst.texrTindUVs[1] = zeus::CVector4f{uvs.xMin, uvs.yMax, uvsInd.xMin, uvsInd.yMax}; diff --git a/Runtime/Particle/CElementGen.hpp b/Runtime/Particle/CElementGen.hpp index 4677e74f0..684c0ed8a 100644 --- a/Runtime/Particle/CElementGen.hpp +++ b/Runtime/Particle/CElementGen.hpp @@ -155,7 +155,7 @@ private: std::unique_ptr m_lineRenderer; CElementGenShaders::EShaderClass m_shaderClass; - void AccumulateBounds(zeus::CVector3f& pos, float size); + void AccumulateBounds(const zeus::CVector3f& pos, float size); public: CElementGen(const TToken& gen, diff --git a/Runtime/Particle/CEmitterElement.cpp b/Runtime/Particle/CEmitterElement.cpp index 78a5fc6f9..30eb231e9 100644 --- a/Runtime/Particle/CEmitterElement.cpp +++ b/Runtime/Particle/CEmitterElement.cpp @@ -64,9 +64,9 @@ bool CVEAngleSphere::GetValue(int frame, zeus::CVector3f& pPos, zeus::CVector3f& e = zeus::degToRad(e + ((0.5f * (g * rand->Float())) - g)); float cosD = std::cos(d); - pPos.x = a.x + (b * (-std::sin(e) * cosD)); - pPos.y = a.y + (b * std::sin(d)); - pPos.z = a.z + (b * (cosD * cosD)); + pPos.x() = a.x() + (b * (-std::sin(e) * cosD)); + pPos.y() = a.y() + (b * std::sin(d)); + pPos.z() = a.z() + (b * (cosD * cosD)); zeus::CVector3f normVec = (pPos - a).normalized(); float c; diff --git a/Runtime/Particle/CFlameWarp.cpp b/Runtime/Particle/CFlameWarp.cpp index 16e234373..75a536eff 100644 --- a/Runtime/Particle/CFlameWarp.cpp +++ b/Runtime/Particle/CFlameWarp.cpp @@ -18,7 +18,7 @@ void CFlameWarp::ModifyParticles(std::vector& particles) u8 idx = 0; for (CParticle& particle : particles) { - float transp = 1.f - particle.x34_color.a; + float transp = 1.f - particle.x34_color.a(); if (transp > maxTransp) { float distSq = (particle.x4_pos - x74_warpPoint).magSquared(); diff --git a/Runtime/Particle/CModVectorElement.cpp b/Runtime/Particle/CModVectorElement.cpp index 1f9075304..55bdd05fb 100644 --- a/Runtime/Particle/CModVectorElement.cpp +++ b/Runtime/Particle/CModVectorElement.cpp @@ -159,9 +159,11 @@ bool CMVEBounce::GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPo bool CMVEConstant::GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& /*pPos*/) const { - x4_x->GetValue(frame, pVel.x); - x8_y->GetValue(frame, pVel.y); - xc_z->GetValue(frame, pVel.z); + float x, y, z; + x4_x->GetValue(frame, x); + x8_y->GetValue(frame, y); + xc_z->GetValue(frame, z); + pVel.assign(x, y, z); return false; } diff --git a/Runtime/Particle/CParticleElectric.cpp b/Runtime/Particle/CParticleElectric.cpp index 40f1374cd..36ddd5e6a 100644 --- a/Runtime/Particle/CParticleElectric.cpp +++ b/Runtime/Particle/CParticleElectric.cpp @@ -352,7 +352,7 @@ void CParticleElectric::CalculatePoints() if (x1c_elecDesc->x70_ZERY) for (int i=0 ; iGetValue(frame, a); - valOut = a.r; + valOut = a.r(); return false; } @@ -380,7 +380,7 @@ bool CREGetComponentGreen::GetValue(int frame, float& valOut) const { zeus::CColor a = zeus::CColor::skBlack; x4_a->GetValue(frame, a); - valOut = a.g; + valOut = a.g(); return false; } @@ -388,7 +388,7 @@ bool CREGetComponentBlue::GetValue(int frame, float& valOut) const { zeus::CColor a = zeus::CColor::skBlack; x4_a->GetValue(frame, a); - valOut = a.b; + valOut = a.b(); return false; } @@ -396,7 +396,7 @@ bool CREGetComponentAlpha::GetValue(int frame, float& valOut) const { zeus::CColor a = zeus::CColor::skBlack; x4_a->GetValue(frame, a); - valOut = a.a; + valOut = a.a(); return false; } diff --git a/Runtime/Particle/CVectorElement.cpp b/Runtime/Particle/CVectorElement.cpp index a06192e53..2a6388a5b 100644 --- a/Runtime/Particle/CVectorElement.cpp +++ b/Runtime/Particle/CVectorElement.cpp @@ -67,7 +67,7 @@ CVECone::CVECone(std::unique_ptr&& a, std::unique_ptrGetValue(0, av); zeus::CVector3f avNorm = av.normalized(); - if (avNorm.x > 0.8) + if (avNorm.x() > 0.8f) xc_xVec = av.cross(zeus::CVector3f(0.f, 1.f, 0.f)); else xc_xVec = av.cross(zeus::CVector3f(1.f, 0.f, 0.f)); @@ -286,21 +286,21 @@ bool CVEParticleLocation::GetValue(int /*frame*/, zeus::CVector3f& valOut) const bool CVEParticleSystemOrientationFront::GetValue(int /*frame*/, zeus::CVector3f& valOut) const { zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed(); - valOut.assign(trans.vec[0].y, trans.vec[1].y, trans.vec[2].y); + valOut.assign(trans.m[0].y(), trans.m[1].y(), trans.m[2].y()); return false; } bool CVEParticleSystemOrientationUp::GetValue(int /*frame*/, zeus::CVector3f& valOut) const { zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed(); - valOut.assign(trans.vec[0].z, trans.vec[1].z, trans.vec[2].z); + valOut.assign(trans.m[0].z(), trans.m[1].z(), trans.m[2].z()); return false; } bool CVEParticleSystemOrientationRight::GetValue(int /*frame*/, zeus::CVector3f& valOut) const { zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed(); - valOut.assign(trans.vec[0].x, trans.vec[1].x, trans.vec[2].x); + valOut.assign(trans.m[0].x(), trans.m[1].x(), trans.m[2].x()); return false; } @@ -323,7 +323,7 @@ bool CVEColorToVector::GetValue(int frame, zeus::CVector3f &valOut) const { zeus::CColor val = {0.0f, 0.0f, 0.0f, 1.0f}; x4_a->GetValue(frame, val); - valOut = zeus::CVector3f{val.r, val.g, val.b}; + valOut = zeus::CVector3f{val.mSimd}; return false; } diff --git a/Runtime/Weapon/CBomb.cpp b/Runtime/Weapon/CBomb.cpp index 2af600825..e484c5dd4 100644 --- a/Runtime/Weapon/CBomb.cpp +++ b/Runtime/Weapon/CBomb.cpp @@ -152,12 +152,12 @@ void CBomb::Touch(CActor&, urde::CStateManager&) std::experimental::optional CBomb::GetTouchBounds() const { float radius = (x190_24_isNotDetonated ? 0.2f : x12c_curDamageInfo.GetRadius()); - float minX = (x170_prevLocation.x >= GetTranslation().x ? x170_prevLocation.x : GetTranslation().x) - radius; - float minY = (x170_prevLocation.y >= GetTranslation().y ? x170_prevLocation.y : GetTranslation().y) - radius; - float minZ = (x170_prevLocation.z >= GetTranslation().z ? x170_prevLocation.z : GetTranslation().z) - radius; - float maxX = (x170_prevLocation.x >= GetTranslation().x ? x170_prevLocation.x : GetTranslation().x) + radius; - float maxY = (x170_prevLocation.y >= GetTranslation().y ? x170_prevLocation.y : GetTranslation().y) + radius; - float maxZ = (x170_prevLocation.z >= GetTranslation().z ? x170_prevLocation.z : GetTranslation().z) + radius; + float minX = (x170_prevLocation.x() >= GetTranslation().x() ? x170_prevLocation.x() : GetTranslation().x()) - radius; + float minY = (x170_prevLocation.y() >= GetTranslation().y() ? x170_prevLocation.y() : GetTranslation().y()) - radius; + float minZ = (x170_prevLocation.z() >= GetTranslation().z() ? x170_prevLocation.z() : GetTranslation().z()) - radius; + float maxX = (x170_prevLocation.x() >= GetTranslation().x() ? x170_prevLocation.x() : GetTranslation().x()) + radius; + float maxY = (x170_prevLocation.y() >= GetTranslation().y() ? x170_prevLocation.y() : GetTranslation().y()) + radius; + float maxZ = (x170_prevLocation.z() >= GetTranslation().z() ? x170_prevLocation.z() : GetTranslation().z()) + radius; return {{minX, minY, minZ, maxX, maxY, maxZ}}; } diff --git a/Runtime/Weapon/CBurstFire.cpp b/Runtime/Weapon/CBurstFire.cpp index 565683951..25363df3b 100644 --- a/Runtime/Weapon/CBurstFire.cpp +++ b/Runtime/Weapon/CBurstFire.cpp @@ -88,8 +88,8 @@ zeus::CVector3f CBurstFire::GetError(float xMag, float zMag) const if (r0 > 0) { float angle = r0 * zeus::degToRad(-22.5f); - ret.x = std::cos(angle) * xMag; - ret.z = std::sin(angle) * zMag; + ret.x() = std::cos(angle) * xMag; + ret.z() = std::sin(angle) * zMag; } } return ret; diff --git a/Runtime/Weapon/CGameProjectile.cpp b/Runtime/Weapon/CGameProjectile.cpp index 4948edd6a..55fe63f47 100644 --- a/Runtime/Weapon/CGameProjectile.cpp +++ b/Runtime/Weapon/CGameProjectile.cpp @@ -167,12 +167,12 @@ void CGameProjectile::Chase(float dt, CStateManager& mgr) if (!swarm && !TCastToConstPtr(act.GetPtr())) if (auto tb = act->GetTouchBounds()) - projToPos.z += (tb->max.z - tb->min.z) * 0.5f; + projToPos.z() += (tb->max.z() - tb->min.z()) * 0.5f; zeus::CQuaternion qDelta = zeus::CQuaternion::shortestRotationArc(x170_projectile.GetTransform().basis[1], projToPos); - float wThres = qDelta.w * qDelta.w * 2.f - 1.f; + float wThres = qDelta.w() * qDelta.w() * 2.f - 1.f; if (wThres > 0.99f) return; @@ -527,12 +527,12 @@ CProjectileTouchResult CGameProjectile::CanCollideWithTrigger(CActor& act, CStat zeus::CAABox CGameProjectile::GetProjectileBounds() const { - return {{std::min(x298_lastOrigin.x, GetTranslation().x) - x2a4_projExtent, - std::min(x298_lastOrigin.y, GetTranslation().y) - x2a4_projExtent, - std::min(x298_lastOrigin.z, GetTranslation().z) - x2a4_projExtent}, - {std::max(x298_lastOrigin.x, GetTranslation().x) + x2a4_projExtent, - std::max(x298_lastOrigin.y, GetTranslation().y) + x2a4_projExtent, - std::max(x298_lastOrigin.z, GetTranslation().z) + x2a4_projExtent}}; + return {{std::min(x298_lastOrigin.x(), GetTranslation().x()) - x2a4_projExtent, + std::min(x298_lastOrigin.y(), GetTranslation().y()) - x2a4_projExtent, + std::min(x298_lastOrigin.z(), GetTranslation().z()) - x2a4_projExtent}, + {std::max(x298_lastOrigin.x(), GetTranslation().x()) + x2a4_projExtent, + std::max(x298_lastOrigin.y(), GetTranslation().y()) + x2a4_projExtent, + std::max(x298_lastOrigin.z(), GetTranslation().z()) + x2a4_projExtent}}; } std::experimental::optional CGameProjectile::GetTouchBounds() const diff --git a/Runtime/Weapon/CGunWeapon.cpp b/Runtime/Weapon/CGunWeapon.cpp index d0cf8de52..77ceb6a3a 100644 --- a/Runtime/Weapon/CGunWeapon.cpp +++ b/Runtime/Weapon/CGunWeapon.cpp @@ -331,7 +331,7 @@ void CGunWeapon::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::CT if (mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot && x200_beamId != CPlayerState::EBeamId::Ice) { /* Hot Draw */ - zeus::CColor mulColor(flags.x4_color.a, flags.x4_color.a); + zeus::CColor mulColor(flags.x4_color.a(), flags.x4_color.a()); zeus::CColor addColor(0.25f, 0.25f); if (x218_29_drawHologram) { @@ -457,7 +457,7 @@ void CGunWeapon::LoadProjectileData(CStateManager& mgr) trat->GetValue(0, tratVal); x1d0_velInfo.x24_trat.push_back(tratVal); x1d0_velInfo.x1c_targetHoming.push_back(x144_weapons[i]->x29_HOMG); - if (weaponVel.y > 0.f) + if (weaponVel.y() > 0.f) x1d0_velInfo.x0_vel.back() *= zeus::CVector3f(60.f); else x1d0_velInfo.x0_vel.back() = zeus::CVector3f::skForward; diff --git a/Runtime/Weapon/CPhazonBeam.cpp b/Runtime/Weapon/CPhazonBeam.cpp index a087df4f7..12d259531 100644 --- a/Runtime/Weapon/CPhazonBeam.cpp +++ b/Runtime/Weapon/CPhazonBeam.cpp @@ -12,10 +12,10 @@ namespace urde CPhazonBeam::CPhazonBeam(CAssetId characterId, EWeaponType type, TUniqueId playerId, EMaterialTypes playerMaterial, const zeus::CVector3f& scale) : CGunWeapon(characterId, type, playerId, playerMaterial, scale), - x238_aaBoxScale(zeus::CVector3f(-0.14664599f, 0.f, -0.14909725f) * scale.y, - zeus::CVector3f(0.14664599f, 0.64619601f, 0.14909725f) * scale.y), - x250_aaBoxTranslate(zeus::CVector3f(-0.0625f, 0.f, -0.09375f) * scale.y, - zeus::CVector3f(0.0625f, -0.25f, 0.09375f) * scale.y) + x238_aaBoxScale(zeus::CVector3f(-0.14664599f, 0.f, -0.14909725f) * scale.y(), + zeus::CVector3f(0.14664599f, 0.64619601f, 0.14909725f) * scale.y()), + x250_aaBoxTranslate(zeus::CVector3f(-0.0625f, 0.f, -0.09375f) * scale.y(), + zeus::CVector3f(0.0625f, -0.25f, 0.09375f) * scale.y()) { x21c_phazonVeins = g_SimplePool->GetObj("PhazonVeins"); x228_phazon2nd1 = g_SimplePool->GetObj("Phazon2nd_1"); @@ -160,7 +160,7 @@ void CPhazonBeam::Update(float dt, CStateManager& mgr) } else if (x274_26_veinsAlphaActive) { - x270_indirectAlpha = x10_solidModelData->GetLocatorTransform("phazonScale_LCTR_SDK").origin.y; + x270_indirectAlpha = x10_solidModelData->GetLocatorTransform("phazonScale_LCTR_SDK").origin.y(); } } diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 02b98bbf9..bf479ae5f 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -145,7 +145,7 @@ void CPlayerGun::TakeDamage(bool bigStrike, bool notFromMetroid, CStateManager& if (x678_morph.GetGunState() == CGunMorph::EGunState::OutWipeDone) { zeus::CVector3f localDamageLoc = mgr.GetPlayer().GetTransform().transposeRotate(x3dc_damageLocation); - angle = zeus::CRelAngle(std::atan2(localDamageLoc.y, localDamageLoc.x)).asDegrees(); + angle = zeus::CRelAngle(std::atan2(localDamageLoc.y(), localDamageLoc.x())).asDegrees(); hasStrikeAngle = true; } } @@ -809,7 +809,7 @@ void CPlayerGun::CancelFiring(CStateManager& mgr) float CPlayerGun::GetBeamVelocity() const { if (x72c_currentBeam->IsLoaded()) - return x72c_currentBeam->GetVelocityInfo().GetVelocity(int(x330_chargeState)).y; + return x72c_currentBeam->GetVelocityInfo().GetVelocity(int(x330_chargeState)).y(); return 10.f; } @@ -2538,7 +2538,7 @@ void CPlayerGun::Render(const CStateManager& mgr, const zeus::CVector3f& pos, co mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Thermal ? kHandThermalFlag : kHandHoloFlag); x72c_currentBeam->DrawHologram(mgr, offsetWorldXf, CModelFlags(0, 0, 3, zeus::CColor::skWhite)); - DrawScreenTex(ConvertToScreenSpace(morphXf.origin, *cam).z); + DrawScreenTex(ConvertToScreenSpace(morphXf.origin, *cam).z()); if (x0_lights.HasShadowLight()) x82c_shadow->EnableModelProjectedShadow(offsetWorldXf, x0_lights.GetShadowLightArrIndex(), 2.15f); CGraphics::SetModelMatrix(morphXf); @@ -2594,8 +2594,8 @@ void CPlayerGun::DropBomb(EBWeapon weapon, CStateManager& mgr) return; zeus::CVector3f plPos = mgr.GetPlayer().GetTranslation(); - zeus::CTransform xf = zeus::CTransform::Translate({plPos.x, - plPos.y, plPos.z + g_tweakPlayer->GetPlayerBallHalfExtent()}); + zeus::CTransform xf = zeus::CTransform::Translate({plPos.x(), + plPos.y(), plPos.z() + g_tweakPlayer->GetPlayerBallHalfExtent()}); CBomb* bomb = new CBomb(x784_bombEffects[u32(weapon)][0], x784_bombEffects[u32(weapon)][1], mgr.AllocateUniqueId(), mgr.GetPlayer().GetAreaId(), x538_playerId, x354_bombFuseTime, xf,g_tweakPlayerGun->GetBombInfo()); @@ -2622,9 +2622,9 @@ TUniqueId CPlayerGun::DropPowerBomb(CStateManager& mgr) TUniqueId uid = mgr.AllocateUniqueId(); zeus::CVector3f plVec = mgr.GetPlayer().GetTranslation(); - zeus::CTransform xf = zeus::CTransform::Translate({plVec.x, - plVec.y, - plVec.z + g_tweakPlayer->GetPlayerBallHalfExtent()}); + zeus::CTransform xf = zeus::CTransform::Translate({plVec.x(), + plVec.y(), + plVec.z() + g_tweakPlayer->GetPlayerBallHalfExtent()}); CPowerBomb* pBomb = new CPowerBomb(x784_bombEffects[1][0], uid, kInvalidAreaId, x538_playerId, xf, dInfo); mgr.AddObject(*pBomb); return uid; diff --git a/Runtime/Weapon/CProjectileWeapon.cpp b/Runtime/Weapon/CProjectileWeapon.cpp index 92692927f..6899a05f7 100644 --- a/Runtime/Weapon/CProjectileWeapon.cpp +++ b/Runtime/Weapon/CProjectileWeapon.cpp @@ -62,9 +62,9 @@ CProjectileWeapon::CProjectileWeapon(const TToken& wDesc, co zeus::CTransform xf; zeus::CVector3f orn; iorn->GetValue(0, orn); - xf.rotateLocalX(zeus::degToRad(orn.x)); - xf.rotateLocalY(zeus::degToRad(orn.y)); - xf.rotateLocalZ(zeus::degToRad(orn.z)); + xf.rotateLocalX(zeus::degToRad(orn.x())); + xf.rotateLocalY(zeus::degToRad(orn.y())); + xf.rotateLocalZ(zeus::degToRad(orn.z())); SetRelativeOrientation(xf); } else @@ -435,9 +435,9 @@ void CProjectileWeapon::UpdatePSTranslationAndOrientation() psov->GetValue(xf4_curFrame, orient); zeus::CTransform xf = x44_localXf; - xf.rotateLocalX(zeus::degToRad(orient.x)); - xf.rotateLocalY(zeus::degToRad(orient.y)); - xf.rotateLocalZ(zeus::degToRad(orient.z)); + xf.rotateLocalX(zeus::degToRad(orient.x())); + xf.rotateLocalY(zeus::degToRad(orient.y())); + xf.rotateLocalZ(zeus::degToRad(orient.z())); SetRelativeOrientation(xf); } diff --git a/Runtime/Weapon/CWeapon.cpp b/Runtime/Weapon/CWeapon.cpp index b3f2f9f5c..a0e2ecf46 100644 --- a/Runtime/Weapon/CWeapon.cpp +++ b/Runtime/Weapon/CWeapon.cpp @@ -91,7 +91,7 @@ void CWeapon::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager if (doRipple) { zeus::CVector3f pos = GetTranslation(); - pos.z = water.GetTriggerBoundsWR().max.z; + pos.z() = float(water.GetTriggerBoundsWR().max.z()); if ((xe8_projectileAttribs & EProjectileAttrib::ComboShot) != EProjectileAttrib::None) { if (!water.CanRippleAtPoint(pos)) diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 4c978d8ca..28438fac4 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -255,8 +255,8 @@ void CActor::RenderInternal(const CStateManager& mgr) const addMag = 1.f; } - zeus::CColor mulColor(mulMag * xb4_drawFlags.x4_color.a, xb4_drawFlags.x4_color.a); - zeus::CColor addColor(addMag, xb4_drawFlags.x4_color.a / 4.f); + zeus::CColor mulColor(mulMag * xb4_drawFlags.x4_color.a(), xb4_drawFlags.x4_color.a()); + zeus::CColor addColor(addMag, xb4_drawFlags.x4_color.a() / 4.f); x64_modelData->RenderThermal(x34_transform, mulColor, addColor, xb4_drawFlags); return; } @@ -367,8 +367,8 @@ zeus::CVector3f CActor::GetScanObjectIndicatorPosition(const CStateManager& mgr) const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); zeus::CVector3f orbitPos = GetOrbitPosition(mgr); float camToOrbitPos = (cam->GetTranslation() - orbitPos).magnitude(); - zeus::CVector3f boundsExtent = x9c_renderBounds.max - x9c_renderBounds.min; - float distFac = std::min(std::max(boundsExtent.x, std::max(boundsExtent.y, boundsExtent.z)) * 0.5f, + const zeus::CVector3f boundsExtent = x9c_renderBounds.max - x9c_renderBounds.min; + float distFac = std::min(std::max(boundsExtent.x(), std::max(boundsExtent.y(), boundsExtent.z())) * 0.5f, camToOrbitPos - cam->GetNearClipDistance() - 0.1f); return orbitPos - (orbitPos - cam->GetTranslation()).normalized() * distFac; } diff --git a/Runtime/World/CActorModelParticles.cpp b/Runtime/World/CActorModelParticles.cpp index b4be67e25..000112499 100644 --- a/Runtime/World/CActorModelParticles.cpp +++ b/Runtime/World/CActorModelParticles.cpp @@ -14,6 +14,14 @@ namespace urde { + +static bool IsMediumOrLarge(CActor& act) +{ + if (TCastToConstPtr pat = act) + return pat->GetKnockBackController().GetVariant() != EKnockBackVariant::Small; + return false; +} + CActorModelParticles::CItem::CItem(const CEntity& ent, CActorModelParticles& parent) : x0_id(ent.GetUniqueId()), x4_areaId(ent.GetAreaIdAlways()), xdc_ashy(parent.x48_ashy), x128_parent(parent) @@ -119,17 +127,207 @@ void CActorModelParticles::CItem::GeneratePoints(const std::vector= 4) + r26 = false; + } + if (r26) + { + for (auto& p : x8_thermalHotParticles) + { + if (!p.first) + { + p.second = mgr.GetActiveRandom()->Next(); + p.first = x128_parent.MakeOnFireGen(); + x6c_onFireDelayTimer = 0.3f; + break; + } + } + } + if (!x74_sfx) + { + x74_sfx = CSfxManager::AddEmitter(SFXsfx0480 + (IsMediumOrLarge(*actor) ? 1 : 0), + actor->GetTranslation(), zeus::CVector3f::skZero, true, true, 0x7f, kInvalidAreaId); + } + x70_onFire = false; + } + for (auto& p : x8_thermalHotParticles) + { + if (p.first) + { + if (p.first->IsSystemDeletable()) + p.first.reset(); + else if (actor) + p.first->SetGlobalOrientAndTrans(actor->GetTransform()); + p.first->Update(dt); + r30 = true; + r31 = true; + } + } + } + else + { + r30 = true; + } + } + if (x74_sfx) + { + if (r31) + { + CSfxManager::UpdateEmitter(x74_sfx, xf8_.origin, zeus::CVector3f::skZero, 1.f); + } + else + { + CSfxManager::RemoveEmitter(x74_sfx); + x74_sfx.reset(); + } + } + if (!r30) + { + Unlock(EDependency::OnFire); + } + return r30; +} + +bool CActorModelParticles::CItem::UpdateAsh(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::sub_801e65bc(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::UpdateFirePop(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::UpdateElectric(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::sub_801e69f0(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::sub_801e5e98(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::UpdateIcePop(float dt, CActor* actor, CStateManager& mgr) +{ + return false; +} + +bool CActorModelParticles::CItem::Update(float dt, CStateManager& mgr) +{ + CActor* act = static_cast(mgr.ObjectById(x0_id)); + if (act && act->HasModelData() && !act->ModelData()->IsNull()) + { + xec_ = act->ModelData()->GetScale(); + xf8_ = act->GetTransform(); + x4_areaId = act->GetAreaIdAlways(); + } + else + { + x0_id = kInvalidUniqueId; + x84_ = 0; + xb0_ = -1; + if (xc0_particleElectric) + xc0_particleElectric->SetParticleEmission(false); + if (x74_sfx) + { + CSfxManager::RemoveEmitter(x74_sfx); + x74_sfx.reset(); + } + x130_ -= dt; + if (x130_ <= 0.f) + return false; + } + bool ret = false; + if (UpdateOnFire(dt, act, mgr)) + ret = true; + if (UpdateAsh(dt, act, mgr)) + ret = true; + if (sub_801e65bc(dt, act, mgr)) + ret = true; + if (UpdateFirePop(dt, act, mgr)) + ret = true; + if (UpdateElectric(dt, act, mgr)) + ret = true; + if (sub_801e69f0(dt, act, mgr)) + ret = true; + if (sub_801e5e98(dt, act, mgr)) + ret = true; + if (UpdateIcePop(dt, act, mgr)) + ret = true; + return ret; +} + +void CActorModelParticles::CItem::Lock(EDependency d) +{ + if (!(x134_lockDeps & (1 << int(d)))) { x128_parent.IncrementDependency(d); - x134_bits |= (1 << int(d)); + x134_lockDeps |= (1 << int(d)); + } +} + +void CActorModelParticles::CItem::Unlock(EDependency d) +{ + if (x134_lockDeps & (1 << int(d))) + { + x128_parent.DecrementDependency(d); + x134_lockDeps &= ~(1 << int(d)); + } +} + +void CActorModelParticles::DecrementDependency(EDependency d) +{ + Dependency& dep = x50_dgrps[int(d)]; + dep.Decrement(); + if (dep.x10_refCount == 0) + { + xe4_bits &= ~(1 << int(d)); + xe6_bits2 &= ~(1 << int(d)); + xe5_bits1 &= ~(1 << int(d)); } } @@ -305,8 +503,10 @@ std::list::iterator CActorModelParticles::FindOrCre return x0_items.emplace(x0_items.end(), act, *this); } -void CActorModelParticles::StartIce(CActor& actor) +void CActorModelParticles::StartIce(CActor& act) { + auto iter = FindOrCreateSystem(act); + iter->Lock(EDependency::Ash); } void CActorModelParticles::StartElectric(CActor& act) @@ -326,6 +526,18 @@ void CActorModelParticles::StopElectric(CActor& act) } } +void CActorModelParticles::sub_801e51d0(CActor& act) +{ + auto iter = FindOrCreateSystem(act); + if (!iter->xc0_particleElectric) + iter->Lock(EDependency::IcePop); + else + { + if (!iter->xc0_particleElectric->GetParticleEmission()) + iter->xc0_particleElectric->SetParticleEmission(true); + } +} + void CActorModelParticles::StopThermalHotParticles(CActor& act) { if (act.GetPointGeneratorParticles()) @@ -340,13 +552,6 @@ void CActorModelParticles::StopThermalHotParticles(CActor& act) } } -static bool IsMediumOrLarge(CActor& act) -{ - if (TCastToConstPtr pat = act) - return pat->GetKnockBackController().GetVariant() != EKnockBackVariant::Small; - return false; -} - void CActorModelParticles::StartBurnDeath(CActor& act) { auto iter = FindOrCreateSystem(act); @@ -358,25 +563,25 @@ void CActorModelParticles::StartBurnDeath(CActor& act) void CActorModelParticles::EnsureElectricLoaded(CActor& act) { auto iter = FindOrCreateSystem(act); - iter->EnsureLoaded(EDependency::Electric); + iter->Lock(EDependency::Electric); } void CActorModelParticles::EnsureFirePopLoaded(CActor& act) { auto iter = FindOrCreateSystem(act); - iter->EnsureLoaded(EDependency::FirePop); + iter->Lock(EDependency::FirePop); } void CActorModelParticles::EnsureIceBreakLoaded(CActor& act) { auto iter = FindOrCreateSystem(act); - iter->EnsureLoaded(EDependency::IceBreak); + iter->Lock(EDependency::IceBreak); } void CActorModelParticles::LightDudeOnFire(CActor& act) { auto iter = FindOrCreateSystem(act); - iter->EnsureLoaded(EDependency::OnFire); + iter->Lock(EDependency::OnFire); if (iter->x6c_onFireDelayTimer <= 0.f) iter->x70_onFire = true; } diff --git a/Runtime/World/CActorModelParticles.hpp b/Runtime/World/CActorModelParticles.hpp index 2d174b609..cb99e34fc 100644 --- a/Runtime/World/CActorModelParticles.hpp +++ b/Runtime/World/CActorModelParticles.hpp @@ -68,12 +68,22 @@ public: u16 _dummy = 0; }; float x130_ = 10.f; - u8 x134_bits = 0; + u8 x134_lockDeps = 0; + void sub_801e59a8(EDependency i); + bool UpdateOnFire(float dt, CActor* actor, CStateManager& mgr); + bool UpdateAsh(float dt, CActor* actor, CStateManager& mgr); + bool sub_801e65bc(float dt, CActor* actor, CStateManager& mgr); + bool UpdateFirePop(float dt, CActor* actor, CStateManager& mgr); + bool UpdateElectric(float dt, CActor* actor, CStateManager& mgr); + bool sub_801e69f0(float dt, CActor* actor, CStateManager& mgr); + bool sub_801e5e98(float dt, CActor* actor, CStateManager& mgr); + bool UpdateIcePop(float dt, CActor* actor, CStateManager& mgr); public: CItem(const CEntity& ent, CActorModelParticles& parent); void GeneratePoints(const std::vector>& vn); - void Update(float, CStateManager&); - void EnsureLoaded(EDependency i); + bool Update(float dt, CStateManager& mgr); + void Lock(EDependency i); + void Unlock(EDependency i); }; private: @@ -124,6 +134,7 @@ private: }; rstl::reserved_vector x50_dgrps; u8 xe4_bits = 0; + u8 xe5_bits1 = 0; u8 xe6_bits2 = 0; Dependency GetParticleDGRPTokens(const char* name); @@ -136,6 +147,7 @@ private: std::unique_ptr MakeIcePopGen() const; std::unique_ptr MakeElectricGen() const; + void DecrementDependency(EDependency d); void IncrementDependency(EDependency d); public: CActorModelParticles(); @@ -152,6 +164,7 @@ public: void Render(const CActor& actor) const; void StartElectric(CActor& act); void StopElectric(CActor& act); + void sub_801e51d0(CActor& act); void StopThermalHotParticles(CActor& act); void StartBurnDeath(CActor& act); void EnsureElectricLoaded(CActor& act); diff --git a/Runtime/World/CAi.cpp b/Runtime/World/CAi.cpp index 4533f8e3b..f97a931bc 100644 --- a/Runtime/World/CAi.cpp +++ b/Runtime/World/CAi.cpp @@ -70,7 +70,7 @@ void CAi::FluidFXThink(EFluidState state, CScriptWater& water, urde::CStateManag if (vel > 500.f) { zeus::CVector3f pos = x34_transform.origin; - pos.z = water.GetTriggerBoundsWR().max.z; + pos.z() = float(water.GetTriggerBoundsWR().max.z()); mgr.GetFluidPlaneManager()->CreateSplash(GetUniqueId(), mgr, water, pos, 0.1f + ((0.4f * zeus::min(vel, 30000.f) - 500.f) / 29500.f), true); @@ -83,7 +83,7 @@ void CAi::FluidFXThink(EFluidState state, CScriptWater& water, urde::CStateManag zeus::CVector3f pos = x34_transform.origin; zeus::CVector3f center = pos; - center.z = water.GetTriggerBoundsWR().max.z; + center.z() = float(water.GetTriggerBoundsWR().max.z()); pos.normalize(); water.GetFluidPlane().AddRipple(GetMass(), GetUniqueId(), center, GetVelocity(), water, mgr, pos); } diff --git a/Runtime/World/CEnvFxManager.cpp b/Runtime/World/CEnvFxManager.cpp index 37d5f5656..bd4053010 100644 --- a/Runtime/World/CEnvFxManager.cpp +++ b/Runtime/World/CEnvFxManager.cpp @@ -273,14 +273,14 @@ void CEnvFxManager::UpdateBlockedGrids(CStateManager& mgr, EEnvFxType type, cons } } ++blockedGrids; - grid.x14_block = std::make_pair(result.IsValid(), result.GetPoint().z); + grid.x14_block = std::make_pair(result.IsValid(), result.GetPoint().z()); } grid.x0_24_blockDirty = false; } zeus::CVector2i gridEnd = grid.x4_position + grid.xc_extent; if (localPlayerPos.x >= grid.x4_position.x && localPlayerPos.y >= grid.x4_position.y && localPlayerPos.x < gridEnd.x && localPlayerPos.y < gridEnd.y && grid.x14_block.first && - grid.x14_block.second <= playerPos.z) + grid.x14_block.second <= playerPos.z()) { x24_enableSplash = true; x2c_lastBlockedGridIdx = i; @@ -349,7 +349,7 @@ void CEnvFxManager::UpdateSnowParticles(const rstl::reserved_vectorx1c_particles.rbegin(); pit != it->x1c_particles.rend(); ++pit) pit->z = s16((pit->z + deltaZ) & 0x3fff); @@ -391,14 +391,14 @@ void CEnvFxManager::Update(float dt, CStateManager& mgr) zeus::CVector3f pbtws = GetParticleBoundsToWorldScale(); zeus::CVector3f oopbtws = 1.f / pbtws; zeus::CVector3f forwardPoint = camXf.basis[1] * 23.8125f + camXf.origin; - float modX = std::fmod(forwardPoint.x, 7.9375f); - float modY = std::fmod(forwardPoint.y, 7.9375f); - s32 moveX = (x18_focusCellPosition.x - (forwardPoint.x - modX)) / 7.9375f; - x18_focusCellPosition.x = forwardPoint.x - modX; - s32 moveY = (x18_focusCellPosition.y - (forwardPoint.y - modY)) / 7.9375f; - x18_focusCellPosition.y = forwardPoint.y - modY; - float deltaZ = x18_focusCellPosition.z - forwardPoint.z; - x18_focusCellPosition.z = forwardPoint.z; + float modX = std::fmod(forwardPoint.x(), 7.9375f); + float modY = std::fmod(forwardPoint.y(), 7.9375f); + s32 moveX = (x18_focusCellPosition.x() - (forwardPoint.x() - modX)) / 7.9375f; + x18_focusCellPosition.x() = forwardPoint.x() - modX; + s32 moveY = (x18_focusCellPosition.y() - (forwardPoint.y() - modY)) / 7.9375f; + x18_focusCellPosition.y() = forwardPoint.y() - modY; + float deltaZ = x18_focusCellPosition.z() - forwardPoint.z(); + x18_focusCellPosition.z() = float(forwardPoint.z()); MoveWrapCells(moveX, moveY); CVectorFixed8_8 zVec(oopbtws * zeus::CVector3f(0.f, 0.f, deltaZ)); if (fxType == EEnvFxType::UnderwaterFlake) @@ -432,8 +432,8 @@ void CEnvFxManager::Update(float dt, CStateManager& mgr) static zeus::CColor GetFlakeColor(const zeus::CMatrix4f& mvp, const CEnvFxShaders::Instance& inst) { - float screenHeight = std::fabs(mvp.multiplyOneOverW(inst.positions[1]).y - - mvp.multiplyOneOverW(inst.positions[0]).y) / 2.f; + float screenHeight = std::fabs(mvp.multiplyOneOverW(inst.positions[1]).y() - + mvp.multiplyOneOverW(inst.positions[0]).y()) / 2.f; screenHeight -= (32.f / 480.f); screenHeight /= (32.f / 480.f); return zeus::CColor(1.f - zeus::clamp(0.f, screenHeight, 1.f), 1.f); @@ -472,9 +472,9 @@ void CEnvFxManagerGrid::RenderRainParticles(const zeus::CTransform& camXf) const { zeus::CVector3f pos0 = particle.toVec3f(); zeus::CVector3f pos1 = pos0; - pos1.z += zOffset; - float uvy0 = pos0.z * 10.f + m_uvyOffset; - float uvy1 = pos1.z * 10.f + m_uvyOffset; + pos1.z() += zOffset; + float uvy0 = pos0.z() * 10.f + m_uvyOffset; + float uvy1 = pos1.z() * 10.f + m_uvyOffset; m_lineRenderer.AddVertex(pos0, zeus::CColor::skWhite, 1.f, {0.f, uvy0}); m_lineRenderer.AddVertex(pos1, zeus::CColor::skClear, 1.f, {0.f, uvy1}); } @@ -521,7 +521,7 @@ void CEnvFxManagerGrid::Render(const zeus::CTransform& xf, const zeus::CTransfor { zeus::CMatrix4f envTexMtx(true); envTexMtx[2][1] = 10.f; - envTexMtx[3][1] = 0.5f - (invXf * (zeus::CVector3f::skUp * x14_block.second)).z * 10.f; + envTexMtx[3][1] = 0.5f - (invXf * (zeus::CVector3f::skUp * x14_block.second)).z() * 10.f; m_uvyOffset = envTexMtx[3][1]; parent.m_uniformData.envMtx = envTexMtx; break; @@ -603,11 +603,11 @@ void CEnvFxManager::SetupUnderwaterTevs(const zeus::CTransform& invXf, const CSt for (CEntity* ent : mgr.GetAllObjectList()) if (TCastToPtr water = ent) if (auto tb = water->GetTouchBounds()) - waterTop = std::min(waterTop, tb->max.z); + waterTop = std::min(waterTop, float(tb->max.z())); zeus::CVector3f localWaterTop = invXf * (zeus::CVector3f::skUp * waterTop); zeus::CMatrix4f envTexMtx(true); envTexMtx[2][1] = -10.f; - envTexMtx[3][1] = localWaterTop.z * -10.f + 0.5f; + envTexMtx[3][1] = localWaterTop.z() * -10.f + 0.5f; // Load into texmtx5 // x40_txtrEnvGradient diff --git a/Runtime/World/CEnvFxManager.hpp b/Runtime/World/CEnvFxManager.hpp index 0ebba635a..8615fe170 100644 --- a/Runtime/World/CEnvFxManager.hpp +++ b/Runtime/World/CEnvFxManager.hpp @@ -45,9 +45,10 @@ public: CVectorFixed8_8(s16 xi, s16 yi, s16 zi) { x = xi; y = yi; z = zi; } CVectorFixed8_8(const zeus::CVector3f& vec) { - x = s16(vec.x * 256.f); - y = s16(vec.y * 256.f); - z = s16(vec.z * 256.f); + zeus::simd_floats f(vec.mSimd); + x = s16(f[0] * 256.f); + y = s16(f[1] * 256.f); + z = s16(f[2] * 256.f); } CVectorFixed8_8 operator+(const CVectorFixed8_8& other) const { diff --git a/Runtime/World/CFluidPlane.cpp b/Runtime/World/CFluidPlane.cpp index 8ffde9d32..aa669822b 100644 --- a/Runtime/World/CFluidPlane.cpp +++ b/Runtime/World/CFluidPlane.cpp @@ -104,7 +104,7 @@ void CFluidPlane::RenderStripWithRipples(float curY, float yMin = curY; float yMid = curY + tileMid; - float curX = info.x4_localMin.x; + float curX = info.x4_localMin.x(); int gridCell = info.x28_tileX + info.x2a_gridDimX * (info.x2e_tileY + yTile - 1); int xTile = 1; int tileSpan; @@ -364,8 +364,8 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, { m_shader->bindRegular(); - float xMin = info.x4_localMin.x; - float yMin = info.x4_localMin.y; + float xMin = info.x4_localMin.x(); + float yMin = info.x4_localMin.y(); float xMax = info.x18_rippleResolution * (info.x0_xSubdivs - 2) + xMin; float yMax = info.x18_rippleResolution * (info.x1_ySubdivs - 2) + yMin; @@ -568,7 +568,7 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, } else { - float curY = info.x4_localMin.y; + float curY = info.x4_localMin.y(); for (int startYDiv=1 ; startYDiv= 0 && curGridY < gridCells && curGridX >= 0 && curGridX < info.x2a_gridDimX && info.x30_gridFlags[curGridX + curGridY])) @@ -875,7 +881,7 @@ void CFluidPlaneCPU::Render(const CStateManager& mgr, float alpha, const zeus::C { float cameraPenetration = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation().dot(zeus::CVector3f::skUp) - - water->GetTriggerBoundsWR().max.z; + water->GetTriggerBoundsWR().max.z(); wavecapIntensityScale *= (cameraPenetration >= 0.5f || cameraPenetration < 0.f) ? 1.f : 2.f * cameraPenetration; } @@ -888,9 +894,9 @@ void CFluidPlaneCPU::Render(const CStateManager& mgr, float alpha, const zeus::C { /* Additional uniform data for tessellation evaluation shader */ zeus::CColor colorMul; - colorMul.r = wavecapIntensityScale / 255.f / float(1 << redShift); - colorMul.g = wavecapIntensityScale / 255.f / float(1 << greenShift); - colorMul.b = wavecapIntensityScale / 255.f / float(1 << blueShift); + colorMul.r() = wavecapIntensityScale / 255.f / float(1 << redShift); + colorMul.g() = wavecapIntensityScale / 255.f / float(1 << greenShift); + colorMul.b() = wavecapIntensityScale / 255.f / float(1 << blueShift); m_shader->prepareDraw(setupInfo, xf.origin, *rippleManager, colorMul, x108_rippleResolution / 4.f); } else @@ -899,22 +905,22 @@ void CFluidPlaneCPU::Render(const CStateManager& mgr, float alpha, const zeus::C } u32 tileY = 0; - float curY = aabb.min.y; - for (int i=0 ; curY < aabb.max.y && iGetPatchRenderFlags(j, i)) { - s16 remDivsX = std::min(s16((aabb.max.x - curX) * rippleResolutionRecip), + s16 remDivsX = std::min(s16((aabb.max.x() - curX) * rippleResolutionRecip), s16(CFluidPlaneRender::numSubdivisionsInHField)); s16 remDivsY = std::min(s16(_remDivsY), s16(CFluidPlaneRender::numSubdivisionsInHField)); zeus::CVector3f localMax(x108_rippleResolution * remDivsX + curX, - x108_rippleResolution * remDivsY + curY, aabb.max.z); - zeus::CVector3f localMin(curX, curY, aabb.min.z); + x108_rippleResolution * remDivsY + curY, aabb.max.z()); + zeus::CVector3f localMin(curX, curY, aabb.min.z()); zeus::CAABox testaabb(localMin + xf.origin, localMax + xf.origin); if (frustum.aabbFrustumTest(testaabb)) { @@ -943,10 +949,10 @@ void CFluidPlaneCPU::Render(const CStateManager& mgr, float alpha, const zeus::C RenderPatch(info, lc_heights, lc_flags, noRipples, renderFlags == 1, m_verts, m_pVerts); } } - curX += ripplePitch.x; + curX += ripplePitch.x(); tileX += CFluidPlaneRender::numTilesInHField; } - curY += ripplePitch.y; + curY += ripplePitch.y(); tileY += CFluidPlaneRender::numTilesInHField; } diff --git a/Runtime/World/CFluidPlaneDoor.cpp b/Runtime/World/CFluidPlaneDoor.cpp index da14563b9..ae5cbcc9c 100644 --- a/Runtime/World/CFluidPlaneDoor.cpp +++ b/Runtime/World/CFluidPlaneDoor.cpp @@ -24,15 +24,18 @@ CFluidPlaneDoor::RenderSetup(const CStateManager& mgr, float alpha, const zeus:: float fluidUVs[3][2]; x4c_uvMotion.CalculateFluidTextureOffset(uvT, fluidUVs); - out.texMtxs[0][0][0] = out.texMtxs[0][1][1] = x4c_uvMotion.GetFluidLayers()[1].GetUVScale(); + out.texMtxs[0][0][0] = x4c_uvMotion.GetFluidLayers()[1].GetUVScale(); + out.texMtxs[0][1][1] = x4c_uvMotion.GetFluidLayers()[1].GetUVScale(); out.texMtxs[0][3][0] = fluidUVs[1][0]; out.texMtxs[0][3][1] = fluidUVs[1][1]; - out.texMtxs[1][0][0] = out.texMtxs[1][1][1] = x4c_uvMotion.GetFluidLayers()[2].GetUVScale(); + out.texMtxs[1][0][0] = x4c_uvMotion.GetFluidLayers()[2].GetUVScale(); + out.texMtxs[1][1][1] = x4c_uvMotion.GetFluidLayers()[2].GetUVScale(); out.texMtxs[1][3][0] = fluidUVs[2][0]; out.texMtxs[1][3][1] = fluidUVs[2][1]; - out.texMtxs[2][0][0] = out.texMtxs[2][1][1] = x4c_uvMotion.GetFluidLayers()[0].GetUVScale(); + out.texMtxs[2][0][0] = x4c_uvMotion.GetFluidLayers()[0].GetUVScale(); + out.texMtxs[2][1][1] = x4c_uvMotion.GetFluidLayers()[0].GetUVScale(); out.texMtxs[2][3][0] = fluidUVs[0][0]; out.texMtxs[2][3][1] = fluidUVs[0][1]; @@ -40,8 +43,8 @@ CFluidPlaneDoor::RenderSetup(const CStateManager& mgr, float alpha, const zeus:: if (!m_shader) { - auto gridDimX = u32((xa0_tileSize + aabb.max.x - aabb.min.x - 0.01f) / xa0_tileSize); - auto gridDimY = u32((xa0_tileSize + aabb.max.y - aabb.min.y - 0.01f) / xa0_tileSize); + auto gridDimX = u32((xa0_tileSize + aabb.max.x() - aabb.min.x() - 0.01f) / xa0_tileSize); + auto gridDimY = u32((xa0_tileSize + aabb.max.y() - aabb.min.y() - 0.01f) / xa0_tileSize); u32 gridCellCount = (gridDimX + 1) * (gridDimY + 1); u32 maxVerts = gridCellCount * ((std::max(2, xa4_tileSubdivisions) * 4 + 2) * 4); m_shader.emplace(x10_texPattern1, x20_texPattern2, x30_texColor, maxVerts); @@ -64,7 +67,7 @@ void CFluidPlaneDoor::Render(const CStateManager& mgr, float alpha, const zeus:: CFluidPlaneRender::numSubdivisionsInTile = xa4_tileSubdivisions; CFluidPlaneRender::numTilesInHField = 42 / xa4_tileSubdivisions; CFluidPlaneRender::numSubdivisionsInHField = CFluidPlaneRender::numTilesInHField * xa4_tileSubdivisions; - zeus::CVector2f centerPlane(aabb.center().x, aabb.center().y); + zeus::CVector2f centerPlane(aabb.center().x(), aabb.center().y()); float patchSize = xa8_rippleResolution * CFluidPlaneRender::numSubdivisionsInHField; float ooSubdivSize = 1.f / xa8_rippleResolution; @@ -72,25 +75,25 @@ void CFluidPlaneDoor::Render(const CStateManager& mgr, float alpha, const zeus:: m_pVerts.clear(); m_shader->prepareDraw(setupInfo); - for (float curX = aabb.min.x ; curX < aabb.max.x ; curX += patchSize) + for (float curX = aabb.min.x() ; curX < aabb.max.x() ; curX += patchSize) { - float remSubdivsX = (aabb.max.x - curX) * ooSubdivSize; - for (float curY = aabb.min.y ; curY < aabb.max.y ; curY += patchSize) + float remSubdivsX = (aabb.max.x() - curX) * ooSubdivSize; + for (float curY = aabb.min.y() ; curY < aabb.max.y() ; curY += patchSize) { - float remSubdivsY = (aabb.max.y - curY) * ooSubdivSize; + float remSubdivsY = (aabb.max.y() - curY) * ooSubdivSize; int remSubdivsXi = std::min(CFluidPlaneRender::numSubdivisionsInHField, int(remSubdivsX)); int remSubdivsYi = std::min(CFluidPlaneRender::numSubdivisionsInHField, int(remSubdivsY)); zeus::CAABox aabb2(aabb.min, zeus::CVector3f(xa8_rippleResolution * remSubdivsXi + curX, xa8_rippleResolution * remSubdivsYi + curY, - aabb.max.z)); + aabb.max.z())); if (frustum.aabbFrustumTest(aabb2.getTransformedAABox(xf))) { - CFluidPlaneRender::SPatchInfo patchInfo(zeus::CVector3f(curX, curY, aabb.min.z), - aabb2.max, xf.origin, xa8_rippleResolution, - xa0_tileSize, 0.f, - CFluidPlaneRender::numSubdivisionsInHField, - CFluidPlaneRender::NormalMode::None, - 0, 0, 0, 0, 0, 0, 0, nullptr); + CFluidPlaneRender::SPatchInfo patchInfo(zeus::CVector3f(curX, curY, aabb.min.z()), + aabb2.max, xf.origin, xa8_rippleResolution, + xa0_tileSize, 0.f, + CFluidPlaneRender::numSubdivisionsInHField, + CFluidPlaneRender::NormalMode::None, + 0, 0, 0, 0, 0, 0, 0, nullptr); RenderPatch(patchInfo, lc_heights, lc_flags, true, true, m_verts, m_pVerts); } diff --git a/Runtime/World/CFluidPlaneGPU.cpp b/Runtime/World/CFluidPlaneGPU.cpp index a331557af..f61d88b29 100644 --- a/Runtime/World/CFluidPlaneGPU.cpp +++ b/Runtime/World/CFluidPlaneGPU.cpp @@ -35,7 +35,7 @@ void CFluidPlaneGPU::RenderStripWithRipples(float curY, const CFluidPlaneRender: float yMin = curY; float subdivF = CFluidPlaneRender::numSubdivisionsInTile; - float curX = info.x4_localMin.x; + float curX = info.x4_localMin.x(); int gridCell = info.x28_tileX + info.x2a_gridDimX * (info.x2e_tileY + yTile - 1); int xTile = 1; int tileSpan; diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index b8ff37c1a..1f6ae60e1 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -61,47 +61,47 @@ zeus::CAABox CAreaRenderOctTree::Node::GetNodeBounds(const zeus::CAABox& curAABB return curAABB; case 1: if (idx == 0) - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), center.x(), curAABB.max.y(), curAABB.max.z()}; else - return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {center.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; case 2: if (idx == 0) - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), center.y(), curAABB.max.z()}; else - return {curAABB.min.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), center.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; case 3: { switch (idx) { case 0: default: - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, center.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), center.x(), center.y(), curAABB.max.z()}; case 1: - return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, curAABB.max.z}; + return {center.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), center.y(), curAABB.max.z()}; case 2: - return {curAABB.min.x, center.y, curAABB.min.z, center.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), center.y(), curAABB.min.z(), center.x(), curAABB.max.y(), curAABB.max.z()}; case 3: - return {center.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {center.x(), center.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; } } case 4: if (idx == 0) - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), center.z()}; else - return {curAABB.min.x, curAABB.min.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), center.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; case 5: { switch (idx) { case 0: default: - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, curAABB.max.y, center.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), center.x(), curAABB.max.y(), center.z()}; case 1: - return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z}; + return {center.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), center.z()}; case 2: - return {curAABB.min.x, curAABB.min.y, center.z, center.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), center.z(), center.x(), curAABB.max.y(), curAABB.max.z()}; case 3: - return {center.x, curAABB.min.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {center.x(), curAABB.min.y(), center.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; } } case 6: @@ -110,13 +110,13 @@ zeus::CAABox CAreaRenderOctTree::Node::GetNodeBounds(const zeus::CAABox& curAABB { case 0: default: - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, center.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), center.y(), center.z()}; case 1: - return {curAABB.min.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z}; + return {curAABB.min.x(), center.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), center.z()}; case 2: - return {curAABB.min.x, curAABB.min.y, center.z, curAABB.max.x, center.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), center.z(), curAABB.max.x(), center.y(), curAABB.max.z()}; case 3: - return {curAABB.min.x, center.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), center.y(), center.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; } } case 7: @@ -125,21 +125,21 @@ zeus::CAABox CAreaRenderOctTree::Node::GetNodeBounds(const zeus::CAABox& curAABB { case 0: default: - return {curAABB.min.x, curAABB.min.y, curAABB.min.z, center.x, center.y, center.z}; + return {curAABB.min.x(), curAABB.min.y(), curAABB.min.z(), center.x(), center.y(), center.z()}; case 1: - return {center.x, curAABB.min.y, curAABB.min.z, curAABB.max.x, center.y, center.z}; + return {center.x(), curAABB.min.y(), curAABB.min.z(), curAABB.max.x(), center.y(), center.z()}; case 2: - return {curAABB.min.x, center.y, curAABB.min.z, center.x, curAABB.max.y, center.z}; + return {curAABB.min.x(), center.y(), curAABB.min.z(), center.x(), curAABB.max.y(), center.z()}; case 3: - return {center.x, center.y, curAABB.min.z, curAABB.max.x, curAABB.max.y, center.z}; + return {center.x(), center.y(), curAABB.min.z(), curAABB.max.x(), curAABB.max.y(), center.z()}; case 4: - return {curAABB.min.x, curAABB.min.y, center.z, center.x, center.y, curAABB.max.z}; + return {curAABB.min.x(), curAABB.min.y(), center.z(), center.x(), center.y(), curAABB.max.z()}; case 5: - return {center.x, curAABB.min.y, center.z, curAABB.max.x, center.y, curAABB.max.z}; + return {center.x(), curAABB.min.y(), center.z(), curAABB.max.x(), center.y(), curAABB.max.z()}; case 6: - return {curAABB.min.x, center.y, center.z, center.x, curAABB.max.y, curAABB.max.z}; + return {curAABB.min.x(), center.y(), center.z(), center.x(), curAABB.max.y(), curAABB.max.z()}; case 7: - return {center.x, center.y, center.z, curAABB.max.x, curAABB.max.y, curAABB.max.z}; + return {center.x(), center.y(), center.z(), curAABB.max.x(), curAABB.max.y(), curAABB.max.z()}; } } } @@ -204,7 +204,7 @@ void CGameArea::CAreaFog::Update(float dt) float delta = x28_colorTarget[i] - x1c_colorCur[i]; if (std::fabs(delta) <= colorDelta) { - x1c_colorCur[i] = x28_colorTarget[i]; + x1c_colorCur[i] = float(x28_colorTarget[i]); } else { @@ -220,7 +220,7 @@ void CGameArea::CAreaFog::Update(float dt) float delta = xc_rangeTarget[i] - x4_rangeCur[i]; if (std::fabs(delta) <= rangeDelta[i]) { - x4_rangeCur[i] = xc_rangeTarget[i]; + x4_rangeCur[i] = float(xc_rangeTarget[i]); } else { diff --git a/Runtime/World/CHUDBillboardEffect.cpp b/Runtime/World/CHUDBillboardEffect.cpp index 55505cefe..dc0d3cba2 100644 --- a/Runtime/World/CHUDBillboardEffect.cpp +++ b/Runtime/World/CHUDBillboardEffect.cpp @@ -21,7 +21,7 @@ CHUDBillboardEffect::CHUDBillboardEffect(const std::experimental::optional 0.8f) + if (x188c_spiderPullMovement == 1.f && std::fabs(x1880_playerToSpiderNormal.z()) > 0.8f) maxPullVel = 0.3f; playerVel += x1880_playerToSpiderNormal * zeus::clamp(-maxPullVel, x18fc_refPullVel - playerToSpiderDist, maxPullVel) / dt; @@ -495,13 +495,13 @@ void CMorphBall::ApplySpiderBallSwingingForces(const CFinalInput& input, CStateM zeus::CVector3f CMorphBall::TransformSpiderBallForcesXY(const zeus::CVector2f& forces, CStateManager& mgr) { return mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis * - zeus::CVector3f(forces.x, forces.y, 0.f); + zeus::CVector3f(forces.x(), forces.y(), 0.f); } zeus::CVector3f CMorphBall::TransformSpiderBallForcesXZ(const zeus::CVector2f& forces, CStateManager& mgr) { return mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis * - zeus::CVector3f(forces.x, 0.f, forces.y); + zeus::CVector3f(forces.x(), 0.f, forces.y()); } void CMorphBall::ApplySpiderBallRollForces(const CFinalInput& input, CStateManager& mgr, float dt) @@ -698,7 +698,7 @@ bool CMorphBall::CheckForSwitchToSpiderBallSwinging(CStateManager& mgr) const if (x18be_spiderBallSwinging) return true; - return std::fabs(x1880_playerToSpiderNormal.z) > 0.9f; + return std::fabs(x1880_playerToSpiderNormal.z()) > 0.9f; } bool CMorphBall::FindClosestSpiderBallWaypoint(CStateManager& mgr, const zeus::CVector3f& ballCenter, @@ -727,8 +727,8 @@ bool CMorphBall::FindClosestSpiderBallWaypoint(CStateManager& mgr, const zeus::C zeus::CVector3f halfScale = surface->GetScale() * 0.5f; zeus::CVector3f localPoint = zeus::CTransform::Scale(1.f / halfScale) * surface->GetTransform().inverse() * intersectPoint; - localPoint.x = zeus::clamp(-1.f, localPoint.x, 1.f); - localPoint.z = zeus::clamp(-1.f, localPoint.z, 1.f); + localPoint.x() = zeus::clamp(-1.f, float(localPoint.x()), 1.f); + localPoint.z() = zeus::clamp(-1.f, float(localPoint.z()), 1.f); zeus::CVector3f worldPoint = surface->GetTransform() * zeus::CTransform::Scale(halfScale) * localPoint; zeus::CVector3f finalDelta = worldPoint - ballCenter; float finalMag = finalDelta.magnitude(); @@ -913,10 +913,10 @@ void CMorphBall::ComputeMarioMovement(const CFinalInput& input, CStateManager& m if (std::fabs(turn) > 0.1f) { float controlTurn = turn * maxSpeed; - float controlTurnDelta = controlTurn - controlFrameVel.x; + float controlTurnDelta = controlTurn - controlFrameVel.x(); float accFactor = zeus::clamp(0.f, std::fabs(controlTurnDelta) / maxSpeed, 1.f); float maxAcc; - if ((controlFrameVel.x > 0.f ? 1.f : -1.f) != (controlTurn > 0.f ? 1.f : -1.f) && + if ((controlFrameVel.x() > 0.f ? 1.f : -1.f) != (controlTurn > 0.f ? 1.f : -1.f) && curSpeed > 0.8f * maxSpeed) maxAcc = g_tweakBall->GetBallForwardBrakingAcceleration(int(x0_player.GetSurfaceRestraint())); else @@ -929,10 +929,10 @@ void CMorphBall::ComputeMarioMovement(const CFinalInput& input, CStateManager& m if (std::fabs(forward) > 0.1f) { float controlFwd = forward * maxSpeed; - float controlFwdDelta = controlFwd - controlFrameVel.y; + float controlFwdDelta = controlFwd - controlFrameVel.y(); float accFactor = zeus::clamp(0.f, std::fabs(controlFwdDelta) / maxSpeed, 1.f); float maxAcc; - if ((controlFrameVel.y > 0.f ? 1.f : -1.f) != (controlFwd > 0.f ? 1.f : -1.f) && + if ((controlFrameVel.y() > 0.f ? 1.f : -1.f) != (controlFwd > 0.f ? 1.f : -1.f) && curSpeed > 0.8f * maxSpeed) maxAcc = g_tweakBall->GetBallForwardBrakingAcceleration(int(x0_player.GetSurfaceRestraint())); else @@ -949,7 +949,7 @@ void CMorphBall::ComputeMarioMovement(const CFinalInput& input, CStateManager& m x1c_controlForce = controlForce; if (x1de4_24_inBoost && !GetIsInHalfPipeMode()) controlForce = - x1924_surfaceToWorld.rotate({x1924_surfaceToWorld.transposeRotate(controlForce).x, 0.f, 0.f}); + x1924_surfaceToWorld.rotate({x1924_surfaceToWorld.transposeRotate(controlForce).x(), 0.f, 0.f}); if (GetIsInHalfPipeMode() && controlForce.magnitude() > FLT_EPSILON) { @@ -965,8 +965,8 @@ void CMorphBall::ComputeMarioMovement(const CFinalInput& input, CStateManager& m { controlForce -= controlForce.dot(x1924_surfaceToWorld.basis[2]) * x1924_surfaceToWorld.basis[2]; zeus::CVector3f controlForceSurfaceLocal = x1924_surfaceToWorld.transposeRotate(controlForce); - controlForceSurfaceLocal.x *= 0.6f; - controlForceSurfaceLocal.y *= (x1de4_24_inBoost ? 0.f : 0.35f) * 1.4f; + controlForceSurfaceLocal.x() *= 0.6f; + controlForceSurfaceLocal.y() *= (x1de4_24_inBoost ? 0.f : 0.35f) * 1.4f; controlForce = x1924_surfaceToWorld.rotate(controlForceSurfaceLocal); if (maxSpeed > 95.f) x0_player.SetVelocityWR(x0_player.GetVelocity() * 0.99f); @@ -1076,7 +1076,7 @@ void CMorphBall::UpdateBallDynamics(CStateManager& mgr, float dt) SwitchToTire(); if (x28_tireMode) { - x2c_tireLeanAngle = x0_player.GetTransform().transposeRotate(x0_player.GetForceOR()).x / + x2c_tireLeanAngle = x0_player.GetTransform().transposeRotate(x0_player.GetForceOR()).x() / g_tweakBall->GetMaxBallTranslationAcceleration(int(x0_player.GetSurfaceRestraint())) * g_tweakBall->GetMaxLeanAngle() * g_tweakBall->GetForceToLeanGain(); x2c_tireLeanAngle = @@ -1484,17 +1484,17 @@ void CMorphBall::EnterBoosting(CStateManager& mgr) } zeus::CVector3f lookDir = x0_player.x500_lookDir; - float lookMag2d = std::sqrt(lookDir.x * lookDir.x + lookDir.y * lookDir.y); - float vertLookAngle = zeus::radToDeg(std::atan2(lookDir.z, lookMag2d)); + float lookMag2d = std::sqrt(lookDir.x() * lookDir.x() + lookDir.y() * lookDir.y()); + float vertLookAngle = zeus::radToDeg(std::atan2(lookDir.z(), lookMag2d)); if (lookMag2d < 0.001f && x0_player.GetPlayerMovementState() == CPlayer::EPlayerMovementState::OnGround) { - float velMag2d = std::sqrt(x0_player.GetVelocity().x * x0_player.GetVelocity().x + - x0_player.GetVelocity().y * x0_player.GetVelocity().y); - if (velMag2d < 0.001f && std::fabs(x0_player.GetVelocity().z) < 2.f) + float velMag2d = std::sqrt(x0_player.GetVelocity().x() * x0_player.GetVelocity().x() + + x0_player.GetVelocity().y() * x0_player.GetVelocity().y()); + if (velMag2d < 0.001f && std::fabs(x0_player.GetVelocity().z()) < 2.f) { lookDir = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis[1]; - lookMag2d = std::sqrt(lookDir.x * lookDir.x + lookDir.y * lookDir.y); - vertLookAngle = zeus::radToDeg(std::atan2(lookDir.z, lookMag2d)); + lookMag2d = std::sqrt(lookDir.x() * lookDir.x() + lookDir.y() * lookDir.y()); + vertLookAngle = zeus::radToDeg(std::atan2(lookDir.z(), lookMag2d)); } } @@ -1545,9 +1545,9 @@ bool CMorphBall::UpdateMarbleDynamics(CStateManager& mgr, float dt, const zeus:: if (x0_player.GetVelocity().magnitude() < 3.f && x10_boostControlForce.magnitude() > 0.95f * maxAcc) { zeus::CVector3f localMomentum = x1924_surfaceToWorld.transposeRotate(x0_player.GetMomentum()); - localMomentum.z = 0.f; + localMomentum.z() = 0.f; zeus::CVector3f localControlForce = x1924_surfaceToWorld.transposeRotate(x10_boostControlForce); - localControlForce.z = 0.f; + localControlForce.z() = 0.f; if (localMomentum.canBeNormalized() && localControlForce.canBeNormalized()) if (localMomentum.normalized().dot(localControlForce.normalized()) < -0.9f) continueForce = true; @@ -1678,13 +1678,13 @@ void CMorphBall::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) } zeus::CColor ambColor = x0_player.ActorLights()->GetAmbientColor(); - ambColor.a = 1.f; + ambColor.a() = 1.f; x0_player.ActorLights()->SetAmbientColor(zeus::CColor::lerp(ambColor, zeus::CColor::skWhite, x1c34_boostLightFactor)); *x1c18_actorLights = *x0_player.GetActorLights(); ambColor = x0_player.ActorLights()->GetAmbientColor(); - ambColor.a = 1.f; + ambColor.a() = 1.f; x1c18_actorLights->SetAmbientColor(zeus::CColor::lerp(ambColor, zeus::CColor::skWhite, std::max(x1c38_spiderLightFactor, x1c34_boostLightFactor))); @@ -2211,7 +2211,7 @@ void CMorphBall::CollidedWith(TUniqueId id, const CCollisionInfoList& list, CSta } } - if (list.GetCount() > 2 && list.GetItem(0).GetNormalLeft().z > 0.2f && + if (list.GetCount() > 2 && list.GetItem(0).GetNormalLeft().z() > 0.2f && std::fabs(x0_player.GetVelocity().dot(list.GetItem(0).GetNormalLeft())) > 2.f) { float accum = 0.f; @@ -2244,7 +2244,7 @@ bool CMorphBall::IsInFrustum(const zeus::CFrustum& frustum) const return true; auto swooshBounds = x19b8_slowBlueTailSwooshGen->GetBounds(); - return x19b8_slowBlueTailSwooshGen->GetModulationColor().a != 0.f && swooshBounds && + return x19b8_slowBlueTailSwooshGen->GetModulationColor().a() != 0.f && swooshBounds && frustum.aabbFrustumTest(*swooshBounds); } @@ -2336,9 +2336,9 @@ void CMorphBall::Touch(CActor& actor, CStateManager& mgr) bool CMorphBall::IsClimbable(const CCollisionInfo& cinfo) const { - if (std::fabs(cinfo.GetNormalLeft().z) < 0.7f) + if (std::fabs(cinfo.GetNormalLeft().z()) < 0.7f) { - float pointToBall = GetBallToWorld().origin.z - cinfo.GetPoint().z; + float pointToBall = GetBallToWorld().origin.z() - cinfo.GetPoint().z(); if (pointToBall > 0.1f && pointToBall < GetBallRadius() - 0.05f) return true; } @@ -2348,7 +2348,7 @@ bool CMorphBall::IsClimbable(const CCollisionInfo& cinfo) const void CMorphBall::FluidFXThink(CActor::EFluidState state, CScriptWater& water, CStateManager& mgr) { zeus::CVector3f vec = x0_player.GetTranslation(); - vec.z = water.GetTriggerBoundsWR().max.z; + vec.z() = float(water.GetTriggerBoundsWR().max.z()); if (x0_player.x4fc_flatMoveSpeed >= 8.f) { float maxVel = x0_player.GetBallMaxVelocity(); @@ -2603,9 +2603,9 @@ void CMorphBall::TakeDamage(float dam) void CMorphBall::StartLandingSfx() { - if (x0_player.GetVelocity().z < -5.f && x1e36_landSfx != 0xffff) + if (x0_player.GetVelocity().z() < -5.f && x1e36_landSfx != 0xffff) { - float vol = zeus::clamp(0.75f, 0.0125f * x0_player.GetLastVelocity().z + 0.75f, 1.f); + float vol = zeus::clamp(0.75f, 0.0125f * x0_player.GetLastVelocity().z() + 0.75f, 1.f); CSfxHandle hnd = CSfxManager::SfxStart(x1e36_landSfx, vol, 0.f, true, 0x7f, false, kInvalidAreaId); x0_player.ApplySubmergedPitchBend(hnd); } diff --git a/Runtime/World/CMorphBallShadow.cpp b/Runtime/World/CMorphBallShadow.cpp index 3c9f4439a..dbcb453fc 100644 --- a/Runtime/World/CMorphBallShadow.cpp +++ b/Runtime/World/CMorphBallShadow.cpp @@ -46,14 +46,14 @@ void CMorphBallShadow::RenderIdBuffer(const zeus::CAABox& aabb, const CStateMana CGraphics::CProjectionState backupProjection = CGraphics::g_Proj; zeus::CVector2f backupDepth = CGraphics::g_CachedDepthRange; zeus::CTransform viewMtx(zeus::CVector3f::skRight, zeus::CVector3f::skDown, zeus::CVector3f::skForward, - zeus::CVector3f((aabb.min.x + aabb.max.x) * 0.5f, - (aabb.min.y + aabb.max.y) * 0.5f, - aabb.max.z)); + zeus::CVector3f((aabb.min.x() + aabb.max.x()) * 0.5f, + (aabb.min.y() + aabb.max.y()) * 0.5f, + aabb.max.z())); CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR); - float vpX = (aabb.max.x - aabb.min.x) * 0.5f; - float vpY = (aabb.max.y - aabb.min.y) * 0.5f; - float vpZ = (aabb.max.z - aabb.min.z) + FLT_EPSILON; + float vpX = (aabb.max.x() - aabb.min.x()) * 0.5f; + float vpY = (aabb.max.y() - aabb.min.y()) * 0.5f; + float vpZ = (aabb.max.z() - aabb.min.z()) + FLT_EPSILON; CGraphics::SetOrtho(-vpX, vpX, vpY, -vpY, 0.f, vpZ); rstl::reserved_vector nearItems; @@ -126,7 +126,7 @@ void CMorphBallShadow::Render(const CStateManager& mgr, float alpha) return; CModelFlags flags; - flags.x4_color.a = alpha; + flags.x4_color.a() = alpha; flags.m_extendedShader = EExtendedShader::MorphBallShadow; int alphaVal = 4; @@ -136,7 +136,7 @@ void CMorphBallShadow::Render(const CStateManager& mgr, float alpha) zeus::CTransform modelXf = actor->GetTransform() * zeus::CTransform::Scale(modelData->GetScale()); CGraphics::SetModelMatrix(modelXf); - flags.x4_color.r = alphaVal / 255.f; + flags.x4_color.r() = alphaVal / 255.f; const CBooModel& model = *modelData->PickStaticModel(CModelData::EWhichModel::Normal); const_cast(model).VerifyCurrentShader(flags.x1_matSetIdx); model.DrawNormal(flags, nullptr, nullptr); diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index 4d82ef78b..a2153a113 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -41,11 +41,11 @@ void CPFAreaOctree::Fixup(CPFArea& area) int CPFAreaOctree::GetChildIndex(const zeus::CVector3f& point) const { int idx = 0x0; - if (point.x > x1c_center.x) + if (point.x() > x1c_center.x()) idx = 0x1; - if (point.y > x1c_center.y) + if (point.y() > x1c_center.y()) idx |= 0x2; - if (point.z > x1c_center.z) + if (point.z() > x1c_center.z()) idx |= 0x4; return idx; } @@ -79,12 +79,12 @@ void CPFAreaOctree::GetRegionListList(rstl::reserved_vector= x4_aabb.min.x - padding && - point.x <= x4_aabb.max.x + padding && - point.y >= x4_aabb.min.y - padding && - point.y <= x4_aabb.max.y + padding && - point.z >= x4_aabb.min.z - padding && - point.z <= x4_aabb.max.z + padding; + return point.x() >= x4_aabb.min.x() - padding && + point.x() <= x4_aabb.max.x() + padding && + point.y() >= x4_aabb.min.y() - padding && + point.y() <= x4_aabb.max.y() + padding && + point.z() >= x4_aabb.min.z() - padding && + point.z() <= x4_aabb.max.z() + padding; } void CPFOpenList::Clear() diff --git a/Runtime/World/CPathFindRegion.cpp b/Runtime/World/CPathFindRegion.cpp index 92d7758df..d69ff366c 100644 --- a/Runtime/World/CPathFindRegion.cpp +++ b/Runtime/World/CPathFindRegion.cpp @@ -162,9 +162,9 @@ bool CPFRegion::FindBestPoint(std::vector& polyPoints, const ze polyPoints.clear(); polyPoints.push_back(node.GetPos()); polyPoints.push_back(node.GetPos()); - polyPoints.back().z += x14_height; + polyPoints.back().z() += x14_height; polyPoints.push_back(nextNode.GetPos()); - polyPoints.back().z += x14_height; + polyPoints.back().z() += x14_height; polyPoints.push_back(nextNode.GetPos()); found |= FindClosestPointOnPolygon(polyPoints, node.GetNormal(), point, true); } @@ -185,7 +185,7 @@ bool CPFRegion::FindBestPoint(std::vector& polyPoints, const ze { CPFNode& node = x4_startNode[i]; polyPoints.push_back(node.GetPos()); - polyPoints.back().z += x14_height; + polyPoints.back().z() += x14_height; } found |= FindClosestPointOnPolygon(polyPoints, -x18_normal, point, false); } @@ -207,7 +207,7 @@ void CPFRegion::SetLinkTo(s32 idx) void CPFRegion::DropToGround(zeus::CVector3f& point) const { - point.z -= (point - x4_startNode->GetPos()).dot(x18_normal) / x18_normal.z; + point.z() -= (point - x4_startNode->GetPos()).dot(x18_normal) / x18_normal.z(); } zeus::CVector3f CPFRegion::GetLinkMidPoint(const CPFLink& link) const @@ -226,14 +226,14 @@ zeus::CVector3f CPFRegion::FitThroughLink2d(const zeus::CVector3f& p1, const CPF float t = 0.5f; if (chRadius < 0.5f * link.Get2dWidth()) { - zeus::CVector2f delta2d(nodeDelta.x, nodeDelta.y); + zeus::CVector2f delta2d(nodeDelta.x(), nodeDelta.y()); delta2d *= link.GetOO2dWidth(); zeus::CVector3f nodeToP1 = p1 - node.GetPos(); float f27 = nodeToP1.dot(node.GetNormal()); - float f31 = delta2d.dot(zeus::CVector2f(nodeToP1.y, nodeToP1.y)); + float f31 = delta2d.dot(zeus::CVector2f(nodeToP1.y(), nodeToP1.y())); zeus::CVector3f nodeToP2 = p2 - node.GetPos(); float f26 = -nodeToP2.dot(node.GetNormal()); - float f1b = delta2d.dot(zeus::CVector2f(nodeToP2.y, nodeToP2.y)); + float f1b = delta2d.dot(zeus::CVector2f(nodeToP2.y(), nodeToP2.y())); float f3 = f27 + f26; if (f3 > FLT_EPSILON) t = zeus::clamp(chRadius, 1.f / f3 * (f26 * f31 + f27 * f1b), link.Get2dWidth() - chRadius) * @@ -272,27 +272,27 @@ zeus::CVector3f CPFRegion::FitThroughLink3d(const zeus::CVector3f& p1, const CPF float z; if (chHalfHeight < 0.5f * regionHeight) { - float minZ = chHalfHeight + midPoint.z; - z = 0.5f * (p1.z + p2.z); + float minZ = chHalfHeight + midPoint.z(); + z = 0.5f * (p1.z() + p2.z()); if (f23 > FLT_EPSILON) - z = 1.f / f23 * (f24 * p1.z + f25 * p2.z); - z = zeus::clamp(minZ, z, regionHeight + midPoint.z - chHalfHeight); + z = 1.f / f23 * (f24 * p1.z() + f25 * p2.z()); + z = zeus::clamp(minZ, z, regionHeight + midPoint.z() - chHalfHeight); } else { - z = (p1.z + p2.z) * 0.5f; + z = (p1.z() + p2.z()) * 0.5f; } - return {midPoint.x, midPoint.y, z}; + return {midPoint.x(), midPoint.y(), z}; } bool CPFRegion::IsPointInsidePaddedAABox(const zeus::CVector3f& point, float padding) const { - return point.x >= x34_aabb.min.x - padding && - point.x <= x34_aabb.max.x + padding && - point.y >= x34_aabb.min.y - padding && - point.y <= x34_aabb.max.y + padding && - point.z >= x34_aabb.min.z - padding && - point.z <= x34_aabb.max.z + padding; + return point.x() >= x34_aabb.min.x() - padding && + point.x() <= x34_aabb.max.x() + padding && + point.y() >= x34_aabb.min.y() - padding && + point.y() <= x34_aabb.max.y() + padding && + point.z() >= x34_aabb.min.z() - padding && + point.z() <= x34_aabb.max.z() + padding; } } diff --git a/Runtime/World/CPathFindSearch.cpp b/Runtime/World/CPathFindSearch.cpp index 2678bfc7a..a4150c2aa 100644 --- a/Runtime/World/CPathFindSearch.cpp +++ b/Runtime/World/CPathFindSearch.cpp @@ -20,8 +20,8 @@ CPathFindSearch::FindClosestReachablePoint(const zeus::CVector3f& p1, zeus::CVec /* Raise a bit above ground for step-up resolution */ if (!(xdc_flags & 0x2) && !(xdc_flags & 0x4)) { - localP2.z += 0.3f; - localP1.z += 0.3f; + localP2.z() += 0.3f; + localP1.z() += 0.3f; } rstl::reserved_vector regions; @@ -56,8 +56,8 @@ CPathFindSearch::EResult CPathFindSearch::PathExists(const zeus::CVector3f& p1, /* Raise a bit above ground for step-up resolution */ if (!(xdc_flags & 0x2) && !(xdc_flags & 0x4)) { - localP2.z += 0.3f; - localP1.z += 0.3f; + localP2.z() += 0.3f; + localP1.z() += 0.3f; } rstl::reserved_vector regions1; @@ -86,7 +86,7 @@ CPathFindSearch::EResult CPathFindSearch::OnPath(const zeus::CVector3f& p1) cons /* Raise a bit above ground for step-up resolution */ if (!(xdc_flags & 0x2) && !(xdc_flags & 0x4)) - localP1.z += 0.3f; + localP1.z() += 0.3f; rstl::reserved_vector regions1; if (x0_area->FindRegions(regions1, localP1, xdc_flags, xe0_indexMask) == 0) @@ -123,8 +123,8 @@ CPathFindSearch::EResult CPathFindSearch::Search(const zeus::CVector3f& p1, cons /* Raise a bit above ground for step-up resolution */ if (!(xdc_flags & 0x2) && !(xdc_flags & 0x4)) { - localP2.z += 0.3f; - localP1.z += 0.3f; + localP2.z() += 0.3f; + localP1.z() += 0.3f; } rstl::reserved_vector regions1; @@ -249,7 +249,7 @@ CPathFindSearch::EResult CPathFindSearch::Search(const zeus::CVector3f& p1, cons if (xdc_flags & 0x2 || xdc_flags & 0x4) { float minHeight = std::min(reg->GetHeight(), linkReg->GetHeight()); - midPoint.z = zeus::clamp(chHalfHeight + midPoint.z, p2.z, minHeight + midPoint.z - chHalfHeight); + midPoint.z() = zeus::clamp(chHalfHeight + midPoint.z(), p2.z(), minHeight + midPoint.z() - chHalfHeight); } points.push_back(midPoint); reg = linkReg; diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index 6650e29c2..92a62b4ad 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -269,7 +269,7 @@ void CPatterned::Think(float dt, CStateManager& mgr) zeus::CVector3f diffVec = x4e4_latestPredictedTranslation - GetTranslation(); if (!x328_25_verticalMovement) - diffVec.z = 0.f; + diffVec.z() = 0.f; if (diffVec.magSquared() > (0.1f * dt)) x4f0_predictedLeashTime += dt; @@ -713,9 +713,9 @@ bool CPatterned::PlayerSpot(CStateManager& mgr, float arg) zeus::CVector3f aimToCenterNorm = aimToCenter * (1.f / aimToCenterMag); zeus::CVector3f screenSpace = mgr.GetCameraManager()-> GetFirstPersonCamera()->ConvertToScreenSpace(center); - if (screenSpace.z > 0.f && - screenSpace.x * screenSpace.x < 1.f && - screenSpace.y * screenSpace.y < 1.f) + if (screenSpace.z() > 0.f && + screenSpace.x() * screenSpace.x() < 1.f && + screenSpace.y() * screenSpace.y() < 1.f) { CRayCastResult res = mgr.RayStaticIntersection(aimPosition, aimToCenterNorm, aimToCenterMag, @@ -753,7 +753,7 @@ bool CPatterned::InDetectionRange(CStateManager& mgr, float arg) if (delta.magSquared() < x3bc_detectionRange * x3bc_detectionRange) { if (x3c0_detectionHeightRange > 0.f) - return delta.z * delta.z < x3c0_detectionHeightRange * x3c0_detectionHeightRange; + return delta.z() * delta.z() < x3c0_detectionHeightRange * x3c0_detectionHeightRange; return true; } return false; @@ -830,8 +830,8 @@ void CPatterned::PathFind(CStateManager& mgr, EStateMsg msg, float dt) zeus::CVector3f biasedPos = GetTranslation() + 0.3f * zeus::CVector3f::skUp; x2ec_reflectedDestPos = biasedPos - (x2e0_destPos - biasedPos); ApproachDest(mgr); - zeus::CVector3f biasedForward = x34_transform.basis[1] * x64_modelData->GetScale().y + biasedPos; - search->GetSplinePointWithLookahead(biasedForward, biasedPos, 3.f * x64_modelData->GetScale().y); + zeus::CVector3f biasedForward = x34_transform.basis[1] * x64_modelData->GetScale().y() + biasedPos; + search->GetSplinePointWithLookahead(biasedForward, biasedPos, 3.f * x64_modelData->GetScale().y()); SetDestPos(biasedForward); if (search->SegmentOver(biasedPos)) search->SetCurrentWaypoint(search->GetCurrentWaypoint() + 1); @@ -1174,7 +1174,7 @@ zeus::CVector3f CPatterned::GetGunEyePos() const { zeus::CVector3f origin = GetTranslation(); zeus::CAABox baseBox = GetBaseBoundingBox(); - origin.z = 0.6f * (baseBox.max.z - baseBox.min.z) + origin.z; + origin.z() = 0.6f * (baseBox.max.z() - baseBox.min.z()) + origin.z(); return origin; } @@ -1284,7 +1284,7 @@ void CPatterned::UpdateAlphaDelta(float dt, CStateManager& mgr) if (x3e8_alphaDelta == 0.f) return; - float alpha = dt * x3e8_alphaDelta + x42c_color.a; + float alpha = dt * x3e8_alphaDelta + x42c_color.a(); if (alpha > 1.f) { alpha = 1.f; @@ -1314,10 +1314,10 @@ void CPatterned::UpdateDamageColor(float dt) if (x428_damageCooldownTimer > 0.f) { x428_damageCooldownTimer = std::max(0.f, x428_damageCooldownTimer - dt); - float alpha = x42c_color.a; + float alpha = x42c_color.a(); x42c_color = zeus::CColor::lerp(zeus::CColor::skBlack, x430_damageColor, std::min(x428_damageCooldownTimer / 0.33f, 1.f)); - x42c_color.a = alpha; + x42c_color.a() = alpha; if (!x450_bodyController->IsFrozen()) xd0_damageMag = x50c_baseDamageMag + x428_damageCooldownTimer; } @@ -1439,7 +1439,7 @@ void CPatterned::ApproachDest(CStateManager& mgr) zeus::CVector3f faceVec = mgr.GetPlayer().GetTranslation() - GetTranslation(); zeus::CVector3f moveVec = x2e0_destPos - GetTranslation(); if (!x328_25_verticalMovement) - moveVec.z = 0.f; + moveVec.z() = 0.f; zeus::CVector3f pathLine = x2e0_destPos - x2ec_reflectedDestPos; if (pathLine.dot(moveVec) <= 0.f) x328_24_inPosition = true; @@ -1516,10 +1516,10 @@ std::pair CPatterned::GetDestWaypoints(CStat zeus::CQuaternion CPatterned::FindPatternRotation(const zeus::CVector3f& dir) const { zeus::CVector3f wpDeltaFlat = x368_destWPDelta; - wpDeltaFlat.z = 0.f; + wpDeltaFlat.z() = 0.f; wpDeltaFlat.normalize(); zeus::CVector3f dirFlat = dir; - dirFlat.z = 0.f; + dirFlat.z() = 0.f; dirFlat.normalize(); zeus::CQuaternion q; @@ -1719,7 +1719,7 @@ void CPatterned::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) if (alpha < 255) { - if (col.r == 0.f && col.g == 0.f && col.b == 0.f) + if (col.r() == 0.f && col.g() == 0.f && col.b() == 0.f) col = zeus::CColor::skWhite; /* Not being damaged */ if (x401_29_laggedBurnDeath) @@ -1736,17 +1736,17 @@ void CPatterned::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) else { zeus::CColor col2 = col; - col2.a = alpha / 255.f; + col2.a() = alpha / 255.f; xb4_drawFlags = CModelFlags(5, 0, 3, col2); } } else { - if (col.r != 0.f || col.g != 0.f || col.b != 0.f) + if (col.r() != 0.f || col.g() != 0.f || col.b() != 0.f) { /* Being damaged */ zeus::CColor col2 = col; - col2.a = alpha / 255.f; + col2.a() = alpha / 255.f; xb4_drawFlags = CModelFlags(2, 0, 3, col2); } else diff --git a/Runtime/World/CPatterned.hpp b/Runtime/World/CPatterned.hpp index a7d1a7cc9..5575eb3ff 100644 --- a/Runtime/World/CPatterned.hpp +++ b/Runtime/World/CPatterned.hpp @@ -392,7 +392,7 @@ public: virtual void ThinkAboutMove(float); virtual CPathFindSearch* GetSearchPath() { return nullptr; } virtual CDamageInfo GetContactDamage() const { return x404_contactDamage; } - virtual u8 GetModelAlphau8(const CStateManager&) const { return u8(x42c_color.a * 255);} + virtual u8 GetModelAlphau8(const CStateManager&) const { return u8(x42c_color.a() * 255);} virtual bool IsOnGround() const { return x328_27_onGround; } virtual float GetGravityConstant() const { return 24.525002f; } virtual CProjectileInfo* GetProjectileInfo() { return nullptr; } @@ -415,7 +415,7 @@ public: void SetDestPos(const zeus::CVector3f& pos) { x2e0_destPos = pos; } void UpdateAlphaDelta(float dt, CStateManager& mgr); - void SetModelAlpha(float a) { x42c_color.a = a; } + void SetModelAlpha(float a) { x42c_color.a() = a; } float CalcDyingThinkRate(); void UpdateDamageColor(float dt); diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index d68e74722..10e3f38f0 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -207,10 +207,10 @@ void CPhysicsActor::MoveToWR(const zeus::CVector3f& trans, float d) zeus::CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const { - if (q.w > 0.99999976) + if (q.w() > 0.99999976) return zeus::CAxisAngle::skZero; return (xf0_inertiaTensor * - (((2.f * std::acos(q.w)) * (1.f / d)) * x34_transform.rotate({q.x, q.y, q.z}).normalized())); + (((2.f * std::acos(q.w())) * (1.f / d)) * x34_transform.rotate(q.getImaginary()).normalized())); } zeus::CVector3f CPhysicsActor::GetMoveToORImpulseWR(const zeus::CVector3f& trans, float d) const diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 6ac02eebf..429c9c9d5 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -107,12 +107,12 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& InitializeBallTransition(); zeus::CAABox ballTransAABB = x64_modelData->GetBounds(); - x2f0_ballTransHeight = ballTransAABB.max.z - ballTransAABB.min.z; + x2f0_ballTransHeight = ballTransAABB.max.z() - ballTransAABB.min.z(); SetCalculateLighting(true); x90_actorLights->SetCastShadows(true); - x50c_moveDir.z = 0.f; + x50c_moveDir.z() = 0.f; if (x50c_moveDir.canBeNormalized()) x50c_moveDir.normalize(); x2b4_accelerationTable.push_back(20.f); @@ -138,7 +138,7 @@ bool CPlayer::IsTransparent() const { return x588_alpha < 1.f; } float CPlayer::GetTransitionAlpha(const zeus::CVector3f& camPos, float zNear) const { - float zLimit = (x2d8_fpBounds.max.x - x2d8_fpBounds.min.x) * 0.5f + zNear; + float zLimit = (x2d8_fpBounds.max.x() - x2d8_fpBounds.min.x()) * 0.5f + zNear; float zStart = 1.f + zLimit; float dist = (camPos - GetEyePosition()).magnitude(); if (dist >= zLimit && dist <= zStart) @@ -162,11 +162,11 @@ s32 CPlayer::ChooseTransitionToAnimation(float dt, CStateManager& mgr) const return 3; // B_airposetoball_samus zeus::CVector3f localVel = x34_transform.transposeRotate(x138_velocity); zeus::CVector3f localVelFlat = localVel; - localVelFlat.z = 0.f; + localVelFlat.z() = 0.f; float localVelFlatMag = localVelFlat.magnitude(); if (localVelFlatMag > 1.f) { - zeus::CRelAngle velAng = std::atan2(localVelFlat.x, localVelFlat.y); + zeus::CRelAngle velAng = std::atan2(localVelFlat.x(), localVelFlat.y()); float velDeg = velAng.asDegrees(); if (velDeg < 45.f || velDeg > 315.f) { @@ -205,7 +205,7 @@ void CPlayer::TransitionToMorphBallState(float dt, CStateManager& mgr) SetCameraState(EPlayerCameraState::Transitioning, mgr); x500_lookDir = x34_transform.basis[1]; x50c_moveDir = x500_lookDir; - x50c_moveDir.z = 0.f; + x50c_moveDir.z() = 0.f; if (x50c_moveDir.canBeNormalized()) { x50c_moveDir.normalize(); @@ -241,7 +241,7 @@ void CPlayer::TransitionToMorphBallState(float dt, CStateManager& mgr) void CPlayer::TransitionFromMorphBallState(CStateManager& mgr) { x584_ballTransitionAnim = 14; // B_ball_unfurl - x58c_transitionVel = zeus::CVector2f(x138_velocity.x, x138_velocity.y).magnitude(); + x58c_transitionVel = zeus::CVector2f(x138_velocity.x(), x138_velocity.y()).magnitude(); if (x58c_transitionVel < 1.f) x584_ballTransitionAnim = 5; // ballstationarytoready_random if (x258_movementState != EPlayerMovementState::OnGround) @@ -268,7 +268,7 @@ void CPlayer::TransitionFromMorphBallState(CStateManager& mgr) { camToPlayer.normalize(); zeus::CVector3f vecFlat = x500_lookDir; - vecFlat.z = 0.f; + vecFlat.z() = 0.f; zeus::CVector3f f31 = vecFlat.canBeNormalized() && vecFlat.magnitude() >= 0.1f ? x518_leaveMorphDir : camToPlayer; if (x9c6_26_outOfBallLookAtHint) @@ -276,7 +276,7 @@ void CPlayer::TransitionFromMorphBallState(CStateManager& mgr) if (TCastToConstPtr hint = mgr.GetObjectById(x830_playerHint)) { zeus::CVector3f deltaFlat = hint->GetTranslation() - GetTranslation(); - deltaFlat.z = 0.f; + deltaFlat.z() = 0.f; if (deltaFlat.canBeNormalized()) f31 = deltaFlat.normalized(); } @@ -288,7 +288,7 @@ void CPlayer::TransitionFromMorphBallState(CStateManager& mgr) if (TCastToConstPtr act = mgr.GetObjectById(hint->GetActorId())) { zeus::CVector3f deltaFlat = act->GetOrbitPosition(mgr) - GetTranslation(); - deltaFlat.z = 0.f; + deltaFlat.z() = 0.f; if (deltaFlat.canBeNormalized()) f31 = deltaFlat.normalized(); } @@ -315,14 +315,14 @@ void CPlayer::TransitionFromMorphBallState(CStateManager& mgr) if (ballCam->GetTooCloseActorDistance() < 20.f && ballCam->GetTooCloseActorDistance() > 1.f) { zeus::CVector3f deltaFlat = act->GetTranslation() - GetTranslation(); - deltaFlat.z = 0.f; + deltaFlat.z() = 0.f; zeus::CVector3f deltaFlat2 = act->GetTranslation() - ballCam->GetTranslation(); - deltaFlat2.z = 0.f; + deltaFlat2.z() = 0.f; if (deltaFlat.canBeNormalized() && deltaFlat2.canBeNormalized()) { deltaFlat.normalize(); zeus::CVector3f camLookFlat = ballCam->GetTransform().basis[1]; - camLookFlat.z = 0.f; + camLookFlat.z() = 0.f; camLookFlat.normalize(); deltaFlat2.normalize(); if (deltaFlat.dot(deltaFlat2) >= 0.3f && deltaFlat2.dot(camLookFlat) >= 0.7f) @@ -354,7 +354,7 @@ void CPlayer::TransitionFromMorphBallState(CStateManager& mgr) s32 CPlayer::GetNextBallTransitionAnim(float dt, bool& loopOut, CStateManager& mgr) { loopOut = false; - zeus::CVector2f vel(x138_velocity.x, x138_velocity.y); + zeus::CVector2f vel(x138_velocity.x(), x138_velocity.y()); if (!vel.canBeNormalized()) return 12; // B_ball_ready_samus float velMag = vel.magnitude(); @@ -408,7 +408,7 @@ void CPlayer::UpdateMorphBallTransition(float dt, CStateManager& mgr) else if (x584_ballTransitionAnim != 5 && x584_ballTransitionAnim != 7) // ballstationarytoready_random, B_balljumptoairpose { - float velMag = zeus::CVector2f(x138_velocity.x, x138_velocity.y).magnitude(); + float velMag = zeus::CVector2f(x138_velocity.x(), x138_velocity.y()).magnitude(); if (std::fabs(x58c_transitionVel - velMag) > 0.04f * GetActualFirstPersonMaxVelocity(dt) || velMag < 1.f) { bool loop = false; @@ -758,7 +758,7 @@ float CPlayer::GetAcceleration() const float CPlayer::CalculateOrbitMinDistance(EPlayerOrbitType type) const { - return zeus::clamp(1.f, std::fabs(x314_orbitPoint.z - GetTranslation().z) / 20.f, 4.f) * + return zeus::clamp(1.f, std::fabs(x314_orbitPoint.z() - GetTranslation().z()) / 20.f, 4.f) * g_tweakPlayer->GetOrbitMinDistance(int(type)); } @@ -880,9 +880,9 @@ zeus::CVector3f CPlayer::GetAimPosition(const CStateManager& mgr, float dt) cons } if (x2f8_morphBallState == EPlayerMorphBallState::Morphed) - ret.z += g_tweakPlayer->GetPlayerBallHalfExtent(); + ret.z() += g_tweakPlayer->GetPlayerBallHalfExtent(); else - ret.z += GetEyeHeight(); + ret.z() += GetEyeHeight(); return ret; } @@ -900,7 +900,7 @@ void CPlayer::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager if (mgr.GetFluidPlaneManager()->GetLastSplashDeltaTime(x8_uid) >= 0.2f) { zeus::CVector3f position(x34_transform.origin); - position.z = water.GetTriggerBoundsWR().max.z; + position.z() = float(water.GetTriggerBoundsWR().max.z()); mgr.GetFluidPlaneManager()->CreateSplash(x8_uid, mgr, water, position, 0.1f, state == EFluidState::EnteredFluid); } @@ -921,14 +921,14 @@ void CPlayer::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager { zeus::CVector3f lookDir = x34_transform.basis[1].normalized(); zeus::CVector3f dcVel = GetDampedClampedVelocityWR(); - dcVel.z = 0.f; + dcVel.z() = 0.f; if (lookDir.dot(dcVel.normalized()) > 0.75f) doSplash = false; } if (doSplash) { zeus::CVector3f position = x34_transform.origin + posOffset; - position.z = water.GetTriggerBoundsWR().max.z; + position.z() = float(water.GetTriggerBoundsWR().max.z()); mgr.GetFluidPlaneManager()->CreateSplash(x8_uid, mgr, water, position, 0.3f, true); if (water.GetFluidPlane().GetFluidType() == EFluidType::NormalWater) { @@ -944,7 +944,7 @@ void CPlayer::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager mgr.GetFluidPlaneManager()->GetLastRippleDeltaTime(x8_uid) >= 0.2f) { zeus::CVector3f position(x34_transform.origin); - position.z = water.GetTriggerBoundsWR().max.z; + position.z() = float(water.GetTriggerBoundsWR().max.z()); water.GetFluidPlane().AddRipple(0.5f, x8_uid, position, water, mgr); } break; @@ -952,7 +952,7 @@ void CPlayer::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager case EFluidState::LeftFluid: { zeus::CVector3f position = x34_transform.origin + posOffset; - position.z = water.GetTriggerBoundsWR().max.z; + position.z() = float(water.GetTriggerBoundsWR().max.z()); mgr.GetFluidPlaneManager()->CreateSplash(x8_uid, mgr, water, position, 0.15f, true); break; } @@ -1664,13 +1664,13 @@ void CPlayer::UpdateFreeLookState(const CFinalInput& input, float dt, CStateMana { zeus::CVector3f lookDir = mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().basis[1]; zeus::CVector3f lookDirFlat = lookDir; - lookDirFlat.z = 0.f; + lookDirFlat.z() = 0.f; x3e4_freeLookYawAngle = 0.f; if (lookDirFlat.canBeNormalized()) { lookDirFlat.normalize(); x3ec_freeLookPitchAngle = std::acos(zeus::clamp(-1.f, lookDirFlat.dot(lookDir), 1.f)); - if (lookDir.z < 0.f) + if (lookDir.z() < 0.f) x3ec_freeLookPitchAngle = -x3ec_freeLookPitchAngle; } } @@ -1971,7 +1971,7 @@ void CPlayer::CalculatePlayerControlDirection(CStateManager& mgr) { x540_controlDir = x9d8_controlDirOverrideDir.normalized(); x54c_controlDirFlat = x9d8_controlDirOverrideDir; - x54c_controlDirFlat.z = 0.f; + x54c_controlDirFlat.z() = 0.f; if (x54c_controlDirFlat.canBeNormalized()) x54c_controlDirFlat.normalize(); else @@ -1992,7 +1992,7 @@ void CPlayer::CalculatePlayerControlDirection(CStateManager& mgr) } else { - zeus::CVector3f camToPlayerFlat(camToPlayer.x, camToPlayer.y, 0.f); + zeus::CVector3f camToPlayerFlat(camToPlayer.x(), camToPlayer.y(), 0.f); if (camToPlayerFlat.canBeNormalized()) { if (camToPlayerFlat.magnitude() > g_tweakBall->GetBallCameraControlDistance()) @@ -2009,7 +2009,7 @@ void CPlayer::CalculatePlayerControlDirection(CStateManager& mgr) default: x540_controlDir = GetTransform().basis[1]; x54c_controlDirFlat = x540_controlDir; - x54c_controlDirFlat.z = 0.f; + x54c_controlDirFlat.z() = 0.f; if (x54c_controlDirFlat.canBeNormalized()) x54c_controlDirFlat.normalize(); } @@ -2017,7 +2017,7 @@ void CPlayer::CalculatePlayerControlDirection(CStateManager& mgr) else if (x2f8_morphBallState != EPlayerMorphBallState::Morphed) { x540_controlDir = GetTransform().basis[1]; - x54c_controlDirFlat.z = 0.f; + x54c_controlDirFlat.z() = 0.f; if (x54c_controlDirFlat.canBeNormalized()) x54c_controlDirFlat.normalize(); } @@ -2032,7 +2032,7 @@ void CPlayer::CalculatePlayerControlDirection(CStateManager& mgr) else if (x2f8_morphBallState != EPlayerMorphBallState::Morphed) { x540_controlDir = GetTransform().basis[1]; - x54c_controlDirFlat.z = 0.f; + x54c_controlDirFlat.z() = 0.f; if (x54c_controlDirFlat.canBeNormalized()) x54c_controlDirFlat.normalize(); } @@ -2054,7 +2054,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt) x53c_timeMoving += dt; x4f8_moveSpeed = std::fabs(delta.magnitude() / dt); x500_lookDir = delta.normalized(); - zeus::CVector3f flatDelta(delta.x, delta.y, 0.f); + zeus::CVector3f flatDelta(delta.x(), delta.y(), 0.f); if (flatDelta.canBeNormalized()) { x4fc_flatMoveSpeed = std::fabs(flatDelta.magnitude() / dt); @@ -2070,7 +2070,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt) default: x500_lookDir = GetTransform().basis[1]; x50c_moveDir = x500_lookDir; - x50c_moveDir.z = 0.f; + x50c_moveDir.z() = 0.f; if (x50c_moveDir.canBeNormalized()) x50c_moveDir.normalize(); x530_gunDir = x50c_moveDir; @@ -2084,7 +2084,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt) { x500_lookDir = GetTransform().basis[1]; x50c_moveDir = x500_lookDir; - x50c_moveDir.z = 0.f; + x50c_moveDir.z() = 0.f; if (x50c_moveDir.canBeNormalized()) x50c_moveDir.normalize(); x530_gunDir = x50c_moveDir; @@ -2106,7 +2106,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt) default: x500_lookDir = GetTransform().basis[1]; x50c_moveDir = x500_lookDir; - x50c_moveDir.z = 0.f; + x50c_moveDir.z() = 0.f; if (x50c_moveDir.canBeNormalized()) x50c_moveDir.normalize(); x530_gunDir = x50c_moveDir; @@ -2117,7 +2117,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt) x4fc_flatMoveSpeed = 0.f; } - x50c_moveDir.z = 0.f; + x50c_moveDir.z() = 0.f; if (x50c_moveDir.canBeNormalized()) x500_lookDir.normalize(); } @@ -2239,7 +2239,7 @@ void CPlayer::UpdateFrozenState(const CFinalInput& input, CStateManager& mgr) void CPlayer::UpdateStepCameraZBias(float dt) { - float newBias = GetTranslation().z + GetUnbiasedEyeHeight(); + float newBias = GetTranslation().z() + GetUnbiasedEyeHeight(); if (x258_movementState == EPlayerMovementState::OnGround && !IsMorphBallTransitioning()) { float oldBias = newBias; @@ -2249,7 +2249,7 @@ void CPlayer::UpdateStepCameraZBias(float dt) float newDelta = 5.f * dt; if (delta > 0.f) { - if (delta > dt * x138_velocity.z && delta > newDelta) + if (delta > dt * x138_velocity.z() && delta > newDelta) { if (delta > GetStepUpHeight()) newDelta += delta - GetStepUpHeight(); @@ -2258,7 +2258,7 @@ void CPlayer::UpdateStepCameraZBias(float dt) } else { - if (delta < dt * x138_velocity.z && delta < -newDelta) + if (delta < dt * x138_velocity.z() && delta < -newDelta) { if (delta < -GetStepDownHeight()) newDelta += -delta - GetStepDownHeight(); @@ -2280,8 +2280,8 @@ void CPlayer::UpdateWaterSurfaceCameraBias(CStateManager& mgr) { if (TCastToConstPtr water = mgr.GetObjectById(xc4_fluidId)) { - float waterZ = water->GetTriggerBoundsWR().max.z; - float biasToEyeDelta = GetEyePosition().z - x9c8_eyeZBias; + float waterZ = water->GetTriggerBoundsWR().max.z(); + float biasToEyeDelta = GetEyePosition().z() - x9c8_eyeZBias; float waterToDeltaDelta = biasToEyeDelta - waterZ; if (biasToEyeDelta >= waterZ && waterToDeltaDelta <= 0.25f) x9c8_eyeZBias += waterZ + 0.25f - biasToEyeDelta; @@ -2590,7 +2590,7 @@ void CPlayer::UpdateBombJumpStuff() return; zeus::CVector3f velFlat = x138_velocity; - velFlat.z = 0.f; + velFlat.z() = 0.f; if (x258_movementState == EPlayerMovementState::OnGround || (velFlat.canBeNormalized() && velFlat.magnitude() > 6.f)) x9d0_bombJumpCount = 0; @@ -2618,11 +2618,11 @@ void CPlayer::UpdateTransitionFilter(float dt, CStateManager& mgr) float time = x824_transitionFilterTimer - 0.95f; zeus::CColor color(1.f, 0.87f, 0.54f, 1.f); if (time < 0.1f) - color.a = 0.3f * time / 0.1f; + color.a() = 0.3f * time / 0.1f; else if (time >= 0.15f) - color.a = 1.f - zeus::clamp(-1.f, (time - 0.15f) / 0.15f, 1.f) * 0.3f; + color.a() = 1.f - zeus::clamp(-1.f, (time - 0.15f) / 0.15f, 1.f) * 0.3f; else - color.a = 0.3f; + color.a() = 0.3f; mgr.GetCameraFilterPass(8).SetFilter(EFilterType::Add, EFilterShape::ScanLinesEven, 0.f, color, {}); } @@ -2733,11 +2733,11 @@ void CPlayer::Think(float dt, CStateManager& mgr) if (x2f8_morphBallState != EPlayerMorphBallState::Morphed) { - if (std::fabs(x34_transform.basis[0].z) > FLT_EPSILON || - std::fabs(x34_transform.basis[1].z) > FLT_EPSILON) + if (std::fabs(x34_transform.basis[0].z()) > FLT_EPSILON || + std::fabs(x34_transform.basis[1].z()) > FLT_EPSILON) { zeus::CVector3f backupTranslation = GetTranslation(); - zeus::CVector3f lookDirFlat(x34_transform.basis[1].x, x34_transform.basis[1].y, 0.f); + zeus::CVector3f lookDirFlat(x34_transform.basis[1].x(), x34_transform.basis[1].y(), 0.f); if (lookDirFlat.canBeNormalized()) { SetTransform(zeus::lookAt(zeus::CVector3f::skZero, lookDirFlat.normalized())); @@ -2831,9 +2831,9 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState { float hardThres = 30.f * 2.f * -g_tweakPlayer->GetNormalGravAccel(); hardThres = (hardThres != 0.f) ? hardThres * std::sqrt(hardThres) : 0.f; - float landVol = zeus::clamp(95.f, 1.6f * -x794_lastVelocity.z + 95.f, 127.f) / 127.f; + float landVol = zeus::clamp(95.f, 1.6f * -x794_lastVelocity.z() + 95.f, 127.f) / 127.f; u16 landSfx; - if (-x794_lastVelocity.z < hardThres) + if (-x794_lastVelocity.z() < hardThres) { landSfx = GetMaterialSoundUnderPlayer(mgr, skPlayerLandSfxSoft, 24, 0xffff); } @@ -2853,7 +2853,7 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState CSfxManager::SfxStart(landSfx, landVol, 0.f, false, 0x7f, false, kInvalidAreaId); ApplySubmergedPitchBend(handle); - float rumbleMag = -x794_lastVelocity.z / 110.f; + float rumbleMag = -x794_lastVelocity.z() / 110.f; if (rumbleMag > 0.f) { if (std::fabs(rumbleMag) > 0.8f) @@ -2867,22 +2867,22 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState else if (x258_movementState != EPlayerMovementState::OnGround && x2f8_morphBallState == EPlayerMorphBallState::Morphed) { - if (x138_velocity.z < -40.f && !x768_morphball->GetIsInHalfPipeMode() && + if (x138_velocity.z() < -40.f && !x768_morphball->GetIsInHalfPipeMode() && x258_movementState == EPlayerMovementState::ApplyJump && x300_fallingTime > 0.75f) SetCoefficientOfRestitutionModifier(0.2f); x768_morphball->StartLandingSfx(); - if (x138_velocity.z < -5.f) + if (x138_velocity.z() < -5.f) { - float rumbleMag = -x138_velocity.z / 110.f * 0.5f; + float rumbleMag = -x138_velocity.z() / 110.f * 0.5f; if (std::fabs(rumbleMag) > 0.8f) rumbleMag = (rumbleMag > 0.f) ? 0.8f : -0.8f; mgr.GetRumbleManager().Rumble(mgr, ERumbleFxId::PlayerLand, rumbleMag, ERumblePriority::One); x2a0_ = 0.f; } - if (x138_velocity.z < -30.f) + if (x138_velocity.z() < -30.f) { - float rumbleMag = -x138_velocity.z / 110.f; + float rumbleMag = -x138_velocity.z() / 110.f; if (std::fabs(rumbleMag) > 0.8f) rumbleMag = (rumbleMag > 0.f) ? 0.8f : -0.8f; mgr.GetRumbleManager().Rumble(mgr, ERumbleFxId::PlayerLand, rumbleMag, ERumblePriority::One); @@ -3342,8 +3342,8 @@ void CPlayer::UpdateArmAndGunTransforms(float dt, CStateManager& mgr) gunOffset = g_tweakPlayerGun->GetGunPosition(); grappleOffset = x490_gun->GetGrappleArm().IsArmMoving() ? zeus::CVector3f::skZero : g_tweakPlayerGun->GetGrapplingArmPosition(); - gunOffset.z += GetEyeHeight(); - grappleOffset.z += GetEyeHeight(); + gunOffset.z() += GetEyeHeight(); + grappleOffset.z() += GetEyeHeight(); } UpdateGunTransform(gunOffset + x76c_cameraBob->GetGunBobTransformation().origin, mgr); @@ -3515,17 +3515,17 @@ void CPlayer::UpdateAssistedAiming(const zeus::CTransform& xf, const CStateManag { zeus::CVector3f gunToTarget = x480_assistedTargetAim - xf.origin; zeus::CVector3f gunToTargetFlat = gunToTarget; - gunToTargetFlat.z = 0.f; + gunToTargetFlat.z() = 0.f; float gunToTargetFlatMag = gunToTargetFlat.magnitude(); zeus::CVector3f gunDirFlat = xf.basis[1]; - gunDirFlat.z = 0.f; + gunDirFlat.z() = 0.f; float gunDirFlatMag = gunDirFlat.magnitude(); if (gunToTargetFlat.canBeNormalized() && gunDirFlat.canBeNormalized()) { gunToTargetFlat = gunToTargetFlat / gunToTargetFlatMag; gunDirFlat = gunDirFlat / gunDirFlatMag; - float vAngleDelta = std::atan2(gunToTarget.z, gunToTargetFlatMag) - - std::atan2(xf.basis[1].z, gunDirFlatMag); + float vAngleDelta = std::atan2(gunToTarget.z(), gunToTargetFlatMag) - + std::atan2(xf.basis[1].z(), gunDirFlatMag); bool hasVAngleDelta = true; if (!x9c6_27_aimingAtProjectile && std::fabs(vAngleDelta) > g_tweakPlayer->GetAimAssistVerticalAngle()) { @@ -3544,7 +3544,7 @@ void CPlayer::UpdateAssistedAiming(const zeus::CTransform& xf, const CStateManag } } - bool targetToLeft = gunDirFlat.cross(gunToTargetFlat).z > 0.f; + bool targetToLeft = gunDirFlat.cross(gunToTargetFlat).z() > 0.f; float hAngleDelta = std::acos(zeus::clamp(-1.f, gunDirFlat.dot(gunToTargetFlat), 1.f)); bool hasHAngleDelta = true; if (!x9c6_27_aimingAtProjectile && std::fabs(hAngleDelta) > g_tweakPlayer->GetAimAssistHorizontalAngle()) @@ -3566,9 +3566,9 @@ void CPlayer::UpdateAssistedAiming(const zeus::CTransform& xf, const CStateManag hAngleDelta = 0.f; } - gunToTarget.x = std::sin(hAngleDelta) * std::cos(vAngleDelta); - gunToTarget.y = std::cos(hAngleDelta) * std::cos(vAngleDelta); - gunToTarget.z = std::sin(vAngleDelta); + gunToTarget.x() = std::sin(hAngleDelta) * std::cos(vAngleDelta); + gunToTarget.y() = std::cos(hAngleDelta) * std::cos(vAngleDelta); + gunToTarget.z() = std::sin(vAngleDelta); gunToTarget = xf.rotate(gunToTarget); assistXf = zeus::lookAt(zeus::CVector3f::skZero, gunToTarget, zeus::CVector3f::skUp); } @@ -3668,7 +3668,7 @@ void CPlayer::UpdateGrappleArmTransform(const zeus::CVector3f& offset, CStateMan { armToTarget = target->GetTranslation() - armPosition; zeus::CVector3f armToTargetFlat = armToTarget; - armToTargetFlat.z = 0.f; + armToTargetFlat.z() = 0.f; if (armToTarget.canBeNormalized()) armToTarget.normalize(); if (armToTargetFlat.canBeNormalized() && x3b8_grappleState != EGrappleState::Firing) @@ -3733,10 +3733,10 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f { CMotionState mState = PredictMotion(dt); zeus::CVector3f lookDirFlat = x34_transform.basis[1]; - lookDirFlat.z = 0.f; + lookDirFlat.z() = 0.f; zeus::CVector3f newPlayerToPointFlat = point->GetTranslation() - (GetTranslation() + mState.x0_translation); - newPlayerToPointFlat.z = 0.f; + newPlayerToPointFlat.z() = 0.f; if (lookDirFlat.canBeNormalized()) lookDirFlat.normalize(); if (newPlayerToPointFlat.canBeNormalized()) @@ -3748,7 +3748,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f float deltaAngle = dt * g_tweakPlayer->GetGrappleLookCenterSpeed(); if (lookToPointAngle >= deltaAngle) { - zeus::CVector3f leftDirFlat(lookDirFlat.y, -lookDirFlat.x, 0.f); + zeus::CVector3f leftDirFlat(lookDirFlat.y(), -lookDirFlat.x(), 0.f); if (leftDirFlat.canBeNormalized()) leftDirFlat.normalize(); if (newPlayerToPointFlat.dot(leftDirFlat) >= 0.f) @@ -3784,7 +3784,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f turnAngleSpeed *= -1.f; zeus::CVector3f pointToPlayer = GetTranslation() - point->GetTranslation(); float pointToPlayerZProj = - zeus::clamp(-1.f, std::fabs(pointToPlayer.z / pointToPlayer.magnitude()), 1.f); + zeus::clamp(-1.f, std::fabs(pointToPlayer.z() / pointToPlayer.magnitude()), 1.f); bool enableTurn = false; if (!point->GetGrappleParameters().GetLockSwingTurn()) @@ -3850,9 +3850,9 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f if (pointToPlayer.magSquared() > 0.04f) { zeus::CVector3f pointToPlayerFlat = pointToPlayer; - pointToPlayerFlat.z = 0.f; + pointToPlayerFlat.z() = 0.f; zeus::CVector3f pointAtPlayerHeight = point->GetTranslation(); - pointAtPlayerHeight.z = GetTranslation().z; + pointAtPlayerHeight.z() = GetTranslation().z(); zeus::CVector3f playerToGrapplePlane = pointAtPlayerHeight + turnRot.transform(pointToPlayerFlat) - GetTranslation(); if (playerToGrapplePlane.canBeNormalized()) @@ -3861,7 +3861,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f zeus::CVector3f swingAxisBackup = x3c0_grappleSwingAxis; x3c0_grappleSwingAxis = turnRot.transform(x3c0_grappleSwingAxis); x3c0_grappleSwingAxis.normalize(); - zeus::CVector3f swingForward(-x3c0_grappleSwingAxis.y, x3c0_grappleSwingAxis.x, 0.f); + zeus::CVector3f swingForward(-x3c0_grappleSwingAxis.y(), x3c0_grappleSwingAxis.x(), 0.f); SetTransform( zeus::CTransform(x3c0_grappleSwingAxis, swingForward, zeus::CVector3f::skUp, GetTranslation())); SetVelocityWR(pullVec); @@ -3891,7 +3891,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f } } - zeus::CVector3f newAngVel = {0.f, 0.f, 0.9f * GetAngularVelocityOR().getVector().z}; + zeus::CVector3f newAngVel = {0.f, 0.f, 0.9f * GetAngularVelocityOR().getVector().z()}; SetAngularVelocityOR(newAngVel); } @@ -3926,7 +3926,7 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr) zeus::CVector3f eyePosition = GetEyePosition(); zeus::CVector3f playerToPoint = point->GetTranslation() - eyePosition; zeus::CVector3f playerToPointFlat = playerToPoint; - playerToPointFlat.z = 0.f; + playerToPointFlat.z() = 0.f; if (playerToPoint.canBeNormalized() && playerToPointFlat.canBeNormalized() && playerToPointFlat.magnitude() > 2.f) { @@ -3942,12 +3942,12 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr) if (TCastToPtr point2 = mgr.ObjectById(x33c_orbitNextTargetId)) { playerToPoint = point2->GetTranslation() - eyePosition; - playerToPoint.z = 0.f; + playerToPoint.z() = 0.f; if (playerToPoint.canBeNormalized()) { x490_gun->GetGrappleArm().GrappleBeamDisconnected(); - x3c0_grappleSwingAxis.x = playerToPoint.y; - x3c0_grappleSwingAxis.y = -playerToPoint.x; + x3c0_grappleSwingAxis.x() = float(playerToPoint.y()); + x3c0_grappleSwingAxis.y() = -playerToPoint.x(); x3c0_grappleSwingAxis.normalize(); x3bc_grappleSwingTimer = 0.f; SetOrbitTargetId(x33c_orbitNextTargetId, mgr); @@ -4142,7 +4142,7 @@ void CPlayer::ApplyGrappleJump(CStateManager& mgr) tmp *= zeus::CVector3f::skNegOne; zeus::CVector3f pointToPlayer = GetTranslation() - point->GetTranslation(); zeus::CVector3f cross = pointToPlayer.normalized().cross(tmp); - zeus::CVector3f pointToPlayerFlat(pointToPlayer.x, pointToPlayer.y, 0.f); + zeus::CVector3f pointToPlayerFlat(pointToPlayer.x(), pointToPlayer.y(), 0.f); float dot = 1.f; if (pointToPlayerFlat.canBeNormalized() && cross.canBeNormalized()) dot = zeus::clamp(-1.f, std::fabs(cross.normalized().dot(pointToPlayerFlat.normalized())), 1.f); @@ -4152,11 +4152,11 @@ void CPlayer::ApplyGrappleJump(CStateManager& mgr) void CPlayer::BeginGrapple(zeus::CVector3f& vec, CStateManager& mgr) { - vec.z = 0.f; + vec.z() = 0.f; if (vec.canBeNormalized()) { - x3c0_grappleSwingAxis.x = vec.y; - x3c0_grappleSwingAxis.y = -vec.x; + x3c0_grappleSwingAxis.x() = float(vec.y()); + x3c0_grappleSwingAxis.y() = -vec.x(); x3c0_grappleSwingAxis.normalize(); x3bc_grappleSwingTimer = 0.f; SetOrbitState(EPlayerOrbitState::Grapple, mgr); @@ -4326,8 +4326,8 @@ void CPlayer::UpdateOrbitZPosition() { if (x304_orbitState == EPlayerOrbitState::OrbitPoint) { - if (std::fabs(x320_orbitVector.z) < g_tweakPlayer->GetOrbitZRange()) - x314_orbitPoint.z = x320_orbitVector.z + x34_transform.origin.z + GetEyeHeight(); + if (std::fabs(x320_orbitVector.z()) < g_tweakPlayer->GetOrbitZRange()) + x314_orbitPoint.z() = x320_orbitVector.z() + x34_transform.origin.z() + GetEyeHeight(); } } @@ -4347,7 +4347,7 @@ void CPlayer::SetOrbitPosition(float dist, CStateManager& mgr) if (std::fabs(dot) > 1.f) dot = (dot > 0.f) ? 1.f : -1.f; x314_orbitPoint = camXf.rotate(zeus::CVector3f(0.f, dist / dot, 0.f)) + camXf.origin; - x320_orbitVector = zeus::CVector3f(0.f, dist, x314_orbitPoint.z - camXf.origin.z); + x320_orbitVector = zeus::CVector3f(0.f, dist, x314_orbitPoint.z() - camXf.origin.z()); } void CPlayer::UpdateAimTarget(CStateManager& mgr) @@ -4455,9 +4455,9 @@ bool CPlayer::ValidateAimTargetId(TUniqueId uid, CStateManager& mgr) zeus::CVector3f eyePos = GetEyePosition(); zeus::CVector3f eyeToAim = aimPos - eyePos; zeus::CVector3f screenPos = mgr.GetCameraManager()->GetFirstPersonCamera()->ConvertToScreenSpace(aimPos); - zeus::CVector3f posInBox(vpWHalf + screenPos.x * vpWHalf, - vpHHalf + screenPos.y * vpHHalf, - screenPos.z); + zeus::CVector3f posInBox(vpWHalf + screenPos.x() * vpWHalf, + vpHHalf + screenPos.y() * vpHHalf, + screenPos.z()); if (WithinOrbitScreenBox(posInBox, x330_orbitZoneMode, x334_orbitType) || (x330_orbitZoneMode != EPlayerZoneInfo::Targeting && WithinOrbitScreenBox(posInBox, EPlayerZoneInfo::Targeting, x334_orbitType))) @@ -4591,9 +4591,9 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vectorGetAimPosition(mgr, 0.f); zeus::CVector3f screenPos = fpCam->ConvertToScreenSpace(aimPos); - zeus::CVector3f posInBox(vpWHalf + screenPos.x * vpWHalf, - vpHHalf + screenPos.y * vpHHalf, - screenPos.z); + zeus::CVector3f posInBox(vpWHalf + screenPos.x() * vpWHalf, + vpHHalf + screenPos.y() * vpHHalf, + screenPos.z()); if (WithinOrbitScreenBox(posInBox, info, zone)) { zeus::CVector3f eyeToAim = aimPos - eyePos; @@ -4614,16 +4614,16 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vectorGetUniqueId(); - float posInBoxLeft = posInBox.x - boxLeft; - float posInBoxTop = posInBox.y - boxTop; + float posInBoxLeft = posInBox.x() - boxLeft; + float posInBoxTop = posInBox.y() - boxTop; minEyeToAimMag = eyeToAimMag; minPosInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; } } else if (std::fabs(eyeToAimMag - minEyeToAimMag) < g_tweakPlayer->GetAimThresholdDistance()) { - float posInBoxLeft = posInBox.x - boxLeft; - float posInBoxTop = posInBox.y - boxTop; + float posInBoxLeft = posInBox.x() - boxLeft; + float posInBoxTop = posInBox.y() - boxTop; float posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; if (posInBoxMagSq < minPosInBoxMagSq) { @@ -4706,7 +4706,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, zeus::CVector3f eyeToOrbit = orbitPos - eyePos; float eyeToOrbitMag = eyeToOrbit.magnitude(); zeus::CVector3f orbitPosScreen = fpCam->ConvertToScreenSpace(orbitPos); - if (orbitPosScreen.z >= 0.f) + if (orbitPosScreen.z() >= 0.f) { if (x310_orbitTargetId != id) { @@ -4735,7 +4735,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, GetTranslation() - point->GetTranslation(); if (pointToPlayer.canBeNormalized()) { - pointToPlayer.z = 0.f; + pointToPlayer.z() = 0.f; if (std::fabs(point->GetTransform().basis[1].normalized(). dot(pointToPlayer.normalized())) <= M_SQRT1_2F) continue; @@ -4743,8 +4743,8 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, } bestId = act->GetUniqueId(); - float posInBoxLeft = orbitPosScreen.x - boxLeft; - float posInBoxTop = orbitPosScreen.y - boxTop; + float posInBoxLeft = orbitPosScreen.x() - boxLeft; + float posInBoxTop = orbitPosScreen.y() - boxTop; minEyeToOrbitMag = eyeToOrbitMag; minPosInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; } @@ -4796,8 +4796,8 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, if (result.IsInvalid()) { bestId = act->GetUniqueId(); - float posInBoxLeft = orbitPosScreen.x - boxLeft; - float posInBoxTop = orbitPosScreen.y - boxTop; + float posInBoxLeft = orbitPosScreen.x() - boxLeft; + float posInBoxTop = orbitPosScreen.y() - boxTop; minEyeToOrbitMag = eyeToOrbitMag; minPosInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; } @@ -4808,8 +4808,8 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, g_tweakPlayer->GetOrbitDistanceThreshold() || mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan) { - float posInBoxLeft = orbitPosScreen.x - boxLeft; - float posInBoxTop = orbitPosScreen.y - boxTop; + float posInBoxLeft = orbitPosScreen.x() - boxLeft; + float posInBoxTop = orbitPosScreen.y() - boxTop; float posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; if (posInBoxMagSq < minPosInBoxMagSq) { @@ -4884,8 +4884,8 @@ void CPlayer::FindOrbitableObjects(const rstl::reserved_vector& continue; zeus::CVector3f orbitPos = act->GetOrbitPosition(mgr); zeus::CVector3f screenPos = fpCam->ConvertToScreenSpace(orbitPos); - screenPos.x = g_Viewport.x8_width * screenPos.x / 2.f + g_Viewport.x8_width / 2.f; - screenPos.y = g_Viewport.xc_height * screenPos.y / 2.f + g_Viewport.xc_height / 2.f; + screenPos.x() = g_Viewport.x8_width * screenPos.x() / 2.f + g_Viewport.x8_width / 2.f; + screenPos.y() = g_Viewport.xc_height * screenPos.y() / 2.f + g_Viewport.xc_height / 2.f; bool pass = false; if (onScreenTest) @@ -4909,17 +4909,17 @@ void CPlayer::FindOrbitableObjects(const rstl::reserved_vector& bool CPlayer::WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone, EPlayerZoneType type) const { - if (screenCoords.z >= 1.f) + if (screenCoords.z() >= 1.f) return false; switch (type) { case EPlayerZoneType::Box: - return std::fabs(screenCoords.x - GetOrbitScreenBoxCenterXScaled(int(zone))) < + return std::fabs(screenCoords.x() - GetOrbitScreenBoxCenterXScaled(int(zone))) < GetOrbitScreenBoxHalfExtentXScaled(int(zone)) && - std::fabs(screenCoords.y - GetOrbitScreenBoxCenterYScaled(int(zone))) < + std::fabs(screenCoords.y() - GetOrbitScreenBoxCenterYScaled(int(zone))) < GetOrbitScreenBoxHalfExtentYScaled(int(zone)) && - screenCoords.z < 1.f; + screenCoords.z() < 1.f; break; case EPlayerZoneType::Ellipse: return WithinOrbitScreenEllipse(screenCoords, zone); @@ -4932,15 +4932,15 @@ bool CPlayer::WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZ bool CPlayer::WithinOrbitScreenEllipse(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone) const { - if (screenCoords.z >= 1.f) + if (screenCoords.z() >= 1.f) return false; float heYSq = GetOrbitScreenBoxHalfExtentYScaled(int(zone)); heYSq *= heYSq; float heXSq = GetOrbitScreenBoxHalfExtentXScaled(int(zone)); heXSq *= heXSq; - float tmpY = std::fabs(screenCoords.y - GetOrbitScreenBoxCenterYScaled(int(zone))); - float tmpX = std::fabs(screenCoords.x - GetOrbitScreenBoxCenterXScaled(int(zone))); + float tmpY = std::fabs(screenCoords.y() - GetOrbitScreenBoxCenterYScaled(int(zone))); + float tmpX = std::fabs(screenCoords.x() - GetOrbitScreenBoxCenterXScaled(int(zone))); return tmpX * tmpX <= (1.f - tmpY * tmpY / heYSq) * heXSq; } @@ -5240,7 +5240,7 @@ void CPlayer::UpdateOrbitOrientation(CStateManager& mgr) zeus::CVector3f playerToPoint = x314_orbitPoint - GetTranslation(); if (!x374_orbitLockEstablished) playerToPoint = mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().basis[1]; - playerToPoint.z = 0.f; + playerToPoint.z() = 0.f; if (playerToPoint.canBeNormalized()) { zeus::CTransform xf = zeus::lookAt(zeus::CVector3f::skZero, playerToPoint); @@ -5261,7 +5261,7 @@ void CPlayer::UpdateOrbitTarget(CStateManager& mgr) if (!ValidateOrbitTargetIdAndPointer(x33c_orbitNextTargetId, mgr)) x33c_orbitNextTargetId = kInvalidUniqueId; zeus::CVector3f playerToPoint = x314_orbitPoint - GetTranslation(); - playerToPoint.z = 0.f; + playerToPoint.z() = 0.f; float playerToPointMag = playerToPoint.magnitude(); switch (x304_orbitState) @@ -5283,7 +5283,7 @@ void CPlayer::UpdateOrbitTarget(CStateManager& mgr) case EPlayerOrbitState::OrbitPoint: { if (g_tweakPlayer->GetOrbitFixedOffset() && - std::fabs(x320_orbitVector.z) > g_tweakPlayer->GetOrbitFixedOffsetZDiff()) + std::fabs(x320_orbitVector.z()) > g_tweakPlayer->GetOrbitFixedOffsetZDiff()) { UpdateOrbitFixedPosition(); return; @@ -5296,9 +5296,9 @@ void CPlayer::UpdateOrbitTarget(CStateManager& mgr) if (x3dd_lookButtonHeld) SetOrbitPosition(g_tweakPlayer->GetOrbitNormalDistance(int(x308_orbitType)), mgr); zeus::CVector3f eyeToPoint = x314_orbitPoint - GetEyePosition(); - float angleToPoint = std::asin(zeus::clamp(-1.f, std::fabs(eyeToPoint.z) / eyeToPoint.magnitude(), 1.f)); - if ((eyeToPoint.z >= 0.f && angleToPoint >= g_tweakPlayer->GetOrbitUpperAngle()) || - (eyeToPoint.z < 0.f && angleToPoint >= g_tweakPlayer->GetOrbitLowerAngle())) + float angleToPoint = std::asin(zeus::clamp(-1.f, std::fabs(eyeToPoint.z()) / eyeToPoint.magnitude(), 1.f)); + if ((eyeToPoint.z() >= 0.f && angleToPoint >= g_tweakPlayer->GetOrbitUpperAngle()) || + (eyeToPoint.z() < 0.f && angleToPoint >= g_tweakPlayer->GetOrbitLowerAngle())) SetOrbitRequest(EPlayerOrbitRequest::BadVerticalAngle, mgr); break; } @@ -5354,14 +5354,14 @@ CPlayer::EOrbitValidationResult CPlayer::ValidateOrbitTargetId(TUniqueId uid, CS zeus::CVector3f eyePos = GetEyePosition(); zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos; zeus::CVector3f eyeToOrbitFlat = eyeToOrbit; - eyeToOrbitFlat.z = 0.f; + eyeToOrbitFlat.z() = 0.f; if (eyeToOrbitFlat.canBeNormalized() && eyeToOrbitFlat.magnitude() > 1.f) { float angleFromHorizon = - std::asin(zeus::clamp(-1.f, std::fabs(eyeToOrbit.z) / eyeToOrbit.magnitude(), 1.f)); - if ((eyeToOrbit.z >= 0.f && angleFromHorizon >= g_tweakPlayer->GetOrbitUpperAngle()) || - (eyeToOrbit.z < 0.f && angleFromHorizon >= g_tweakPlayer->GetOrbitLowerAngle())) + std::asin(zeus::clamp(-1.f, std::fabs(eyeToOrbit.z()) / eyeToOrbit.magnitude(), 1.f)); + if ((eyeToOrbit.z() >= 0.f && angleFromHorizon >= g_tweakPlayer->GetOrbitUpperAngle()) || + (eyeToOrbit.z() < 0.f && angleFromHorizon >= g_tweakPlayer->GetOrbitLowerAngle())) return EOrbitValidationResult::ExtremeHorizonAngle; } else @@ -5449,7 +5449,7 @@ CPlayer::EOrbitValidationResult CPlayer::ValidateCurrentOrbitTargetId(CStateMana } zeus::CVector3f eyeToOrbitFlat = eyeToOrbit; - eyeToOrbitFlat.z = 0.f; + eyeToOrbitFlat.z() = 0.f; if (eyeToOrbitFlat.canBeNormalized()) { float lookToOrbitAngle = @@ -5493,12 +5493,12 @@ zeus::CVector3f CPlayer::GetEyePosition() const float CPlayer::GetEyeHeight() const { - return x9c8_eyeZBias + (x2d8_fpBounds.max.z - g_tweakPlayer->GetEyeOffset()); + return x9c8_eyeZBias + (x2d8_fpBounds.max.z() - g_tweakPlayer->GetEyeOffset()); } float CPlayer::GetUnbiasedEyeHeight() const { - return x2d8_fpBounds.max.z - g_tweakPlayer->GetEyeOffset(); + return x2d8_fpBounds.max.z() - g_tweakPlayer->GetEyeOffset(); } float CPlayer::GetStepUpHeight() const @@ -5624,7 +5624,7 @@ zeus::CTransform CPlayer::CreateTransformFromMovementDirection() const else moveDir = zeus::CVector3f::skForward; - return {zeus::CVector3f(moveDir.y, -moveDir.x, 0.f), moveDir, zeus::CVector3f::skUp, GetTranslation()}; + return {zeus::CVector3f(moveDir.y(), -moveDir.x(), 0.f), moveDir, zeus::CVector3f::skUp, GetTranslation()}; } const CCollisionPrimitive* CPlayer::GetCollisionPrimitive() const @@ -5810,7 +5810,7 @@ float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr) x380_strafeInputAtDash = StrafeInput(input); if (g_tweakPlayer->GetImpulseDoubleJump()) { - zeus::CVector3f impulse(0.f, 0.f, (doubleJumpImpulse - x138_velocity.z) * xe8_mass); + zeus::CVector3f impulse(0.f, 0.f, (doubleJumpImpulse - x138_velocity.z()) * xe8_mass); ApplyImpulseWR(impulse, zeus::CAxisAngle::sIdentity); } @@ -5932,7 +5932,7 @@ float CPlayer::ForwardInput(const CFinalInput& input, float turnInput) const if (!g_tweakPlayer->GetMoveDuringFreeLook()) { zeus::CVector3f velFlat = x138_velocity; - velFlat.z = 0.f; + velFlat.z() = 0.f; if (x3dc_inFreeLook || x3dd_lookButtonHeld) if (x258_movementState == EPlayerMovementState::OnGround || std::fabs(velFlat.magnitude()) < 0.00001f) return 0.f; @@ -6007,7 +6007,7 @@ void CPlayer::ComputeDash(const CFinalInput& input, float dt, CStateManager& mgr { float strafeInput = StrafeInput(input); float forwardInput = ForwardInput(input, TurnInput(input)); - zeus::CVector3f orbitPointFlattened(x314_orbitPoint.x, x314_orbitPoint.y, GetTranslation().z); + zeus::CVector3f orbitPointFlattened(x314_orbitPoint.x(), x314_orbitPoint.y(), GetTranslation().z()); zeus::CVector3f orbitToPlayer = GetTranslation() - orbitPointFlattened; if (!orbitToPlayer.canBeNormalized()) return; @@ -6025,9 +6025,9 @@ void CPlayer::ComputeDash(const CFinalInput& input, float dt, CStateManager& mgr x38c_doneSidewaysDashing = true; x384_dashTimer = 0.f; zeus::CVector3f vel = x138_velocity; - if (vel.z > 0.f) + if (vel.z() > 0.f) { - vel.z *= 0.1f; + vel.z() *= 0.1f; if (!x9c5_28_slidingOnWall) { SetVelocityWR(vel); @@ -6075,9 +6075,9 @@ void CPlayer::ComputeDash(const CFinalInput& input, float dt, CStateManager& mgr x388_dashButtonHoldTime = 0.f; strafeVel = skOrbitForwardDistances[int(restraints)] * forwardInput * dt; orbitPointFlattened += -useOrbitToPlayer.normalized() * strafeVel; - zeus::CVector2f velFlat(x138_velocity.x, x138_velocity.y); + zeus::CVector2f velFlat(x138_velocity.x(), x138_velocity.y()); zeus::CVector3f newVelocity = (orbitPointFlattened - GetTranslation()) / dt; - zeus::CVector3f velDelta(newVelocity.x - x138_velocity.x, newVelocity.y - x138_velocity.y, 0.f); + zeus::CVector3f velDelta(newVelocity.x() - x138_velocity.x(), newVelocity.y() - x138_velocity.y(), 0.f); strafeVel = velDelta.magnitude(); if (strafeVel > FLT_EPSILON) { @@ -6108,11 +6108,11 @@ void CPlayer::ComputeMovement(const CFinalInput& input, CStateManager& mgr, floa if (std::fabs(zRotateInput) < 0.00001f) { float frictionZAngVel = g_tweakPlayer->GetPlayerRotationFriction(int(restraints)) * - GetAngularVelocityOR().getVector().z; + GetAngularVelocityOR().getVector().z(); SetAngularVelocityOR({0.f, 0.f, frictionZAngVel}); } - float curZAngVel = GetAngularVelocityOR().getVector().z; + float curZAngVel = GetAngularVelocityOR().getVector().z(); float maxZAngVel = g_tweakPlayer->GetPlayerRotationMaxSpeed(int(restraints)) * turnSpeedMul; if (curZAngVel > maxZAngVel) SetAngularVelocityOR({0.f, 0.f, maxZAngVel}); @@ -6121,7 +6121,7 @@ void CPlayer::ComputeMovement(const CFinalInput& input, CStateManager& mgr, floa } float f26 = g_tweakPlayer->GetPlayerRotationMaxSpeed(int(restraints)) * zRotateInput * turnSpeedMul; - f26 -= GetAngularVelocityOR().getVector().z; + f26 -= GetAngularVelocityOR().getVector().z(); float remainVel = zeus::clamp(0.f, std::fabs(f26) / (turnSpeedMul * g_tweakPlayer->GetPlayerRotationMaxSpeed(int(restraints))), 1.f); if (f26 < 0.f) @@ -6136,7 +6136,7 @@ void CPlayer::ComputeMovement(const CFinalInput& input, CStateManager& mgr, floa float calcSpeed = g_tweakPlayer->GetPlayerTranslationFriction(int(restraints)) * xe8_mass / (dt * g_tweakPlayer->GetMaxTranslationalAcceleration(int(restraints))) * maxSpeed; float f28 = (forwardInput > 0.f ? 1.f : -1.f) * calcSpeed + (maxSpeed - calcSpeed) * forwardInput; - forwardForce = zeus::clamp(-1.f, (f28 - x34_transform.transposeRotate(x138_velocity).y) / maxSpeed, 1.f) * + forwardForce = zeus::clamp(-1.f, (f28 - x34_transform.transposeRotate(x138_velocity).y()) / maxSpeed, 1.f) * g_tweakPlayer->GetMaxTranslationalAcceleration(int(restraints)); } else @@ -6179,7 +6179,7 @@ void CPlayer::ComputeMovement(const CFinalInput& input, CStateManager& mgr, floa { if (!x9c5_28_slidingOnWall && x258_movementState == EPlayerMovementState::OnGround) { - zeus::CVector3f revVelFlat(-x138_velocity.x, -x138_velocity.y, 0.f); + zeus::CVector3f revVelFlat(-x138_velocity.x(), -x138_velocity.y(), 0.f); float revVelFlatMag = revVelFlat.magnitude(); if (revVelFlatMag > FLT_EPSILON) { @@ -6209,20 +6209,20 @@ zeus::CVector3f CPlayer::GetDampedClampedVelocityWR() const x304_orbitState == EPlayerOrbitState::NoOrbit) { float friction = g_tweakPlayer->GetPlayerTranslationFriction(int(GetSurfaceRestraint())); - if (localVel.y > 0.f) - localVel.y = std::max(0.f, localVel.y - friction); + if (localVel.y() > 0.f) + localVel.y() = std::max(0.f, localVel.y() - friction); else - localVel.y = std::min(0.f, localVel.y + friction); - if (localVel.x > 0.f) - localVel.x = std::max(0.f, localVel.x - friction); + localVel.y() = std::min(0.f, localVel.y() + friction); + if (localVel.x() > 0.f) + localVel.x() = std::max(0.f, localVel.x() - friction); else - localVel.x = std::min(0.f, localVel.x + friction); + localVel.x() = std::min(0.f, localVel.x() + friction); } float maxSpeed = g_tweakPlayer->GetPlayerTranslationMaxSpeed(int(GetSurfaceRestraint())); - localVel.y = zeus::clamp(-maxSpeed, localVel.y, maxSpeed); + localVel.y() = zeus::clamp(-maxSpeed, float(localVel.y()), maxSpeed); if (x258_movementState == EPlayerMovementState::OnGround) - localVel.z = 0.f; + localVel.z() = 0.f; return x34_transform.rotate(localVel); } @@ -6293,7 +6293,7 @@ bool CPlayer::CanLeaveMorphBallState(CStateManager& mgr, zeus::CVector3f& pos) c CCollidableAABox cAABB(aabb, CMaterialList()); if (!CGameCollision::DetectCollisionBoolean(mgr, cAABB, zeus::CTransform::Identity(), filter, nearList)) return true; - pos.z += 0.1f; + pos.z() += 0.1f; } return false; } @@ -6590,7 +6590,7 @@ bool CPlayer::CFailsafeTest::Passes() const zeus::CAABox velAABB(x148_velSamples[0], x148_velSamples[0]); zeus::CAABox posAABB(x54_posSamples[0], x54_posSamples[0]); - zeus::CVector3f inputVec(x23c_inputSamples[0].x, x23c_inputSamples[0].y, 0.f); + zeus::CVector3f inputVec(x23c_inputSamples[0].x(), x23c_inputSamples[0].y(), 0.f); zeus::CAABox inputAABB(inputVec, inputVec); float maxVelMag = x148_velSamples[0].magnitude(); @@ -6609,7 +6609,7 @@ bool CPlayer::CFailsafeTest::Passes() const minVelMag = std::min(minVelMag, velMag); maxVelMag = std::max(maxVelMag, velMag); - zeus::CVector3f inputVec2(x23c_inputSamples[i].x, x23c_inputSamples[i].y, 0.f); + zeus::CVector3f inputVec2(x23c_inputSamples[i].x(), x23c_inputSamples[i].y(), 0.f); inputAABB.accumulateBounds(inputVec2); if (x0_stateSamples[i] != x0_stateSamples[i-1]) @@ -6703,7 +6703,7 @@ void CPlayer::UpdateSubmerged(CStateManager& mgr) if (TCastToPtr water = mgr.ObjectById(xc4_fluidId)) { x828_distanceUnderWater = - -(zeus::CVector3f::skUp.dot(x34_transform.origin) - water->GetTriggerBoundsWR().max.z); + -(zeus::CVector3f::skUp.dot(x34_transform.origin) - water->GetTriggerBoundsWR().max.z()); EFluidType fluidType = water->GetFluidPlane().GetFluidType(); x82c_inLava = (fluidType == EFluidType::Lava || fluidType == EFluidType::ThickLava); CheckSubmerged(); diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index e79b39d18..9da1af986 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -36,9 +36,9 @@ zeus::CTransform CPlayerCameraBob::GetViewWanderTransform() const { return xd0_v zeus::CVector3f CPlayerCameraBob::GetHelmetBobTranslation() const { - return {kHelmetBobMagnitude * x2c_cameraBobTransform.origin.x, - kHelmetBobMagnitude * x2c_cameraBobTransform.origin.y, - kHelmetBobMagnitude * (x2c_cameraBobTransform.origin.z - x78_camTranslation)}; + return {kHelmetBobMagnitude * x2c_cameraBobTransform.origin.x(), + kHelmetBobMagnitude * x2c_cameraBobTransform.origin.y(), + kHelmetBobMagnitude * (x2c_cameraBobTransform.origin.z() - x78_camTranslation)}; } zeus::CTransform CPlayerCameraBob::GetGunBobTransformation() const @@ -51,7 +51,7 @@ zeus::CTransform CPlayerCameraBob::GetCameraBobTransformation() const { return x void CPlayerCameraBob::SetPlayerVelocity(const zeus::CVector3f& velocity) { x5c_playerVelocity = velocity; - x68_playerPeakFallVel = zeus::min(x68_playerPeakFallVel, velocity.z); + x68_playerPeakFallVel = zeus::min(x68_playerPeakFallVel, velocity.z()); } void CPlayerCameraBob::SetBobMagnitude(float magnitude) @@ -110,8 +110,8 @@ void CPlayerCameraBob::UpdateViewWander(float dt, CStateManager& mgr) x7c_wanderPoints[xcc_wanderIndex], x7c_wanderPoints[(xcc_wanderIndex + 1) & 3], x7c_wanderPoints[(xcc_wanderIndex + 2) & 3], x7c_wanderPoints[(xcc_wanderIndex + 3) & 3], xc4_wanderTime); - pt.x *= x100_wanderMagnitude; - pt.z *= x100_wanderMagnitude; + pt.x() *= x100_wanderMagnitude; + pt.z() *= x100_wanderMagnitude; zeus::CTransform orient = zeus::CTransform::RotateY(( zeus::getCatmullRomSplinePoint(xb0_wanderPitches[xcc_wanderIndex], xb0_wanderPitches[(xcc_wanderIndex + 1) & 3], xb0_wanderPitches[(xcc_wanderIndex + 2) & 3], @@ -201,19 +201,20 @@ void CPlayerCameraBob::CalculateMovingTranslation(float& x, float& y) const if (x0_type == ECameraBobType::Zero) { double c = ((M_PIF * 2.f) * std::fmod(x1c_bobTime, 2.0f * xc_bobPeriod) / xc_bobPeriod); - x = (x14_bobMagnitude * x4_vec.x) * float(std::sin(c)); - y = (x14_bobMagnitude * x4_vec.y) * float(std::fabs(std::cos(c * .5)) * std::cos(c * .5)); + x = (x14_bobMagnitude * x4_vec.x()) * float(std::sin(c)); + y = (x14_bobMagnitude * x4_vec.y()) * float(std::fabs(std::cos(c * .5)) * std::cos(c * .5)); } else if (x0_type == ECameraBobType::One) { float fX = std::fmod(x1c_bobTime, 2.f * xc_bobPeriod); if (fX > xc_bobPeriod) - x = (2.f - (fX / xc_bobPeriod)) * (x14_bobMagnitude * x4_vec.x); + x = (2.f - (fX / xc_bobPeriod)) * (x14_bobMagnitude * x4_vec.x()); else - x = ((fX / xc_bobPeriod)) * (x14_bobMagnitude * x4_vec.x); + x = ((fX / xc_bobPeriod)) * (x14_bobMagnitude * x4_vec.x()); auto sY = float(std::sin(std::fmod((M_PI * fX) / xc_bobPeriod, M_PI))); - y = (1.f - sY) * (x14_bobMagnitude * x4_vec.y) * 0.5f + (0.5f * -((sY * sY) - 1.f) * (x14_bobMagnitude * x4_vec.y)); + y = (1.f - sY) * (x14_bobMagnitude * x4_vec.y()) * 0.5f + + (0.5f * -((sY * sY) - 1.f) * (x14_bobMagnitude * x4_vec.y())); } } diff --git a/Runtime/World/CScriptActorRotate.cpp b/Runtime/World/CScriptActorRotate.cpp index 16a690fdb..bbfcc6b51 100644 --- a/Runtime/World/CScriptActorRotate.cpp +++ b/Runtime/World/CScriptActorRotate.cpp @@ -57,9 +57,9 @@ void CScriptActorRotate::Think(float dt, CStateManager& mgr) if (TCastToPtr act = mgr.ObjectById(actorPair.first)) { zeus::CTransform xf = - zeus::CTransform::RotateZ(zeus::degToRad(timeOffset * x34_rotation.z)) * - zeus::CTransform::RotateY(zeus::degToRad(timeOffset * x34_rotation.y)) * - zeus::CTransform::RotateX(zeus::degToRad(timeOffset * x34_rotation.x)); + zeus::CTransform::RotateZ(zeus::degToRad(timeOffset * x34_rotation.z())) * + zeus::CTransform::RotateY(zeus::degToRad(timeOffset * x34_rotation.y())) * + zeus::CTransform::RotateX(zeus::degToRad(timeOffset * x34_rotation.x())); zeus::CTransform localRot = actorPair.second * xf; localRot.origin = act->GetTranslation(); act->SetTransform(localRot); diff --git a/Runtime/World/CScriptCameraHint.cpp b/Runtime/World/CScriptCameraHint.cpp index 177340f3c..96e0ea17a 100644 --- a/Runtime/World/CScriptCameraHint.cpp +++ b/Runtime/World/CScriptCameraHint.cpp @@ -120,13 +120,13 @@ void CScriptCameraHint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId send if (TCastToConstPtr act = mgr.GetObjectById(sender)) { zeus::CVector3f followerToThisFlat = x168_origXf.origin - act->GetTranslation(); - followerToThisFlat.z = 0.f; + followerToThisFlat.z() = 0.f; if (followerToThisFlat.canBeNormalized()) followerToThisFlat.normalize(); else followerToThisFlat = act->GetTransform().basis[1]; zeus::CVector3f target = act->GetTranslation() + followerToThisFlat; - target.z = x168_origXf.origin.z + followerToThisFlat.z; + target.z() = x168_origXf.origin.z() + followerToThisFlat.z(); SetTransform(zeus::lookAt(act->GetTranslation(), target)); } } diff --git a/Runtime/World/CScriptCoverPoint.cpp b/Runtime/World/CScriptCoverPoint.cpp index 82ef7d984..de6fa233b 100644 --- a/Runtime/World/CScriptCoverPoint.cpp +++ b/Runtime/World/CScriptCoverPoint.cpp @@ -6,7 +6,8 @@ namespace urde { CScriptCoverPoint::CScriptCoverPoint(TUniqueId uid, std::string_view name, const CEntityInfo &info, - zeus::CTransform xf, bool active, u32 flags, bool crouch, float horizontalAngle, float verticalAngle, float coverTime) + zeus::CTransform xf, bool active, u32 flags, bool crouch, + float horizontalAngle, float verticalAngle, float coverTime) : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::NoStepLogic), CActorParameters::None(), kInvalidUniqueId), xe8_flags(flags), @@ -71,7 +72,7 @@ bool CScriptCoverPoint::Blown(const zeus::CVector3f& point) const zeus::CVector3f frontVec = x34_transform.frontVector(); frontVec.normalize(); - if (frontVec.dot(normDif) <= GetCosHorizontalAngle() || (posDif.z * posDif.z) >= GetSinSqVerticalAngle()) + if (frontVec.dot(normDif) <= GetCosHorizontalAngle() || (posDif.z() * posDif.z()) >= GetSinSqVerticalAngle()) return true; } return false; @@ -82,41 +83,6 @@ float CScriptCoverPoint::GetSinSqVerticalAngle() const return xf0_sinVerticalAngle * xf0_sinVerticalAngle; } -float CScriptCoverPoint::GetCosHorizontalAngle() const -{ - return xec_cosHorizontalAngle; -} - -bool CScriptCoverPoint::ShouldLandHere() const -{ - return xe8_26_landHere; -} - -bool CScriptCoverPoint::ShouldWallHang() const -{ - return xe8_27_wallHang; -} - -bool CScriptCoverPoint::ShouldStay() const -{ - return xe8_28_stay; -} - -bool CScriptCoverPoint::ShouldCrouch() const -{ - return xf8_24_crouch; -} - -u32 CScriptCoverPoint::GetAttackDirection() const -{ - return xe8_flags; -} - -void CScriptCoverPoint::Reserve(TUniqueId id) -{ - xfa_occupant = id; -} - void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { CActor::AcceptScriptMsg(msg, uid, mgr); @@ -132,5 +98,4 @@ void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, } } - } diff --git a/Runtime/World/CScriptCoverPoint.hpp b/Runtime/World/CScriptCoverPoint.hpp index e5819cce6..3bda51ccd 100644 --- a/Runtime/World/CScriptCoverPoint.hpp +++ b/Runtime/World/CScriptCoverPoint.hpp @@ -45,15 +45,15 @@ public: std::experimental::optional GetTouchBounds() const; void SetInUse(bool inUse); bool GetInUse(TUniqueId uid) const; - bool ShouldLandHere() const; - bool ShouldWallHang() const; - bool ShouldStay() const; - bool ShouldCrouch() const; + bool ShouldLandHere() const { return xe8_26_landHere; } + bool ShouldWallHang() const { return xe8_27_wallHang; } + bool ShouldStay() const { return xe8_28_stay; } + bool ShouldCrouch() const { return xf8_24_crouch; } bool Blown(const zeus::CVector3f& pos) const; float GetSinSqVerticalAngle() const; - float GetCosHorizontalAngle() const; - u32 GetAttackDirection() const; - void Reserve(TUniqueId id); + float GetCosHorizontalAngle() const { return xec_cosHorizontalAngle; } + u32 GetAttackDirection() const { return xe8_flags; } + void Reserve(TUniqueId id) { xfa_occupant = id; } }; } diff --git a/Runtime/World/CScriptDamageableTrigger.cpp b/Runtime/World/CScriptDamageableTrigger.cpp index b0aff30fb..7d7c7b0d1 100644 --- a/Runtime/World/CScriptDamageableTrigger.cpp +++ b/Runtime/World/CScriptDamageableTrigger.cpp @@ -41,32 +41,32 @@ CScriptDamageableTrigger::CScriptDamageableTrigger(TUniqueId uid, std::string_vi x300_28_canOrbit = canOrbit == ECanOrbit::Orbit; if (x1dc_faceFlag & 0x1) { - x244_faceTranslate = zeus::CVector3f(0.f, x14c_bounds.max.y, 0.f); + x244_faceTranslate = zeus::CVector3f(0.f, x14c_bounds.max.y(), 0.f); x1e4_faceDir = zeus::CTransform::RotateX(-M_PIF / 2.f); } else if (x1dc_faceFlag & 0x2) { - x244_faceTranslate = zeus::CVector3f(0.f, x14c_bounds.min.y, 0.f); + x244_faceTranslate = zeus::CVector3f(0.f, x14c_bounds.min.y(), 0.f); x1e4_faceDir = zeus::CTransform::RotateX(M_PIF / 2.f); } else if (x1dc_faceFlag & 0x4) { - x244_faceTranslate = zeus::CVector3f(x14c_bounds.min.x, 0.f, 0.f); + x244_faceTranslate = zeus::CVector3f(x14c_bounds.min.x(), 0.f, 0.f); x1e4_faceDir = zeus::CTransform::RotateY(-M_PIF / 2.f); } else if (x1dc_faceFlag & 0x8) { - x244_faceTranslate = zeus::CVector3f(x14c_bounds.max.x, 0.f, 0.f); + x244_faceTranslate = zeus::CVector3f(x14c_bounds.max.x(), 0.f, 0.f); x1e4_faceDir = zeus::CTransform::RotateY(M_PIF / 2.f); } else if (x1dc_faceFlag & 0x10) { - x244_faceTranslate = zeus::CVector3f(0.f, 0.f, x14c_bounds.max.z); + x244_faceTranslate = zeus::CVector3f(0.f, 0.f, x14c_bounds.max.z()); x1e4_faceDir = zeus::CTransform::Identity(); } else if (x1dc_faceFlag & 0x20) { - x244_faceTranslate = zeus::CVector3f(0.f, 0.f, x14c_bounds.min.z); + x244_faceTranslate = zeus::CVector3f(0.f, 0.f, x14c_bounds.min.z()); x1e4_faceDir = zeus::CTransform::RotateY(M_PIF); } diff --git a/Runtime/World/CScriptDebris.cpp b/Runtime/World/CScriptDebris.cpp index 0662fc3c4..5b6d9bcd6 100644 --- a/Runtime/World/CScriptDebris.cpp +++ b/Runtime/World/CScriptDebris.cpp @@ -169,12 +169,12 @@ void CScriptDebris::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, if (!x281_30_debrisExtended) { zeus::CVector3f linImpulse; - linImpulse.z = std::fabs(mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * - xe8_mass * x258_velocity.z + x26c_zImpulse; - linImpulse.y = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * - xe8_mass * x258_velocity.y; - linImpulse.x = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * - xe8_mass * x258_velocity.x; + linImpulse.z() = std::fabs(mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * + xe8_mass * x258_velocity.z() + x26c_zImpulse; + linImpulse.y() = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * + xe8_mass * x258_velocity.y(); + linImpulse.x() = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * + xe8_mass * x258_velocity.x(); linImpulse += x34_transform.basis[2]; zeus::CAxisAngle angImpulse; if (x281_24_randomAngImpulse) @@ -182,9 +182,9 @@ void CScriptDebris::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, if (mgr.GetActiveRandom()->Next() % 100 < 50) { zeus::CVector3f rotVec; - rotVec.x = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * 45.f; - rotVec.y = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * 15.f; - rotVec.z = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * 35.f; + rotVec.x() = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * 45.f; + rotVec.y() = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * 15.f; + rotVec.z() = (mgr.GetActiveRandom()->Next() % 32767 / 16383.5f - 1.f) * 35.f; angImpulse = zeus::CAxisAngle(rotVec); } } @@ -242,7 +242,7 @@ void CScriptDebris::Think(float dt, CStateManager& mgr) zeus::CVector3f normVel = x138_velocity.normalized(); zeus::CTransform orient = zeus::lookAt(zeus::CVector3f::skZero, normVel, - std::fabs(normVel.z) < 0.99f ? zeus::CVector3f::skUp : zeus::CVector3f::skForward); + std::fabs(normVel.z()) < 0.99f ? zeus::CVector3f::skUp : zeus::CVector3f::skForward); x2d4_particleGens[0]->SetOrientation(orient); } } @@ -279,7 +279,7 @@ void CScriptDebris::Think(float dt, CStateManager& mgr) zeus::CVector3f normVel = x138_velocity.normalized(); zeus::CTransform orient = zeus::lookAt(zeus::CVector3f::skZero, normVel, - std::fabs(normVel.z) < 0.99f ? zeus::CVector3f::skUp : zeus::CVector3f::skForward); + std::fabs(normVel.z()) < 0.99f ? zeus::CVector3f::skUp : zeus::CVector3f::skForward); x2d4_particleGens[1]->SetOrientation(orient); } } @@ -310,7 +310,7 @@ void CScriptDebris::Think(float dt, CStateManager& mgr) zeus::CVector3f normVel = x138_velocity.normalized(); zeus::CTransform orient = zeus::lookAt(zeus::CVector3f::skZero, normVel, - std::fabs(normVel.z) < 0.99f ? zeus::CVector3f::skUp : zeus::CVector3f::skForward); + std::fabs(normVel.z()) < 0.99f ? zeus::CVector3f::skUp : zeus::CVector3f::skForward); x2d4_particleGens[2]->SetOrientation(orient); } } diff --git a/Runtime/World/CScriptDistanceFog.cpp b/Runtime/World/CScriptDistanceFog.cpp index d1683b40a..baf194350 100644 --- a/Runtime/World/CScriptDistanceFog.cpp +++ b/Runtime/World/CScriptDistanceFog.cpp @@ -58,7 +58,7 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj CGameArea::CAreaFog* fog = stateMgr.WorldNC()->GetArea(x4_areaId)->AreaFog(); if (x34_mode == ERglFogMode::None) - fog->RollFogOut(x48_rangeDelta.x, x44_colorDelta, x38_color); + fog->RollFogOut(x48_rangeDelta.x(), x44_colorDelta, x38_color); else fog->FadeFog(x34_mode, x38_color, x3c_range, x44_colorDelta, x48_rangeDelta); diff --git a/Runtime/World/CScriptDock.cpp b/Runtime/World/CScriptDock.cpp index da069ad4e..1ee360c94 100644 --- a/Runtime/World/CScriptDock.cpp +++ b/Runtime/World/CScriptDock.cpp @@ -243,7 +243,7 @@ void CScriptDock::UpdateAreaActivateFlags(CStateManager& mgr) bool CScriptDock::HasPointCrossedDock(const CStateManager& mgr, const zeus::CVector3f& point) const { const zeus::CPlane plane = GetPlane(mgr); - return (point.dot(plane.vec) >= plane.d); + return plane.pointToPlaneDist(point) >= 0.f; } void CScriptDock::AreaLoaded(CStateManager& mgr) { SetLoadConnected(mgr, x268_25_loadConnected); } diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index c0db4c91c..a37fc5fd3 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -218,7 +218,7 @@ void CScriptGunTurret::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, { CModelData mData(CStaticRes(x2d4_data.x88_, scale)); x4a4_.emplace(std::move(mData)); - x4f4_ = x4a4_->GetBounds().max.z - x4a4_->GetBounds().min.z; + x4f4_ = x4a4_->GetBounds().max.z() - x4a4_->GetBounds().min.z(); } sub80219b18(5, mgr); } @@ -916,7 +916,7 @@ void CScriptGunTurret::sub80218bb4(s32 state, CStateManager& mgr, float dt) bool CScriptGunTurret::sub80217ad8(CStateManager& mgr) { zeus::CVector3f posDif = mgr.GetPlayer().GetTranslation() - GetTranslation(); - zeus::CVector3f someVec(posDif.x, posDif.y, 0.f); + zeus::CVector3f someVec(posDif.x(), posDif.y(), 0.f); if (x550_.dot(posDif) >= 0.f) return zeus::CVector3f::getAngleDiff(x544_, someVec) <= x2d4_data.x20_; diff --git a/Runtime/World/CScriptPlayerActor.cpp b/Runtime/World/CScriptPlayerActor.cpp index 2d3c6d7e7..0ab1901d2 100644 --- a/Runtime/World/CScriptPlayerActor.cpp +++ b/Runtime/World/CScriptPlayerActor.cpp @@ -458,7 +458,7 @@ void CScriptPlayerActor::Render(const CStateManager& mgr) const flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly; x314_beamModelData->Render(mgr, modelXf, x90_actorLights.get(), flags); flags.m_extendedShader = EExtendedShader::Lighting; - flags.x4_color = zeus::CColor{1.f, xb4_drawFlags.x4_color.a}; + flags.x4_color = zeus::CColor{1.f, xb4_drawFlags.x4_color.a()}; x314_beamModelData->Render(mgr, modelXf, x90_actorLights.get(), flags); } diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index 1172ec2e2..8254b6d99 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -250,7 +250,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId { x1a8_ = 1; x1ac_ = GetTranslation() - mgr.GetPlayer().GetTranslation(); - x1ac_.z = 0.f; + x1ac_.z() = 0.f; x1ac_.normalize(); break; } @@ -442,7 +442,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId const SObjectTag* objectTag = g_ResFactory->GetResourceIdByName(xec_locatorName); CAssetId assetId = objectTag ? objectTag->id : CAssetId(); - mgr.SetPendingOnScreenTex(assetId, {x104_, x108_}, {xfc_, x100_}); + mgr.SetPendingOnScreenTex(assetId, {int(x104_), int(x108_)}, {int(xfc_), int(x100_)}); if (objectTag) { x1e8_ = g_SimplePool->GetObj(*objectTag); @@ -451,7 +451,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId } else if (msg == EScriptObjectMessage::Decrement) { - mgr.SetPendingOnScreenTex({}, {x104_, x108_}, {xfc_, x100_}); + mgr.SetPendingOnScreenTex({}, {int(x104_), int(x108_)}, {int(xfc_), int(x100_)}); if (x1e8_) x1e8_ = TLockedToken(); x1e5_26_displayBillboard = false; diff --git a/Runtime/World/CScriptSteam.cpp b/Runtime/World/CScriptSteam.cpp index fd021968a..927856061 100644 --- a/Runtime/World/CScriptSteam.cpp +++ b/Runtime/World/CScriptSteam.cpp @@ -17,8 +17,8 @@ CScriptSteam::CScriptSteam(TUniqueId uid, std::string_view name, const CEntityIn , x15c_alphaInDur(f2 / f1) , x160_alphaOutDur(f3 / f1) { - float r3 = (aabb.max.z < aabb.max.y ? aabb.max.z : aabb.max.y); - r3 = (r3 < aabb.max.x ? r3 : aabb.max.x); + float r3 = (aabb.max.z() < aabb.max.y() ? aabb.max.z() : aabb.max.y()); + r3 = (r3 < aabb.max.x() ? r3 : aabb.max.x()); if (f4 - 0.f >= 0.000009999999747378752f) r3 = (r3 < f2 ? r3 : f4); diff --git a/Runtime/World/CScriptTrigger.hpp b/Runtime/World/CScriptTrigger.hpp index 64b3677e2..9b683db2c 100644 --- a/Runtime/World/CScriptTrigger.hpp +++ b/Runtime/World/CScriptTrigger.hpp @@ -87,6 +87,8 @@ public: zeus::CAABox GetTriggerBoundsWR() const; const CDamageInfo& GetDamageInfo() const { return x100_damageInfo; } ETriggerFlags GetTriggerFlags() const { return x12c_flags; } + float GetForceMagnitude() const { return x128_forceMagnitude; } + const zeus::CVector3f& GetForceVector() const { return x11c_forceField; } }; } diff --git a/Runtime/World/CScriptWater.cpp b/Runtime/World/CScriptWater.cpp index e01e20835..bfb8a6565 100644 --- a/Runtime/World/CScriptWater.cpp +++ b/Runtime/World/CScriptWater.cpp @@ -50,8 +50,8 @@ CScriptWater::CScriptWater(CStateManager& mgr, TUniqueId uid, std::string_view n x2b8_alphaOutRecip((alphaOutTime != 0.f) ? 1.f / alphaOutTime : 0.f), x2bc_alpha(alpha), x2c0_tileSize(tileSize) { zeus::CAABox triggerAABB = GetTriggerBoundsWR(); - x2c4_gridDimX = u32((x2c0_tileSize + triggerAABB.max.x - triggerAABB.min.x - 0.01f) / x2c0_tileSize); - x2c8_gridDimY = u32((x2c0_tileSize + triggerAABB.max.y - triggerAABB.min.y - 0.01f) / x2c0_tileSize); + x2c4_gridDimX = u32((x2c0_tileSize + triggerAABB.max.x() - triggerAABB.min.x() - 0.01f) / x2c0_tileSize); + x2c8_gridDimY = u32((x2c0_tileSize + triggerAABB.max.y() - triggerAABB.min.y() - 0.01f) / x2c0_tileSize); x2cc_gridCellCount = (x2c4_gridDimX + 1) * (x2c8_gridDimY + 1); x2e8_24_b4 = b4; x2e8_27_allowRender = allowRender; @@ -113,8 +113,8 @@ CScriptWater::CScriptWater(CStateManager& mgr, TUniqueId uid, std::string_view n void CScriptWater::SetupGrid(bool recomputeClipping) { zeus::CAABox triggerAABB = GetTriggerBoundsWR(); - auto dimX = u32((triggerAABB.max.x - triggerAABB.min.x + x2c0_tileSize) / x2c0_tileSize); - auto dimY = u32((triggerAABB.max.y - triggerAABB.min.y + x2c0_tileSize) / x2c0_tileSize); + auto dimX = u32((triggerAABB.max.x() - triggerAABB.min.x() + x2c0_tileSize) / x2c0_tileSize); + auto dimY = u32((triggerAABB.max.y() - triggerAABB.min.y() + x2c0_tileSize) / x2c0_tileSize); x2e4_computedGridCellCount = x2cc_gridCellCount = (dimX + 1) * (dimY + 1); x2dc_vertIntersects.reset(); if (!x2d8_tileIntersects || dimX != x2c4_gridDimX || dimY != x2c8_gridDimY) @@ -151,17 +151,17 @@ void CScriptWater::SetupGridClipping(CStateManager& mgr, int computeVerts) x2dc_vertIntersects.reset(new bool[(x2c4_gridDimX + 1) * (x2c8_gridDimY + 1)]); zeus::CAABox triggerBounds = GetTriggerBoundsWR(); zeus::CVector3f basePos = triggerBounds.min; - basePos.z = triggerBounds.max.z + 0.8f; - auto gridDiv = std::div(int(x2e4_computedGridCellCount), int(x2c4_gridDimX + 1)); + basePos.z() = triggerBounds.max.z() + 0.8f; + auto gridDiv = std::div(x2e4_computedGridCellCount, x2c4_gridDimX + 1); float yOffset = x2c0_tileSize * gridDiv.quot; float xOffset = x2c0_tileSize * gridDiv.rem; - float mag = std::min(120.f, 2.f * (x130_bounds.max.z - x130_bounds.min.z) + 0.8f); + float mag = std::min(120.f, 2.f * (x130_bounds.max.z() - x130_bounds.min.z()) + 0.8f); for (int i = x2e4_computedGridCellCount; i < std::min(x2e4_computedGridCellCount + computeVerts, x2cc_gridCellCount); ++i) { zeus::CVector3f pos = basePos; - pos.x += xOffset; - pos.y += yOffset; + pos.x() += xOffset; + pos.y() += yOffset; x2dc_vertIntersects[i] = mgr.RayStaticIntersection(pos, zeus::CVector3f::skDown, mag, SolidFilter).IsValid(); gridDiv.rem += 1; xOffset += x2c0_tileSize; @@ -257,7 +257,7 @@ void CScriptWater::UpdateSplashInhabitants(CStateManager& mgr) if (auto tb = act->GetTouchBounds()) { zeus::CAABox thisTb = GetTriggerBoundsWR(); - if (tb->min.z <= thisTb.max.z && tb->max.z >= thisTb.max.z) + if (tb->min.z() <= thisTb.max.z() && tb->max.z() >= thisTb.max.z()) intersects = true; } } @@ -468,7 +468,7 @@ void CScriptWater::AddToRenderer(const zeus::CFrustum& /*frustum*/, const CState { if (!xe4_30_outOfFrustum) { - zeus::CPlane plane(zeus::CVector3f::skUp, x34_transform.origin.z + x130_bounds.max.z); + zeus::CPlane plane(zeus::CVector3f::skUp, x34_transform.origin.z() + x130_bounds.max.z()); zeus::CAABox renderBounds = GetSortingBounds(mgr); mgr.AddDrawableActorPlane(*this, plane, renderBounds); } @@ -478,12 +478,12 @@ void CScriptWater::Render(const CStateManager& mgr) const { if (x30_24_active && !xe4_30_outOfFrustum) { - float zOffset = 0.5f * (x9c_renderBounds.max.z + x9c_renderBounds.min.z) - x34_transform.origin.z; + float zOffset = 0.5f * (x9c_renderBounds.max.z() + x9c_renderBounds.min.z()) - x34_transform.origin.z(); zeus::CAABox aabb = x9c_renderBounds.getTransformedAABox( - zeus::CTransform::Translate(-x34_transform.origin.x, -x34_transform.origin.y, - -x34_transform.origin.z - zOffset)); + zeus::CTransform::Translate(-x34_transform.origin.x(), -x34_transform.origin.y(), + -x34_transform.origin.z() - zOffset)); zeus::CTransform xf = x34_transform; - xf.origin.z += zOffset; + xf.origin.z() += zOffset; zeus::CVector3f areaCenter = mgr.GetWorld()->GetAreaAlways(mgr.GetNextAreaId())->GetAABB().center(); std::experimental::optional rippleMan(mgr.GetFluidPlaneManager()->GetRippleManager()); x1b4_fluidPlane->Render(mgr, x2bc_alpha, aabb, xf, @@ -500,8 +500,8 @@ void CScriptWater::Render(const CStateManager& mgr) const if (fogLevel > 0.f) { zeus::CAABox fogBox = GetTriggerBoundsWR(); - fogBox.min.z = fogBox.max.z; - fogBox.max.z += fogLevel; + fogBox.min.z() = float(fogBox.max.z()); + fogBox.max.z() += fogLevel; zeus::CTransform modelXf = zeus::CTransform::Translate(fogBox.center()) * zeus::CTransform::Scale((fogBox.max - fogBox.min) * 0.5f); zeus::CAABox renderAABB(zeus::CVector3f::skNegOne, zeus::CVector3f::skOne); @@ -537,8 +537,8 @@ void CScriptWater::Touch(CActor& otherAct, CStateManager& mgr) return; x1fc_waterInhabitants.emplace_back(otherAct.GetUniqueId(), true); - float triggerMaxZ = GetTriggerBoundsWR().max.z; - if (touchBounds->min.z <= triggerMaxZ && touchBounds->max.z >= triggerMaxZ) + float triggerMaxZ = GetTriggerBoundsWR().max.z(); + if (touchBounds->min.z() <= triggerMaxZ && touchBounds->max.z() >= triggerMaxZ) otherAct.FluidFXThink(EFluidState::EnteredFluid, *this, mgr); mgr.SendScriptMsg(&otherAct, x8_uid, EScriptObjectMessage::AddSplashInhabitant); @@ -547,9 +547,9 @@ void CScriptWater::Touch(CActor& otherAct, CStateManager& mgr) void CScriptWater::CalculateRenderBounds() { zeus::CVector3f aabbMin = x130_bounds.min; - aabbMin.z = x130_bounds.max.z - 1.f; + aabbMin.z() = x130_bounds.max.z() - 1.f; zeus::CVector3f aabbMax = x130_bounds.max; - aabbMax.z += 1.f; + aabbMax.z() += 1.f; zeus::CVector3f transAABBMin = aabbMin + GetTranslation(); zeus::CVector3f transAABBMax = aabbMax + GetTranslation(); x9c_renderBounds = zeus::CAABox(transAABBMin, transAABBMax); @@ -558,7 +558,7 @@ void CScriptWater::CalculateRenderBounds() zeus::CAABox CScriptWater::GetSortingBounds(const CStateManager& mgr) const { zeus::CVector3f max = x9c_renderBounds.max; - max.z = std::max(max.z, x9c_renderBounds.max.z - 1.f + x214_fogBias + x218_fogMagnitude); + max.z() = std::max(float(max.z()), x9c_renderBounds.max.z() - 1.f + x214_fogBias + x218_fogMagnitude); return {x9c_renderBounds.min, max}; } @@ -621,11 +621,11 @@ bool CScriptWater::CanRippleAtPoint(const zeus::CVector3f& point) const if (!x2d8_tileIntersects) return true; - auto xTile = int((point.x - GetTriggerBoundsWR().min.x) / x2c0_tileSize); + auto xTile = int((point.x() - GetTriggerBoundsWR().min.x()) / x2c0_tileSize); if (xTile < 0 || xTile >= x2c4_gridDimX) return false; - auto yTile = int((point.y - GetTriggerBoundsWR().min.y) / x2c0_tileSize); + auto yTile = int((point.y() - GetTriggerBoundsWR().min.y()) / x2c0_tileSize); if (yTile < 0 || yTile >= x2c8_gridDimY) return false; diff --git a/Runtime/World/CTeamAiMgr.cpp b/Runtime/World/CTeamAiMgr.cpp index 66e7e17ff..7b277f195 100644 --- a/Runtime/World/CTeamAiMgr.cpp +++ b/Runtime/World/CTeamAiMgr.cpp @@ -112,7 +112,7 @@ void CTeamAiMgr::SpacingSort(CStateManager& mgr, const zeus::CVector3f& pos) { if (TCastToPtr ai = mgr.ObjectById(role.GetOwnerId())) { - float length = (ai->GetBaseBoundingBox().max.y - ai->GetBaseBoundingBox().min.y) * 1.5f; + float length = (ai->GetBaseBoundingBox().max.y() - ai->GetBaseBoundingBox().min.y()) * 1.5f; if (length > tierStagger) tierStagger = length; } @@ -131,7 +131,7 @@ void CTeamAiMgr::SpacingSort(CStateManager& mgr, const zeus::CVector3f& pos) else newPos = pos + ai->GetTransform().basis[1] * curTierDist; role.x1c_position = newPos; - role.x1c_position.z = ai->GetTranslation().z; + role.x1c_position.z() = ai->GetTranslation().z(); tierTeamSize += 1; if (tierTeamSize > maxTierTeamSize) { @@ -432,4 +432,18 @@ bool CTeamAiMgr::AddAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgr return false; } +TUniqueId CTeamAiMgr::GetTeamAiMgr(CAi& ai, CStateManager& mgr) +{ + for (const auto& conn : ai.GetConnectionList()) + { + if (conn.x0_state == EScriptObjectState::Active && conn.x4_msg == EScriptObjectMessage::Play) + { + TUniqueId id = mgr.GetIdForScript(conn.x8_objId); + if (TCastToConstPtr aimgr = mgr.GetObjectById(id)) + return aimgr->GetUniqueId(); + } + } + return kInvalidUniqueId; +} + } diff --git a/Runtime/World/CTeamAiMgr.hpp b/Runtime/World/CTeamAiMgr.hpp index 8bac596fe..f533263d3 100644 --- a/Runtime/World/CTeamAiMgr.hpp +++ b/Runtime/World/CTeamAiMgr.hpp @@ -114,6 +114,8 @@ public: static void ResetTeamAiRole(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId, bool clearRole); static bool CanAcceptAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId); static bool AddAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId); + + static TUniqueId GetTeamAiMgr(CAi& ai, CStateManager& mgr); }; } diff --git a/Runtime/World/CWallWalker.cpp b/Runtime/World/CWallWalker.cpp index 701893dff..a82625bcb 100644 --- a/Runtime/World/CWallWalker.cpp +++ b/Runtime/World/CWallWalker.cpp @@ -147,7 +147,7 @@ void CWallWalker::PreThink(float dt, CStateManager& mgr) const float futureDt = (10.f * dt); SetTranslation(zeus::CVector3f::lerp(GetTranslation(), GetTranslation() - (plane.pointToPlaneDist(GetTranslation()) - - x590_colSphere.GetSphere().radius - 0.01f) * plane.vec, futureDt)); + x590_colSphere.GetSphere().radius - 0.01f) * plane.normal(), futureDt)); } MoveCollisionPrimitive(zeus::CVector3f::skZero); } diff --git a/Runtime/World/CWorldLight.cpp b/Runtime/World/CWorldLight.cpp index 33ea0868c..cfe43307b 100644 --- a/Runtime/World/CWorldLight.cpp +++ b/Runtime/World/CWorldLight.cpp @@ -44,25 +44,25 @@ CLight CWorldLight::GetAsCGraphicsLight() const if (x0_type == EWorldLightType::LocalAmbient) { float_color *= zeus::CVector3f(q); - if (float_color.x >= 1.f) - float_color.x = 1.f; + if (float_color.x() >= 1.f) + float_color.x() = 1.f; - if (float_color.y >= 1.f) - float_color.y = 1.f; + if (float_color.y() >= 1.f) + float_color.y() = 1.f; - if (float_color.z >= 1.f) - float_color.z = 1.f; + if (float_color.z() >= 1.f) + float_color.z() = 1.f; - return CLight::BuildLocalAmbient(x10_position, zeus::CColor(float_color.x, float_color.y, float_color.z, 1.f)); + return CLight::BuildLocalAmbient(x10_position, zeus::CColor(float_color.x(), float_color.y(), float_color.z(), 1.f)); } else if (x0_type == EWorldLightType::Directional) { - return CLight::BuildDirectional(x1c_direction, zeus::CColor{x4_color.x, x4_color.y, x4_color.z, 1.f}); + return CLight::BuildDirectional(x1c_direction, zeus::CColor{x4_color.x(), x4_color.y(), x4_color.z(), 1.f}); } else if (x0_type == EWorldLightType::Spot) { CLight light = CLight::BuildSpot(x10_position, x1c_direction.normalized(), - zeus::CColor{x4_color.x, x4_color.y, x4_color.z, 1.f}, x2c_cutoffAngle * .5f); + zeus::CColor{x4_color.x(), x4_color.y(), x4_color.z(), 1.f}, x2c_cutoffAngle * .5f); float c, l, q; std::tie(c, l, q) = CalculateLightFalloff(x3c_falloff, x28_q); @@ -73,7 +73,7 @@ CLight CWorldLight::GetAsCGraphicsLight() const float distC, distL, distQ; std::tie(distC, distL, distQ) = CalculateLightFalloff(x3c_falloff, x28_q); return CLight::BuildCustom(x10_position, zeus::CVector3f{0.f, 1.f, 0.f}, - zeus::CColor{x4_color.x, x4_color.y, x4_color.z, 1.f}, distC, distL, distQ, 1.f, 0.f, + zeus::CColor{x4_color.x(), x4_color.y(), x4_color.z(), 1.f}, distC, distL, distQ, 1.f, 0.f, 0.f); } } diff --git a/Runtime/World/CWorldTransManager.cpp b/Runtime/World/CWorldTransManager.cpp index 0d32a9a50..674355c0c 100644 --- a/Runtime/World/CWorldTransManager.cpp +++ b/Runtime/World/CWorldTransManager.cpp @@ -235,9 +235,9 @@ void CWorldTransManager::DrawAllModels() void CWorldTransManager::DrawFirstPass() { zeus::CTransform translateXf = - zeus::CTransform::Translate(x4_modelData->x1b4_shakeResult.x, + zeus::CTransform::Translate(x4_modelData->x1b4_shakeResult.x(), -3.5f * (1.f - zeus::clamp(0.f, x0_curTime / 10.f, 1.f)) - 3.5f, - x4_modelData->x1b4_shakeResult.y + 2.f); + x4_modelData->x1b4_shakeResult.y() + 2.f); zeus::CTransform rotateXf = zeus::CTransform::RotateZ(zeus::degToRad(zeus::clamp(0.f, x0_curTime / 25.f, 100.f) * 360.f + 180.f - 90.f)); @@ -250,9 +250,9 @@ void CWorldTransManager::DrawSecondPass() { const zeus::CVector3f& samusScale = x4_modelData->x0_samusRes.GetScale(); zeus::CTransform translateXf = - zeus::CTransform::Translate(-0.1f * samusScale.x, - -0.5f * samusScale.y, - 1.5f * samusScale.z); + zeus::CTransform::Translate(-0.1f * samusScale.x(), + -0.5f * samusScale.y(), + 1.5f * samusScale.z()); zeus::CTransform rotateXf = zeus::CTransform::RotateZ(zeus::degToRad(48.f * zeus::clamp(0.f, (x0_curTime - x4_modelData->x1d0_dissolveStartTime + 2.f) / 5.f, 1.f) + 180.f - 24.f)); @@ -322,7 +322,7 @@ void CWorldTransManager::DrawText() if (filterAlpha > 0.f) { zeus::CColor filterColor = x44_27_fadeWhite ? zeus::CColor::skWhite : zeus::CColor::skBlack; - filterColor.a = filterAlpha; + filterColor.a() = filterAlpha; m_fadeToBlack.draw(filterColor); } } @@ -419,7 +419,7 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes, x4_modelData->x100_bgModelData[2] = bg; x4_modelData->x100_bgModelData[2].Touch(CModelData::EWhichModel::Normal, 0); zeus::CAABox bounds = x4_modelData->x100_bgModelData[0].GetBounds(); - x1c_bgHeight = (bounds.max.z - bounds.min.z) * bgScale.z; + x1c_bgHeight = (bounds.max.z() - bounds.min.z()) * bgScale.z(); } else x1c_bgHeight = 0.f; diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 734d94bbc..df66f9ab5 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -164,8 +164,8 @@ static zeus::CTransform LoadEditorTransformPivotOnly(CInputStream& in) position.readBig(in); zeus::CVector3f orientation; orientation.readBig(in); - orientation.x = 0.f; - orientation.y = 0.f; + orientation.x() = 0.f; + orientation.y() = 0.f; return ScriptLoader::ConvertEditorEulerToTransform4f(orientation, position); } @@ -395,9 +395,10 @@ CFluidUVMotion ScriptLoader::LoadFluidUVMotion(CInputStream& in) zeus::CTransform ScriptLoader::ConvertEditorEulerToTransform4f(const zeus::CVector3f& orientation, const zeus::CVector3f& position) { - return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) * - zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) * - zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) + + zeus::simd_floats f(orientation.mSimd); + return zeus::CTransform::RotateZ(zeus::degToRad(f[2])) * + zeus::CTransform::RotateY(zeus::degToRad(f[1])) * + zeus::CTransform::RotateX(zeus::degToRad(f[0])) + position; } @@ -461,7 +462,7 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC else data = CStaticRes(staticId, head.x40_scale); - if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero()) + if ((collisionExtent.x() < 0.f || collisionExtent.y() < 0.f || collisionExtent.z() < 0.f) || collisionExtent.isZero()) aabb = data.GetBounds(head.x10_transform.getRotation()); return new CScriptActor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data), aabb, mass, @@ -1110,9 +1111,9 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& u32 ClassifyVector(const zeus::CVector3f& dir) { - zeus::CVector3f absDir(std::fabs(dir.x), std::fabs(dir.y), std::fabs(dir.z)); - u32 max = (absDir.x > absDir.y ? 0 : 1); - max = (absDir[max] > absDir.z ? max : 2); + zeus::CVector3f absDir(std::fabs(dir.x()), std::fabs(dir.y()), std::fabs(dir.z())); + u32 max = (absDir.x() > absDir.y() ? 0 : 1); + max = (absDir[max] > absDir.z() ? max : 2); bool positive = (absDir[max] == dir[max]); if (max == 0) @@ -2185,7 +2186,7 @@ CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int if (solid) list.Add(EMaterialTypes::Solid); - if ((extents.x < 0.f || extents.y < 0.f || extents.z < 0.f) || extents.isZero()) + if ((extents.x() < 0.f || extents.y() < 0.f || extents.z() < 0.f) || extents.isZero()) aabox = zeus::CAABox(-.5f, 0.5f); return new CScriptPlayerActor(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, @@ -2655,7 +2656,7 @@ CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int p CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true)); zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, collisionOffset); - if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero()) + if ((collisionExtent.x() < 0.f || collisionExtent.y() < 0.f || collisionExtent.z() < 0.f) || collisionExtent.isZero()) aabb = mData.GetBounds(xf.getRotation()); return new CScriptGunTurret(mgr.AllocateUniqueId(), name, component, info, xf, std::move(mData), aabb, hInfo, dVuln, @@ -2675,9 +2676,9 @@ CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int p zeus::CColor fogColor = zeus::CColor::ReadRGBABig(in); bool active = in.readBool(); - volume.x = std::fabs(volume.x); - volume.y = std::fabs(volume.y); - volume.z = std::fabs(volume.z); + volume.x() = std::fabs(volume.x()); + volume.y() = std::fabs(volume.y()); + volume.z() = std::fabs(volume.z()); return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, ConvertEditorEulerToTransform4f(center, {}), CScriptSpecialFunction::ESpecialFunction::FogVolume, "", flickerSpeed, f2, 0.f, @@ -2927,7 +2928,7 @@ CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in CModelData data(CAnimRes(animParams.GetACSFile(), animParams.GetCharacter(), head.x40_scale, animParams.GetInitialAnimation(), true)); - if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero()) + if ((collisionExtent.x() < 0.f || collisionExtent.y() < 0.f || collisionExtent.z() < 0.f) || collisionExtent.isZero()) aabb = data.GetBounds(head.x10_transform.getRotation()); return new MP1::CActorContraption(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data), @@ -3120,7 +3121,7 @@ CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, int p CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), head.x40_scale, animParms.GetInitialAnimation(), true)); - if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero()) + if ((collisionExtent.x() < 0.f || collisionExtent.y() < 0.f || collisionExtent.z() < 0.f) || collisionExtent.isZero()) aabox = mData.GetBounds(head.x10_transform.getRotation()); return new CAmbientAI(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), aabox, diff --git a/hecl b/hecl index 14b54ca6c..375fbcaa6 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 14b54ca6c20a5b20eb4ccd23f1194fb3f6c2f984 +Subproject commit 375fbcaa6a271296fa15bd7153d2ce2eb1ddc10f diff --git a/hecl-gui b/hecl-gui index f5ab863cf..4a4591a48 160000 --- a/hecl-gui +++ b/hecl-gui @@ -1 +1 @@ -Subproject commit f5ab863cf18a0024237b8c5274a17bd5631f21b6 +Subproject commit 4a4591a487c6a7df6b1cbf6ab01140ec2ec7c2e7 diff --git a/lldb-extras/.lldbinit b/lldb-extras/.lldbinit index 7540043a8..5455bf504 100644 --- a/lldb-extras/.lldbinit +++ b/lldb-extras/.lldbinit @@ -2,14 +2,17 @@ command script import ~/urde_lldb_tools.py type synthetic add zeus::CMatrix3f --python-class urde_lldb_tools.CMatrix3f_Provider type synthetic add zeus::CMatrix4f --python-class urde_lldb_tools.CMatrix4f_Provider +type summary add --summary-string "(${var.__s_.__storage_[0]}, ${var.__s_.__storage_[1]}, ${var.__s_.__storage_[2]}, ${var.__s_.__storage_[3]})" zeus::simd +type summary add --summary-string "(${var.__s_.__storage_[0]}, ${var.__s_.__storage_[1]}, ${var.__s_.__storage_[2]}, ${var.__s_.__storage_[3]})" zeus::simd + type summary add --summary-string "(${var.x}, ${var.y})" zeus::CVector2i -type summary add --summary-string "(${var.x}, ${var.y})" zeus::CVector2f -type summary add --summary-string "(${var.x}, ${var.y}, ${var.z})" zeus::CVector3f -type summary add --summary-string "(${var.x}, ${var.y}, ${var.z})" zeus::CVector3d -type summary add --summary-string "(${var.x}, ${var.y}, ${var.z}, ${var.w})" zeus::CVector4f -type summary add --summary-string "(${var.r}, ${var.g}, ${var.b}, ${var.a})" zeus::CColor +type summary add --summary-string "(${var.mSimd.__s_.__storage_[0]}, ${var.mSimd.__s_.__storage_[1]})" zeus::CVector2f +type summary add --summary-string "(${var.mSimd.__s_.__storage_[0]}, ${var.mSimd.__s_.__storage_[1]}, ${var.mSimd.__s_.__storage_[2]})" zeus::CVector3f +type summary add --summary-string "(${var.mSimd.__s_.__storage_[0]}, ${var.mSimd.__s_.__storage_[1]}, ${var.mSimd.__s_.__storage_[2]})" zeus::CVector3d +type summary add --summary-string "(${var.mSimd.__s_.__storage_[0]}, ${var.mSimd.__s_.__storage_[1]}, ${var.mSimd.__s_.__storage_[2]}, ${var.mSimd.__s_.__storage_[3]})" zeus::CVector4f +type summary add --summary-string "(${var.mSimd.__s_.__storage_[0]}, ${var.mSimd.__s_.__storage_[1]}, ${var.mSimd.__s_.__storage_[2]}, ${var.mSimd.__s_.__storage_[3]})" zeus::CColor type summary add --summary-string "${var.angle}" zeus::CRelAngle -type summary add --summary-string "(${var.w}, ${var.x}, ${var.y}, ${var.z})" zeus::CQuaternion +type summary add --summary-string "(${var.mSimd.__s_.__storage_[0]}, ${var.mSimd.__s_.__storage_[1]}, ${var.mSimd.__s_.__storage_[2]}, ${var.mSimd.__s_.__storage_[3]})" zeus::CQuaternion type summary add --summary-string "pos=${var.position} radius=${var.radius}" zeus::CSphere type summary add --summary-string "norm=${var.position} d=${var.d}" zeus::CPlane type summary add --summary-string "min=${var.min} max=${var.max}" zeus::CAABox diff --git a/lldb-extras/urde_lldb_tools.py b/lldb-extras/urde_lldb_tools.py index ddd505aae..bdb25419d 100644 --- a/lldb-extras/urde_lldb_tools.py +++ b/lldb-extras/urde_lldb_tools.py @@ -20,7 +20,7 @@ class CMatrix3f_Provider: if index >= self.num_children(): return None try: - m = self.valobj.GetChildAtIndex(0).GetChildMemberWithName('vec') + m = self.valobj.GetChildMemberWithName('m') return m.GetChildAtIndex(index) except: return None diff --git a/specter b/specter index b5b8de3aa..b8da816de 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit b5b8de3aa8a5ca846b90b653496d33fbd2f5dbab +Subproject commit b8da816de24301d22dc874bfb47ca7f8238cde04 diff --git a/visigen/VISIBuilder.cpp b/visigen/VISIBuilder.cpp index 69d83520f..fd29f7b06 100644 --- a/visigen/VISIBuilder.cpp +++ b/visigen/VISIBuilder.cpp @@ -73,9 +73,9 @@ void VISIBuilder::Node::buildChildren(int level, int divisions, const zeus::CAAB { // Heuristic split int splits[3]; - splits[0] = (curAabb.max.x - curAabb.min.x >= VISI_MIN_LENGTH) ? 2 : 1; - splits[1] = (curAabb.max.y - curAabb.min.y >= VISI_MIN_LENGTH) ? 2 : 1; - splits[2] = (curAabb.max.z - curAabb.min.z >= VISI_MIN_LENGTH) ? 2 : 1; + splits[0] = (curAabb.max.x() - curAabb.min.x() >= VISI_MIN_LENGTH) ? 2 : 1; + splits[1] = (curAabb.max.y() - curAabb.min.y() >= VISI_MIN_LENGTH) ? 2 : 1; + splits[2] = (curAabb.max.z() - curAabb.min.z() >= VISI_MIN_LENGTH) ? 2 : 1; if (splits[0] == 2) flags |= 0x1; @@ -168,33 +168,33 @@ void VISIBuilder::Node::buildChildren(int level, int divisions, const zeus::CAAB { // This is a child node zeus::CVector3f center = curAabb.center(); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, curAabb.min.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, curAabb.min.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, curAabb.min.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, center.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, center.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, center.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, curAabb.max.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, curAabb.max.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, curAabb.max.y, curAabb.min.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, curAabb.min.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, curAabb.min.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, curAabb.min.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, center.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, center.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, center.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, curAabb.max.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, curAabb.max.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, curAabb.max.y, center.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, curAabb.min.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, curAabb.min.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, curAabb.min.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, center.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, center.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, center.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x, curAabb.max.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(center.x, curAabb.max.y, curAabb.max.z)); - leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x, curAabb.max.y, curAabb.max.z)); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), curAabb.min.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), curAabb.min.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), curAabb.min.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), center.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), center.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), center.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), curAabb.max.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), curAabb.max.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), curAabb.max.y(), curAabb.min.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), curAabb.min.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), curAabb.min.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), curAabb.min.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), center.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), center.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), center.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), curAabb.max.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), curAabb.max.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), curAabb.max.y(), center.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), curAabb.min.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), curAabb.min.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), curAabb.min.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), center.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), center.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), center.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.min.x(), curAabb.max.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(center.x(), curAabb.max.y(), curAabb.max.z())); + leaf |= rc.GetLeaf(zeus::CVector3f(curAabb.max.x(), curAabb.max.y(), curAabb.max.z())); prog.report(divisions); } diff --git a/visigen/VISIBuilder.hpp b/visigen/VISIBuilder.hpp index b55015d79..0dc7156dd 100644 --- a/visigen/VISIBuilder.hpp +++ b/visigen/VISIBuilder.hpp @@ -18,7 +18,8 @@ template <> struct hash { size_t operator()(const zeus::CVector3f& val) const noexcept { - return XXH64(val.v, 12, 0); + zeus::simd_floats f(val.mSimd); + return XXH64(&f[0], 12, 0); } }; } diff --git a/visigen/VISIRenderer.cpp b/visigen/VISIRenderer.cpp index 2e41d8df9..b45604e63 100644 --- a/visigen/VISIRenderer.cpp +++ b/visigen/VISIRenderer.cpp @@ -126,13 +126,13 @@ std::vector VISIRenderer::AABBToVerts(const zeus::CAA verts[i].color = color; verts[0].pos = aabb.min; - verts[1].pos = {aabb.max.x, aabb.min.y, aabb.min.z}; - verts[2].pos = {aabb.min.x, aabb.min.y, aabb.max.z}; - verts[3].pos = {aabb.max.x, aabb.min.y, aabb.max.z}; - verts[4].pos = {aabb.min.x, aabb.max.y, aabb.max.z}; + verts[1].pos = {aabb.max.x(), aabb.min.y(), aabb.min.z()}; + verts[2].pos = {aabb.min.x(), aabb.min.y(), aabb.max.z()}; + verts[3].pos = {aabb.max.x(), aabb.min.y(), aabb.max.z()}; + verts[4].pos = {aabb.min.x(), aabb.max.y(), aabb.max.z()}; verts[5].pos = aabb.max; - verts[6].pos = {aabb.min.x, aabb.max.y, aabb.min.z}; - verts[7].pos = {aabb.max.x, aabb.max.y, aabb.min.z}; + verts[6].pos = {aabb.min.x(), aabb.max.y(), aabb.min.z()}; + verts[7].pos = {aabb.max.x(), aabb.max.y(), aabb.min.z()}; return verts; }