diff --git a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp index 7971f3ae8..f63fa39fa 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp @@ -218,18 +218,18 @@ struct HealthInfo : BigDNA { struct LightParameters : BigDNA { AT_DECL_DNA_YAML Value propertyCount; - Value unknown1; - Value unknown2; + Value castShadow; + Value shadowScale; Value shadowTesselation; - Value unknown3; - Value unknown4; - Value noLightsAmbient; // CColor + Value shadowAlpha; + Value maxShadowHeight; + Value ambientColor; // CColor Value makeLights; Value worldLightingOptions; - Value lightRecalculationOptions; - Value actorPosBias; - Value maxDynamicLights; - Value maxAreaLights; + Value lightRecalculation; + Value lightingPositionOffset; + Value numDynamicLights; + Value numAreaLights; Value ambientChannelOverflow; Value layerIndex; }; diff --git a/DataSpec/DNAMP1/ScriptObjects/RandomRelay.hpp b/DataSpec/DNAMP1/ScriptObjects/RandomRelay.hpp index f43182497..9738dd2b8 100644 --- a/DataSpec/DNAMP1/ScriptObjects/RandomRelay.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/RandomRelay.hpp @@ -9,9 +9,9 @@ struct RandomRelay : IScriptObject { AT_DECL_DNA_YAML AT_DECL_DNAV String<-1> name; - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; + Value sendSetSize; + Value sendSetVariance; + Value percentSize; + Value active; }; } // namespace DataSpec::DNAMP1 diff --git a/Runtime/Character/CBodyController.cpp b/Runtime/Character/CBodyController.cpp index a5d7dbbaf..469e1067c 100644 --- a/Runtime/Character/CBodyController.cpp +++ b/Runtime/Character/CBodyController.cpp @@ -117,7 +117,7 @@ void CBodyController::FaceDirection3D(const zeus::CVector3f& v0, const zeus::CVe zeus::CUnitVector3f uv0 = v0; zeus::CUnitVector3f uv1 = v1; float dot = uv0.dot(uv1); - if (std::fabs(dot - 1.f) > 0.00001f) { + if (std::fabs(dot - 1.f) >= 0.00001f) { if (dot < -0.9999f) { zeus::CQuaternion rot = zeus::CQuaternion::fromAxisAngle(act->GetTransform().basis[2], zeus::degToRad(dt * x2fc_turnSpeed)); diff --git a/Runtime/Character/CBodyState.cpp b/Runtime/Character/CBodyState.cpp index 45c6921aa..0bdea5c66 100644 --- a/Runtime/Character/CBodyState.cpp +++ b/Runtime/Character/CBodyState.cpp @@ -136,8 +136,6 @@ pas::EAnimationState CBSProjectileAttack::GetBodyStateTransition(float dt, CBody return pas::EAnimationState::KnockBack; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Locomotion)) return pas::EAnimationState::Locomotion; - if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Generate)) - return pas::EAnimationState::Generate; if (bc.IsAnimationOver() || bc.GetCommandMgr().GetCmd(EBodyStateCmd::NextState)) return pas::EAnimationState::Locomotion; return pas::EAnimationState::Invalid; diff --git a/Runtime/Character/CSteeringBehaviors.cpp b/Runtime/Character/CSteeringBehaviors.cpp index 2fe6bb0a3..782cc7c2d 100644 --- a/Runtime/Character/CSteeringBehaviors.cpp +++ b/Runtime/Character/CSteeringBehaviors.cpp @@ -51,7 +51,7 @@ zeus::CVector3f CSteeringBehaviors::Separation(const CPhysicsActor& actor, const if (!posDiff.canBeNormalized()) return actor.GetTransform().frontVector(); - return (1.f - (posDiff.magSquared() / (separation * separation))) * posDiff; + return (1.f - (posDiff.magSquared() / (separation * separation))) * posDiff.normalized(); } zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, rstl::reserved_vector& list, diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp index c469ec488..ce6d5f6ee 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp @@ -233,10 +233,10 @@ void CTexturedQuadFilter::drawCropped(const zeus::CColor& color, float uvScale) float yBias = CGraphics::g_CroppedViewport.x8_top / float(g_Viewport.xc_height); Vert verts[4] = { - {{-1.0, -1.0, 0.f}, {xBias * uvScale, yBias * uvScale}}, - {{-1.0, 1.0, 0.f}, {xBias * uvScale, (yBias + yFac) * uvScale}}, - {{1.0, -1.0, 0.f}, {(xBias + xFac) * uvScale, yBias * uvScale}}, - {{1.0, 1.0, 0.f}, {(xBias + xFac) * uvScale, (yBias + yFac) * uvScale}}, + {{-1.f, -1.f, 0.f}, {xBias * uvScale, yBias * uvScale}}, + {{-1.f, 1.f, 0.f}, {xBias * uvScale, (yBias + yFac) * uvScale}}, + {{1.f, -1.f, 0.f}, {(xBias + xFac) * uvScale, yBias * uvScale}}, + {{1.f, 1.f, 0.f}, {(xBias + xFac) * uvScale, (yBias + yFac) * uvScale}}, }; m_vbo->load(verts, sizeof(verts)); diff --git a/Runtime/MP1/CFaceplateDecoration.cpp b/Runtime/MP1/CFaceplateDecoration.cpp index 64ad099fc..baa067bcc 100644 --- a/Runtime/MP1/CFaceplateDecoration.cpp +++ b/Runtime/MP1/CFaceplateDecoration.cpp @@ -37,7 +37,7 @@ void CFaceplateDecoration::Draw(CStateManager& stateMgr) { if (xc_ready && m_texFilter) { zeus::CColor color = zeus::skWhite; color.a() = stateMgr.GetPlayer().GetVisorSteam().GetAlpha(); - m_texFilter->draw(color, 1.f); + m_texFilter->DrawFilter(EFilterShape::FullscreenQuarters, color, 1.f); } } diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 9d84242c7..baaed1be4 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -71,6 +71,7 @@ CFrontEndUI::SNewFileSelectFrame::SNewFileSelectFrame(CSaveGameScreen* sui, u32 } void CFrontEndUI::SNewFileSelectFrame::FinishedLoading() { + x1c_loadedFrame->Reset(); x1c_loadedFrame->SetAspectConstraint(1.78f); x20_tablegroup_fileselect = static_cast(x1c_loadedFrame->FindWidget("tablegroup_fileselect")); diff --git a/Runtime/MP1/CMessageScreen.cpp b/Runtime/MP1/CMessageScreen.cpp index 2bb3f346b..dab86a30f 100644 --- a/Runtime/MP1/CMessageScreen.cpp +++ b/Runtime/MP1/CMessageScreen.cpp @@ -46,6 +46,7 @@ bool CMessageScreen::Update(float dt, float blurAmt) { x70_blurAmt = blurAmt; if (!x18_loadedMsgScreen && xc_msgScreen.IsLoaded() && x0_msg.IsLoaded()) { x18_loadedMsgScreen = xc_msgScreen.GetObj(); + x18_loadedMsgScreen->Reset(); x1c_textpane_message = static_cast(x18_loadedMsgScreen->FindWidget("textpane_message")); x20_basewidget_top = x18_loadedMsgScreen->FindWidget("basewidget_top"); x24_basewidget_center = x18_loadedMsgScreen->FindWidget("basewidget_center"); diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index b64e5877c..7c3f82c3d 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -42,8 +42,10 @@ CSamusHud::CSamusHud(CStateManager& stateMgr) x72c_camZTweaks[i] = 0.5f * i - 8.f; x264_loadedFrmeHelmet = x258_frmeHelmet.GetObj(); + x264_loadedFrmeHelmet->Reset(); x264_loadedFrmeHelmet->SetMaxAspect(1.78f); x274_loadedFrmeBaseHud = x268_frmeBaseHud.GetObj(); + x274_loadedFrmeBaseHud->Reset(); x274_loadedFrmeBaseHud->SetMaxAspect(1.78f); x2a0_helmetIntf = std::make_unique(*x264_loadedFrmeHelmet); diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index d9397e301..2912b9413 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -889,7 +889,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) { } zeus::CTransform orient = zeus::CTransform(); - if (desc->x45_25_x31_27_PMOO) + if (!desc->x45_25_x31_27_PMOO) orient = x1d8_orientation; orient = orient * x22c_globalOrientation; diff --git a/Runtime/Particle/CParticleElectric.cpp b/Runtime/Particle/CParticleElectric.cpp index 023e008cd..b8cd3850a 100644 --- a/Runtime/Particle/CParticleElectric.cpp +++ b/Runtime/Particle/CParticleElectric.cpp @@ -153,7 +153,7 @@ void CParticleElectric::UpdateLine(int idx, int frame) { void CParticleElectric::UpdateElectricalEffects() { for (auto it = x3e8_electricManagers.begin(); it != x3e8_electricManagers.end();) { CParticleElectricManager& elec = *it; - if (elec.x4_slif < 1) { + if (elec.x4_slif <= 1) { x1bc_allocated[elec.x0_idx] = false; if (elec.x10_gpsmIdx != -1) x400_gpsmGenerators[elec.x10_gpsmIdx]->SetParticleEmission(false); @@ -373,6 +373,7 @@ void CParticleElectric::CreateNewParticles(int count) { gen.SetTranslation(scale * x420_calculatedVerts.front()); gen.SetParticleEmission(true); elec.x10_gpsmIdx = k; + break; } } } @@ -386,6 +387,7 @@ void CParticleElectric::CreateNewParticles(int count) { gen.SetTranslation(scale * x420_calculatedVerts.back()); gen.SetParticleEmission(true); elec.x14_epsmIdx = k; + break; } } } diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 698db8ae6..5fcc339b4 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -1632,7 +1632,8 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C (x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == EChargePhase::NotCharging && !x832_29_lockedOn && (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f && player.GetPlayerMovementState() == CPlayer::EPlayerMovementState::OnGround && !player.IsInFreeLook() && - !player.GetFreeLookStickState() && x304_ == 0 && std::fabs(player.GetAngularVelocityOR().angle()) <= 0.1f && + !player.GetFreeLookStickState() && player.GetOrbitState() == CPlayer::EPlayerOrbitState::NoOrbit && + std::fabs(player.GetAngularVelocityOR().angle()) <= 0.1f && camBobT <= 0.01f && !mgr.GetCameraManager()->IsInCinematicCamera() && player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn && player.GetGrappleState() == CPlayer::EGrappleState::None && !x834_30_inBigStrike && !x835_25_inPhazonBeam); @@ -1933,7 +1934,7 @@ void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateM UpdateAuxWeapons(advDt, beamTargetXf, mgr); DoUserAnimEvents(advDt, mgr); - if (x304_ == 1 && GetTargetId(mgr) != kInvalidUniqueId) { + if (player.GetOrbitState() == CPlayer::EPlayerOrbitState::OrbitObject && GetTargetId(mgr) != kInvalidUniqueId) { if (!x832_29_lockedOn && !x832_26_comboFiring && (x2f8_stateFlags & 0x10) != 0x10) { x832_29_lockedOn = true; x6a0_motionState.SetState(CMotionState::EMotionState::LockOn); diff --git a/Runtime/World/CExplosion.cpp b/Runtime/World/CExplosion.cpp index 609d8d7cc..041d2d366 100644 --- a/Runtime/World/CExplosion.cpp +++ b/Runtime/World/CExplosion.cpp @@ -65,7 +65,7 @@ void CExplosion::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CSt void CExplosion::Think(float dt, CStateManager& mgr) { if (xe4_28_transformDirty) { xe8_particleGen->SetGlobalTranslation(GetTranslation()); - xe8_particleGen->SetGlobalOrientation(GetTransform().getRotation()); + xe8_particleGen->SetOrientation(GetTransform().getRotation()); xe4_28_transformDirty = false; } xe8_particleGen->Update(dt); diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index c96eab570..c3e873770 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -952,7 +952,8 @@ void CPatterned::GenerateDeathExplosion(CStateManager& mgr) { CEntityInfo(GetAreaIdAlways(), CEntity::NullConnectionList), "", xf, 1, zeus::skOne3f, zeus::skWhite); mgr.AddObject(explo); - } else if (x530_deathExplosionElectric) { + } + if (x530_deathExplosionElectric) { zeus::CTransform xf(GetTransform()); xf.origin = GetTransform() * (x64_modelData->GetScale() * x514_deathExplosionOffset); CExplosion* explo = new CExplosion(*x530_deathExplosionElectric, mgr.AllocateUniqueId(), true, diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 8cf99a5cc..1a2ffc4b1 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -5472,7 +5472,7 @@ void CPlayer::Touch(CActor& actor, CStateManager& mgr) { void CPlayer::CVisorSteam::SetSteam(float targetAlpha, float alphaInDur, float alphaOutDur, CAssetId txtr, bool affectsThermal) { - if (x1c_txtr.IsValid() || targetAlpha > x10_nextTargetAlpha) { + if (!x1c_txtr.IsValid() || targetAlpha > x10_nextTargetAlpha) { x10_nextTargetAlpha = targetAlpha; x14_nextAlphaInDur = alphaInDur; x18_nextAlphaOutDur = alphaOutDur; @@ -5484,9 +5484,9 @@ void CPlayer::CVisorSteam::SetSteam(float targetAlpha, float alphaInDur, float a CAssetId CPlayer::CVisorSteam::GetTextureId() const { return xc_tex; } void CPlayer::CVisorSteam::Update(float dt) { - if (!x1c_txtr.IsValid()) + if (!x1c_txtr.IsValid()) { x0_curTargetAlpha = 0.f; - else { + } else { x0_curTargetAlpha = x10_nextTargetAlpha; x4_curAlphaInDur = x14_nextAlphaInDur; x8_curAlphaOutDur = x18_nextAlphaOutDur; @@ -5494,16 +5494,18 @@ void CPlayer::CVisorSteam::Update(float dt) { } x1c_txtr.Reset(); - if ((x20_alpha - x0_curTargetAlpha) < 0.000009999f || std::fabs(x20_alpha) > 0.000009999f) + if (zeus::close_enough(x20_alpha, x0_curTargetAlpha) && zeus::close_enough(x20_alpha, 0.f)) return; if (x20_alpha > x0_curTargetAlpha) { if (x24_delayTimer <= 0.f) { x20_alpha -= dt / x8_curAlphaOutDur; - x20_alpha = std::min(x20_alpha, x0_curTargetAlpha); + if (x20_alpha < x0_curTargetAlpha) + x20_alpha = x0_curTargetAlpha; } else { - x24_delayTimer = x0_curTargetAlpha - dt; - x24_delayTimer = zeus::max(0.f, x24_delayTimer); + x24_delayTimer -= dt; + if (x24_delayTimer < 0.f) + x24_delayTimer = 0.f; } return; } diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index 3f0a38edb..6ff4051a4 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -815,6 +815,7 @@ void CScriptGunTurret::ProcessTargettingState(EStateMsg msg, CStateManager& mgr, } zeus::CVector3f diffVec = x404_targetPosition - GetTranslation(); + diffVec.z() = 0.f; if (diffVec.canBeNormalized()) { zeus::CVector3f normDiff = diffVec.normalized(); float angDif = zeus::CVector3f::getAngleDiff(normDiff, GetTransform().frontVector()); diff --git a/Runtime/World/CScriptRandomRelay.cpp b/Runtime/World/CScriptRandomRelay.cpp index 9207202ca..92c231147 100644 --- a/Runtime/World/CScriptRandomRelay.cpp +++ b/Runtime/World/CScriptRandomRelay.cpp @@ -3,12 +3,12 @@ #include "TCastTo.hpp" namespace urde { -CScriptRandomRelay::CScriptRandomRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 connCount, - s32 variance, bool clamp, bool active) +CScriptRandomRelay::CScriptRandomRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 sendSetSize, + s32 sendSetVariance, bool percentSize, bool active) : CEntity(uid, info, active, name) -, x34_connectionCount((clamp && connCount > 100) ? 100 : connCount) -, x38_variance(variance) -, x3c_clamp(clamp) {} +, x34_sendSetSize((percentSize && sendSetSize > 100) ? 100 : sendSetSize) +, x38_sendSetVariance(sendSetVariance) +, x3c_percentSize(percentSize) {} void CScriptRandomRelay::Accept(IVisitor& visitor) { visitor.Visit(this); } @@ -27,27 +27,36 @@ void CScriptRandomRelay::SendLocalScriptMsgs(EScriptObjectState state, CStateMan return; } -#if 0 - std::vector> objs; - objs.reserve(10); - for (const SConnection& conn : x20_conns) - { - auto list = stateMgr.GetIdListForScript(conn.x8_objId); - auto it = list.first; - for (; it != list.second; ++it) - { - CEntity* ent = stateMgr.ObjectById(it->second); - if (ent && ent->GetActive()) - objs.emplace_back(ent, conn.x4_msg); - } + std::vector> objs; + objs.reserve(10); + for (const SConnection& conn : x20_conns) { + auto list = stateMgr.GetIdListForScript(conn.x8_objId); + for (auto it = list.first; it != list.second; ++it) { + CEntity* ent = stateMgr.ObjectById(it->second); + if (ent && ent->GetActive()) + objs.emplace_back(ent, conn.x4_msg); } + } - u32 r0 = x34_connectionCount; - if (x3c_clamp) - r0 = u32(0.5 + (float(x34_connectionCount) / 100.f)); + s32 targetSetSize = x34_sendSetSize; + if (x3c_percentSize) + targetSetSize = s32(0.5f + (float(x34_sendSetSize * objs.size()) / 100.f)); + targetSetSize += s32(float(x38_sendSetVariance) * 2.f * stateMgr.GetActiveRandom()->Float()) - x38_sendSetVariance; + targetSetSize = zeus::clamp(0, targetSetSize, 64); - float fVariance = float(x38_variance) * (2.f * stateMgr.GetActiveRandom()->Float()); + while (objs.size() > targetSetSize) { + s32 randomRemoveIdx = s32(stateMgr.GetActiveRandom()->Float() * float(objs.size()) * 0.99f); + auto it = objs.begin(); + for (s32 i = 0; i < randomRemoveIdx; ++i) { + ++it; + if (it == objs.end()) + break; + } + if (it != objs.end()) + objs.erase(it); + } -#endif + for (const auto& o : objs) + stateMgr.SendScriptMsg(o.first, GetUniqueId(), o.second); } } // namespace urde diff --git a/Runtime/World/CScriptRandomRelay.hpp b/Runtime/World/CScriptRandomRelay.hpp index e4f67d516..955cd0f5f 100644 --- a/Runtime/World/CScriptRandomRelay.hpp +++ b/Runtime/World/CScriptRandomRelay.hpp @@ -4,12 +4,13 @@ namespace urde { class CScriptRandomRelay : public CEntity { - u32 x34_connectionCount; - u32 x38_variance; - bool x3c_clamp; + s32 x34_sendSetSize; + s32 x38_sendSetVariance; + bool x3c_percentSize; public: - CScriptRandomRelay(TUniqueId, std::string_view, const CEntityInfo&, s32, s32, bool, bool); + CScriptRandomRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 sendSetSize, + s32 sendSetVariance, bool percentSize, bool active); void Accept(IVisitor& visitor); void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr); diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 07274e9ca..4ac8e0cab 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -953,12 +953,12 @@ CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, int if (!EnsurePropertyCount(propCount, 5, "RandomRelay")) return nullptr; std::string name = mgr.HashInstanceName(in); - u32 w1 = in.readUint32Big(); - u32 w2 = in.readUint32Big(); - bool b1 = in.readBool(); - bool b2 = in.readBool(); + u32 sendSetSize = in.readUint32Big(); + u32 sendSetVariance = in.readUint32Big(); + bool percentSize = in.readBool(); + bool active = in.readBool(); - return new CScriptRandomRelay(mgr.AllocateUniqueId(), name, info, w1, w2, b1, b2); + return new CScriptRandomRelay(mgr.AllocateUniqueId(), name, info, sendSetSize, sendSetVariance, percentSize, active); } CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { @@ -2033,7 +2033,7 @@ CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, CScriptDebris::EOrientationType particle2Or = CScriptDebris::EOrientationType(in.readUint32Big()); CAssetId particle3 = in.readUint32Big(); - zeus::CVector3f particle3Scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f particle3Scale = zeus::CVector3f::ReadBig(in); /* Not actually used, go figure */ CScriptDebris::EOrientationType particle3Or = CScriptDebris::EOrientationType(in.readUint32Big()); bool solid = in.readBool(); @@ -2051,7 +2051,7 @@ CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, downwardSpeed, localOffset, particle1, particle1Scale, particle1GlobalTranslation, deferDeleteTillParticle1Done, particle1Or, particle2, particle2Scale, particle2GlobalTranslation, deferDeleteTillParticle2Done, particle2Or, particle3, - particle3Scale, particle3Or, solid, dieOnProjectile, noBounce, active); + particle2Scale, particle3Or, solid, dieOnProjectile, noBounce, active); } CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { diff --git a/Shaders/CRandomStaticFilter.shader b/Shaders/CRandomStaticFilter.shader index 5c034344a..3c23b212e 100644 --- a/Shaders/CRandomStaticFilter.shader +++ b/Shaders/CRandomStaticFilter.shader @@ -221,15 +221,13 @@ struct VertToFrag ivec2 Lookup8BPP(in vec2 uv, in float randOff) { - float bx; - float rx = modf(uv.x / 8.0, bx) * 8.0; - float by; - float ry = modf(uv.y / 4.0, by) * 4.0; - float bidx = by * 80.0 + bx; - float addr = bidx * 32.0 + ry * 8.0 + rx + randOff; - float y; - float x = modf(addr / 1024.0, y) * 1024.0; - return ivec2(x, y); + int bx = int(uv.x) >> 3; + int rx = int(uv.x) & 0x7; + int by = int(uv.y) >> 2; + int ry = int(uv.y) & 0x3; + int bidx = by * 128 + bx; + int addr = bidx * 32 + ry * 8 + rx + int(randOff); + return ivec2(addr & 0x3ff, addr >> 10); } SBINDING(0) in VertToFrag vtf; @@ -254,15 +252,13 @@ struct VertToFrag static int3 Lookup8BPP(float2 uv, float randOff) { - float bx; - float rx = modf(uv.x / 8.0, bx) * 8.0; - float by; - float ry = modf(uv.y / 4.0, by) * 4.0; - float bidx = by * 80.0 + bx; - float addr = bidx * 32.0 + ry * 8.0 + rx + randOff; - float y; - float x = modf(addr / 1024.0, y) * 1024.0; - return int3(x, y, 0); + int bx = int(uv.x) >> 3; + int rx = int(uv.x) & 0x7; + int by = int(uv.y) >> 2; + int ry = int(uv.y) & 0x3; + int bidx = by * 128 + bx; + int addr = bidx * 32 + ry * 8 + rx + int(randOff); + return int3(addr & 0x3ff, addr >> 10, 0); } Texture2D tex : register(t0); @@ -286,15 +282,13 @@ struct VertToFrag static uint2 Lookup8BPP(float2 uv, float randOff) { - float bx; - float rx = modf(uv.x / 8.0, bx) * 8.0; - float by; - float ry = modf(uv.y / 4.0, by) * 4.0; - float bidx = by * 80.0 + bx; - float addr = bidx * 32.0 + ry * 8.0 + rx + randOff; - float y; - float x = modf(addr / 1024.0, y) * 1024.0; - return uint2(x, y); + int bx = int(uv.x) >> 3; + int rx = int(uv.x) & 0x7; + int by = int(uv.y) >> 2; + int ry = int(uv.y) & 0x3; + int bidx = by * 128 + bx; + int addr = bidx * 32 + ry * 8 + rx + int(randOff); + return uint2(addr & 0x3ff, addr >> 10); } fragment float4 fmain(VertToFrag vtf [[ stage_in ]],