Merge branch 'main' of ssh+git://git.axiodl.com:6431/AxioDL/metaforce

This commit is contained in:
Phillip Stephens 2021-05-07 02:55:57 -07:00
commit 61a524e692
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
6 changed files with 52 additions and 63 deletions

View File

@ -60,7 +60,7 @@ string(TIMESTAMP CURRENT_YEAR "%Y")
# Add version information to CI environment variables
if(DEFINED ENV{GITHUB_ENV})
file(APPEND "$ENV{GITHUB_ENV}" "METAFORCE_VERSION=${METAFORCE_WC_DESCRIBE}")
file(APPEND "$ENV{GITHUB_ENV}" "METAFORCE_VERSION=${METAFORCE_WC_DESCRIBE}\n")
endif()
message(STATUS "Metaforce version set to ${METAFORCE_WC_DESCRIBE}")
project(metaforce LANGUAGES C CXX ASM VERSION ${METAFORCE_VERSION_STRING})

View File

@ -8,19 +8,22 @@ constexpr zeus::CVector3f kDefaultPosition(0.f, 0.f, 0.f);
constexpr zeus::CVector3f kDefaultDirection(0.f, -1.f, 0.f);
float CLight::CalculateLightRadius() const {
if (x28_distL < FLT_EPSILON && x2c_distQ < FLT_EPSILON)
return FLT_MAX;
float intens = GetIntensity();
if (x2c_distQ > FLT_EPSILON) {
if (intens <= FLT_EPSILON)
if (FLT_EPSILON > x28_distL && FLT_EPSILON > x2c_distQ) {
return 0.f;
return std::sqrt(intens / (0.0588235f * x2c_distQ));
}
if (x28_distL > FLT_EPSILON)
return intens / (0.0588235f * x28_distL);
float intensity = GetIntensity();
if (x2c_distQ <= FLT_EPSILON) {
constexpr float mulVal = std::min(0.05882353f, 0.2f); // Yes, retro really did do this
if (x28_distL > FLT_EPSILON) {
return intensity / (mulVal * x28_distL);
}
} else {
constexpr float mulVal = std::min(0.05882353f, 0.2f); // See above comment
if (intensity > FLT_EPSILON) {
return std::sqrt(intensity / (mulVal * x2c_distQ));
}
}
return 0.f;
}
@ -59,29 +62,7 @@ CLight::CLight(const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeu
CLight::CLight(ELightType type, const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeus::CColor& color,
float cutoff)
: x0_pos(pos)
, xc_dir(dir)
, x18_color(color)
, x1c_type(type)
, x20_spotCutoff(cutoff) {
switch (type) {
case ELightType::Spot: {
const float cosCutoff = std::cos(zeus::degToRad(cutoff));
x30_angleC = 0.f;
x34_angleL = -cosCutoff / (1.0f - cosCutoff);
x38_angleQ = 1.f / (1.0f - cosCutoff);
break;
}
case ELightType::Directional: {
x24_distC = 1.f;
x28_distL = 0.f;
x2c_distQ = 0.f;
break;
}
default:
break;
}
}
: x0_pos(pos), xc_dir(dir), x18_color(color), x1c_type(type), x20_spotCutoff(cutoff) {}
zeus::CColor CLight::GetNormalIndependentLightingAtPoint(const zeus::CVector3f& point) const {
if (x1c_type == ELightType::LocalAmbient)

View File

@ -129,7 +129,7 @@ CThardus::CThardus(TUniqueId uid, std::string_view name, const CEntityInfo& info
SetMass(100000.f);
}
void CThardus::sub801dbf34(float dt, CStateManager& mgr) {
void CThardus::UpdateRockThermalState(float dt, CStateManager& mgr) {
if (x7c4_ == 0) {
x93a_ = false;
return;
@ -267,7 +267,7 @@ void CThardus::sub801dcfa4(CStateManager& mgr) {
x90c_rockHealths[j] = hInfo->GetHP();
}
} else if (!rock->IsUsingPhazonModel()) {
sub801dae2c(mgr, j);
BreakRock(mgr, j);
DoFaint(mgr);
} else {
rock->SetActive(false);
@ -277,7 +277,7 @@ void CThardus::sub801dcfa4(CStateManager& mgr) {
DoFlinch(mgr);
const bool isThermalActive = mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Thermal;
if (isThermalActive || (!isThermalActive && x7c4_ != 3)) {
sub801dc444(mgr, GetTranslation(), x6d8_);
SetRockParticle(mgr, GetTranslation(), x6d8_);
}
ProcessSoundEvent(x758_, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(),
mgr.GetNextAreaId(), mgr, true);
@ -315,7 +315,7 @@ void CThardus::Think(float dt, CStateManager& mgr) {
}
}
sub801dbf34(dt, mgr);
UpdateRockThermalState(dt, mgr);
if (!sub801dc2c8()) {
// NOTE: (phil), yes this is what's actually happening
@ -385,7 +385,8 @@ void CThardus::Think(float dt, CStateManager& mgr) {
if (auto* act = static_cast<CActor*>(mgr.ObjectById(x610_destroyableRocks[i]))) {
if (!x688_ && !x93c_ && !x909_ && !x93d_) {
bool found = act->GetName().find("Neck_1"sv) != std::string::npos;
if (!found || !x6b0_destroyedRocks[x648_currentRock] || x648_currentRock == x610_destroyableRocks.size() - 1) {
if (!found || !x6b0_destroyedRocks[x648_currentRock] ||
x648_currentRock == x610_destroyableRocks.size() - 1) {
if (!x6b0_destroyedRocks[i]) {
if (!found || x6b0_destroyedRocks[i]) {
act->RemoveMaterial(EMaterialTypes::Orbit, mgr);
@ -494,7 +495,7 @@ void CThardus::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMa
x420_curDamageRemTime = x424_damageWaitTime;
} else if (TCastToConstPtr<CBomb>(mgr.GetObjectById(colAct->GetLastTouchedObject()))) {
if (x644_ == 1 && x93c_) {
sub801dae2c(mgr, x648_currentRock);
BreakRock(mgr, x648_currentRock);
}
}
}
@ -632,7 +633,7 @@ void CThardus::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMa
rock->TakeDamage(zeus::skZero3f, 0.f);
const bool thermalInactive = mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Thermal;
if (thermalInactive || x7c4_ != 3) {
sub801dc444(mgr, proj->GetTranslation(), x6d0_);
SetRockParticle(mgr, proj->GetTranslation(), x6d0_);
}
if (!rock->IsUsingPhazonModel()) {
ProcessSoundEvent(x75c_, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, rock->GetTranslation(),
@ -806,7 +807,7 @@ void CThardus::PathFind(CStateManager& mgr, EStateMsg msg, float arg) {
CPatterned::PathFind(mgr, EStateMsg::Activate, arg);
++x660_;
}
x650_ = sub801dc60c(arg, mgr);
x650_ = GetTargetVector(arg, mgr);
} else if (msg == EStateMsg::Deactivate) {
x8d4_ = false;
}
@ -893,7 +894,7 @@ void CThardus::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
offset, zeus::CQuaternion(GetTransform().buildMatrix3f()).toTransform() * zeus::CVector3f{0.f, 1.f, 0.f},
100.f, CMaterialFilter::MakeInclude({EMaterialTypes::Wall, EMaterialTypes::Floor, EMaterialTypes::Ceiling}));
if (result.IsInvalid()) {
zeus::CVector2f vec = sub801dac30(mgr);
zeus::CVector2f vec = GetSteeringVector(mgr);
if (vec != zeus::skZero2f) {
x650_ = vec;
}
@ -907,7 +908,7 @@ void CThardus::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
}
} else if (x658_ == 0) {
zeus::CVector3f dir = (mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized();
zeus::CVector2f vec = sub801dac30(mgr);
zeus::CVector2f vec = GetSteeringVector(mgr);
if (vec != zeus::skZero2f) {
x650_ = vec;
} else {
@ -1286,7 +1287,7 @@ void CThardus::FindNonDestroyableActors(const std::unique_ptr<CCollisionActorMan
}
}
void CThardus::sub801dae2c(CStateManager& mgr, u32 rockIndex) {
void CThardus::BreakRock(CStateManager& mgr, u32 rockIndex) {
TCastToPtr<CCollisionActor> rockCol =
mgr.ObjectById(x5f0_rockColliders->GetCollisionDescFromIndex(rockIndex).GetCollisionActorId());
if (TCastToPtr<CDestroyableRock> rock = mgr.ObjectById(x610_destroyableRocks[rockIndex])) {
@ -1305,7 +1306,7 @@ void CThardus::sub801dae2c(CStateManager& mgr, u32 rockIndex) {
light->SetActive(true);
if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Thermal ||
(mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Thermal && x7c4_ != 3)) {
sub801dc444(mgr, GetTranslation(), x6d4_);
SetRockParticle(mgr, GetTranslation(), x6d4_);
}
x90c_rockHealths[rockIndex] = hp;
sub801dbc5c(mgr, rock);
@ -1315,7 +1316,7 @@ void CThardus::sub801dae2c(CStateManager& mgr, u32 rockIndex) {
}
}
void CThardus::sub801dc444(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle) {
void CThardus::SetRockParticle(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle) {
u32 w = x6f4_;
++x6f4_;
std::string particleName = fmt::format(FMT_STRING("ROCK_EFFECT{}-{}"), particle.Value(), w);
@ -1445,7 +1446,7 @@ zeus::CVector3f CThardus::sub801de550(CStateManager& mgr) {
unkVec.push_back(lastIdx);
}
//zeus::CVector2f plVec = mgr.GetPlayer().GetTranslation().toVec2f();
// zeus::CVector2f plVec = mgr.GetPlayer().GetTranslation().toVec2f();
float maxDist = 0.f;
float curDist = 0.f;
@ -1491,7 +1492,7 @@ zeus::CVector3f CThardus::sub801de434(CStateManager& mgr) {
->GetTranslation();
}
zeus::CVector2f CThardus::sub801dac30(CStateManager& mgr) const {
zeus::CVector2f CThardus::GetSteeringVector(CStateManager& mgr) const {
zeus::CVector2f ret;
zeus::CVector3f pos = GetTranslation();
for (const auto& repulsor : x664_repulsors) {
@ -1506,7 +1507,8 @@ zeus::CVector2f CThardus::sub801dac30(CStateManager& mgr) const {
}
if (ret != zeus::skZero2f) {
ret = x45c_steeringBehaviors.Arrival2D(*this, x764_startTransform.origin.toVec2f());
ret = x45c_steeringBehaviors.Arrival2D(*this, x764_startTransform.origin.toVec2f()) * zeus::CVector2f(1.f) +
ret * zeus::CVector2f(0.f);
}
return ret;
}
@ -1548,7 +1550,6 @@ void CThardus::BouncePlayer(float intensity, CStateManager& mgr) {
if (intensity <= 0.f) {
return;
}
zeus::CVector3f posDiff = GetTranslation() - mgr.GetPlayer().GetTranslation();
CPlayer::ESurfaceRestraints restraints = mgr.GetPlayer().GetSurfaceRestraint();
if (restraints != CPlayer::ESurfaceRestraints::Air && !mgr.GetPlayer().IsInWaterMovement()) {
@ -1570,7 +1571,7 @@ void CThardus::sub801dbc40() {
x938_ = false;
}
zeus::CVector2f CThardus::sub801dc60c(float arg, CStateManager& mgr) {
zeus::CVector2f CThardus::GetTargetVector(float arg, CStateManager& mgr) {
zeus::CVector2f ret;
if (GetSearchPath() != nullptr) {
if (GetSearchPath()->GetResult() == CPathFindSearch::EResult::Success) {
@ -1582,7 +1583,7 @@ zeus::CVector2f CThardus::sub801dc60c(float arg, CStateManager& mgr) {
}
if (x8d4_ || (!x8d4_ && x7f0_pathFindSearch.OnPath(GetTranslation()) != CPathFindSearch::EResult::Success)) {
zeus::CVector2f vec = sub801dac30(mgr);
zeus::CVector2f vec = GetSteeringVector(mgr);
if (vec != zeus::skZero2f) {
return vec;
}

View File

@ -137,7 +137,7 @@ class CThardus : public CPatterned {
void GatherWaypoints(CScriptWaypoint* wp, CStateManager& mgr, rstl::reserved_vector<TUniqueId, 16>& uids);
void sub801dec80() { x68c_ = 20000; }
void FindNonDestroyableActors(const std::unique_ptr<CCollisionActorManager>& colMgr);
void sub801dbf34(float dt, CStateManager& mgr);
void UpdateRockThermalState(float dt, CStateManager& mgr);
bool sub801dc2c8() const { return (x610_destroyableRocks.size() - 1) == x648_currentRock; }
void sub801de9f8(CStateManager& mgr);
void sub801dd608(CStateManager& mgr);
@ -152,9 +152,9 @@ class CThardus : public CPatterned {
x944_ = 0.f;
}
}
void sub801dae2c(CStateManager& mgr, u32 rockIndex);
void BreakRock(CStateManager& mgr, u32 rockIndex);
void sub801dc444(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle);
void SetRockParticle(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle);
void sub801dbc5c(CStateManager& mgr, CDestroyableRock* rock);
void sub801dbbdc(CStateManager& mgr, CDestroyableRock* rock);
bool sub801dc2c8() { return x648_currentRock == (x610_destroyableRocks.size() - 1); }
@ -168,7 +168,7 @@ class CThardus : public CPatterned {
void RenderFlare(const CStateManager& mgr, float t);
zeus::CVector3f sub801de550(CStateManager& mgr);
zeus::CVector3f sub801de434(CStateManager& mgr);
zeus::CVector2f sub801dc60c(float f1, CStateManager& mgr);
zeus::CVector2f GetTargetVector(float arg, CStateManager& mgr);
void sub801dbc40();
std::optional<CTexturedQuadFilter> m_flareFilter;
@ -185,7 +185,7 @@ class CThardus : public CPatterned {
void _DoSuckState(CStateManager& mgr) { x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "Suck"sv); }
zeus::CVector2f sub801dac30(CStateManager& mgr) const;
zeus::CVector2f GetSteeringVector(CStateManager& mgr) const;
void UpdateHealthInfo(CStateManager& mgr);
void BouncePlayer(float f1, CStateManager& mgr);

View File

@ -227,6 +227,7 @@ CElementGen::~CElementGen() {
bool CElementGen::Update(double t) {
s32 oldMax = x90_MAXP;
s32 oldMBSP = x270_MBSP;
CParticleGlobals::SParticleSystem* prevSystem = CParticleGlobals::instance()->m_currentParticleSystem;
CParticleGlobals::SParticleSystem thisSystem{FOURCC('PART'), this};
CParticleGlobals::instance()->m_currentParticleSystem = &thisSystem;
@ -242,13 +243,14 @@ bool CElementGen::Update(double t) {
bool ret = InternalUpdate(t);
CParticleGlobals::instance()->m_currentParticleSystem = prevSystem;
if (oldMax < x90_MAXP) {
_RecreatePipelines();
if (oldMax < x90_MAXP || oldMBSP < x270_MBSP) {
//_RecreatePipelines();
}
return ret;
}
void CElementGen::_RecreatePipelines() {
size_t maxInsts = x26c_30_MBLR ? (x270_MBSP * x90_MAXP) : x90_MAXP;
size_t maxInsts = x26c_30_MBLR ? 2560 * 2 : 2560;//x26c_30_MBLR ? (x270_MBSP * x90_MAXP) : x90_MAXP;
maxInsts = (maxInsts == 0 ? 256 : maxInsts);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
@ -356,6 +358,11 @@ void CElementGen::AccumulateBounds(const zeus::CVector3f& pos, float size) {
void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 particleFrame) {
CGenDescription* desc = x28_loadedGenDesc;
if (activeParticleCount >= x60_advValues.size()) {
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"),
activeParticleCount, x60_advValues.size());
}
std::array<float, 8>& arr = x60_advValues[activeParticleCount];
CParticleGlobals::instance()->m_particleAccessParameters = &arr;

View File

@ -7,5 +7,5 @@ for i in visigen hecl metaforce crashpad_handler; do
done
macdeployqt Metaforce.app -sign-for-notarization="$CODESIGN_IDENT" -no-strip
create-dmg Metaforce.app --identity="$CODESIGN_IDENT" "$GITHUB_WORKSPACE"
xcrun altool -t osx -f "$GITHUB_WORKSPACE"/*.dmg --primary-bundle-id com.axiodl.URDE --notarize-app \
xcrun altool -t osx -f "$GITHUB_WORKSPACE"/*.dmg --primary-bundle-id com.axiodl.Metaforce --notarize-app \
-u "$ASC_USERNAME" -p "$ASC_PASSWORD" --team-id "$ASC_TEAM_ID"