mirror of https://github.com/AxioDL/metaforce.git
Update hecl, implement CScriptPickup
This commit is contained in:
parent
651d0a27c2
commit
5941a61ae6
|
@ -442,7 +442,7 @@ public:
|
|||
void SetThermalColdScale2(float s) { xf28_thermColdScale2 = s; }
|
||||
float IntegrateVisorFog(float f) const;
|
||||
u32 GetUpdateFrameIndex() const { return x8d8_updateFrameIdx; }
|
||||
void sub_80043F2C(u32 frameCount, CAssetId msg, float f1)
|
||||
void QueueMessage(u32 frameCount, CAssetId msg, float f1)
|
||||
{
|
||||
xf84_ = frameCount;
|
||||
xf88_ = msg;
|
||||
|
|
|
@ -83,16 +83,16 @@ static const char* LightingShadowGLSL =
|
|||
"{\n"
|
||||
" vec4 ret = ambient;\n"
|
||||
" \n"
|
||||
" vec3 delta = mvPosIn.xyz - lights[i].pos.xyz;\n"
|
||||
" vec3 delta = mvPosIn.xyz - lights[0].pos.xyz;\n"
|
||||
" float dist = length(delta);\n"
|
||||
" float angDot = clamp(dot(normalize(delta), lights[i].dir.xyz), 0.0, 1.0);\n"
|
||||
" float att = 1.0 / (lights[i].linAtt[2] * dist * dist +\n"
|
||||
" lights[i].linAtt[1] * dist +\n"
|
||||
" lights[i].linAtt[0]);\n"
|
||||
" float angAtt = lights[i].angAtt[2] * angDot * angDot +\n"
|
||||
" lights[i].angAtt[1] * angDot +\n"
|
||||
" lights[i].angAtt[0];\n"
|
||||
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0) *\n"
|
||||
" float angDot = clamp(dot(normalize(delta), lights[0].dir.xyz), 0.0, 1.0);\n"
|
||||
" float att = 1.0 / (lights[0].linAtt[2] * dist * dist +\n"
|
||||
" lights[0].linAtt[1] * dist +\n"
|
||||
" lights[0].linAtt[0]);\n"
|
||||
" float angAtt = lights[0].angAtt[2] * angDot * angDot +\n"
|
||||
" lights[0].angAtt[1] * angDot +\n"
|
||||
" lights[0].angAtt[0];\n"
|
||||
" ret += lights[0].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0) *\n"
|
||||
" texture(extTex0, vtf.extTcgs[0]).r;\n"
|
||||
" \n"
|
||||
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
||||
|
|
|
@ -8,7 +8,7 @@ class EndNamespace:
|
|||
pass
|
||||
|
||||
CENTITY_TYPES = (
|
||||
# Class, Visit, Header
|
||||
# Class, Header
|
||||
('CActor', 'World/CActor.hpp'),
|
||||
('CBallCamera', 'Camera/CBallCamera.hpp'),
|
||||
('CBomb', 'Weapon/CBomb.hpp'),
|
||||
|
|
|
@ -22,6 +22,7 @@ static float kHorizontalAngleTable[] = { 30.f, 30.f, 30.f };
|
|||
static float kVerticalVarianceTable[] = { 30.f, 30.f, 30.f };
|
||||
|
||||
float CPlayerGun::CMotionState::gGunExtendDistance = 0.125f;
|
||||
float CPlayerGun::skTractorBeamFactor = 0.5f / CPlayerState::GetMissileComboChargeFactor();
|
||||
|
||||
CPlayerGun::CPlayerGun(TUniqueId playerId)
|
||||
: x0_lights(8, zeus::CVector3f{-30.f, 0.f, 30.f}, 4, 4, 0, 0, 0, 0.1f), x538_playerId(playerId),
|
||||
|
|
|
@ -30,6 +30,7 @@ class CFinalInput;
|
|||
class CPlayerGun
|
||||
{
|
||||
public:
|
||||
static float skTractorBeamFactor;
|
||||
enum class EMissleMode
|
||||
{
|
||||
Inactive,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "CGameOptions.hpp"
|
||||
#include "MP1/CSamusHud.hpp"
|
||||
#include "GuiSys/CStringTable.hpp"
|
||||
#include "Camera/CFirstPersonCamera.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -51,20 +52,97 @@ void CScriptPickup::Think(float dt, CStateManager& mgr)
|
|||
if (!GetActive())
|
||||
return;
|
||||
|
||||
|
||||
if (x278_ >= 0.f)
|
||||
{
|
||||
CPhysicsActor::Stop();
|
||||
x278_ -= dt;
|
||||
return;
|
||||
}
|
||||
|
||||
x270_ += dt;
|
||||
if (x28c_25_ && (x270_ - x26c_) < 2.f)
|
||||
x270_ = zeus::max(2.f * dt - x270_, (2.f - x26c_) - FLT_EPSILON);
|
||||
|
||||
CModelFlags drawFlags{0, 0, 3, zeus::CColor(1.f, 1.f, 1.f, 1.f)};
|
||||
|
||||
if (x268_ != 0.f)
|
||||
{
|
||||
if (x270_ < x268_)
|
||||
{
|
||||
drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, 1.f, x270_ / x268_));
|
||||
drawFlags.x2_flags &= 0xFFFC;
|
||||
drawFlags.x2_flags |= 1;
|
||||
}
|
||||
else
|
||||
x268_ = 0.f;
|
||||
}
|
||||
else if (x26c_ != 0.f)
|
||||
{
|
||||
x270_ += dt;
|
||||
float alpha = 1.f;
|
||||
if (x26c_ < 2.f)
|
||||
alpha = 1.f - (x26c_ / x270_);
|
||||
else if ((x270_ - x26c_) < 2.f)
|
||||
alpha = (x270_ - x26c_) * 0.5f;
|
||||
|
||||
drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, 1.f, 1.f, alpha));
|
||||
drawFlags.x2_flags &= 0xFFFC;
|
||||
drawFlags.x2_flags |= 1;
|
||||
}
|
||||
|
||||
xb4_drawFlags = drawFlags;
|
||||
|
||||
if (x64_modelData)
|
||||
{
|
||||
if (x64_modelData->HasAnimData())
|
||||
{
|
||||
SAdvancementDeltas deltas = UpdateAnimation(dt, mgr, true);
|
||||
MoveToOR(deltas.x0_posDelta, dt);
|
||||
RotateToOR(deltas.xc_rotDelta, dt);
|
||||
}
|
||||
|
||||
if (x28c_25_)
|
||||
{
|
||||
zeus::CVector3f posVec =
|
||||
GetTranslation() - mgr.GetPlayer().GetTranslation() + (2.f * zeus::CVector3f::skUp);
|
||||
posVec = (20.f * (0.5f * zeus::max(2.f, x274_ + dt))) * posVec.normalized();
|
||||
|
||||
float chargeFactor = 0.f;
|
||||
if (x28c_26_ && mgr.GetPlayer().GetPlayerGun()->IsCharging())
|
||||
chargeFactor = mgr.GetPlayer().GetPlayerGun()->GetChargeBeamFactor();
|
||||
|
||||
if (chargeFactor < CPlayerGun::skTractorBeamFactor)
|
||||
{
|
||||
x28c_26_ = false;
|
||||
x28c_25_ = false;
|
||||
posVec.zeroOut();
|
||||
}
|
||||
SetVelocityOR(posVec);
|
||||
}
|
||||
else if (x28c_24_)
|
||||
{
|
||||
float chargeFactor = mgr.GetPlayer().GetPlayerGun()->IsCharging()
|
||||
? mgr.GetPlayer().GetPlayerGun()->GetChargeBeamFactor()
|
||||
: 0.f;
|
||||
|
||||
if (chargeFactor > CPlayerGun::skTractorBeamFactor)
|
||||
{
|
||||
zeus::CVector3f posVec =
|
||||
(GetTranslation() - mgr.GetCameraManager()->GetFirstPersonCamera()->GetTranslation()).normalized();
|
||||
float relFov = zeus::CRelAngle(zeus::degToRad(g_tweakGame->GetFirstPersonFOV()));
|
||||
if (mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().upVector().dot(posVec) >
|
||||
std::cos(relFov) && posVec.magSquared() < (30.f * 30.f))
|
||||
{
|
||||
x28c_25_ = true;
|
||||
x28c_26_ = true;
|
||||
x274_ = 0.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (x26c_ != 0.f && x270_ > x26c_)
|
||||
mgr.FreeScriptObject(GetUniqueId());
|
||||
|
||||
}
|
||||
|
||||
void CScriptPickup::Touch(CActor& act, CStateManager& mgr)
|
||||
|
@ -101,10 +179,12 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr)
|
|||
if (total == colRate)
|
||||
{
|
||||
CPersistentOptions& opts = g_GameState->SystemOptions();
|
||||
mgr.sub_80043F2C(mgr.GetHUDMessageFrameCount() + 1,
|
||||
g_ResFactory->GetResourceIdByName(opts.GetAllItemsCollected() ?
|
||||
"STRG_AllPickupsFound_2" :
|
||||
"STRG_AllPickupsFound_1")->id, 0.f);
|
||||
mgr.QueueMessage(mgr.GetHUDMessageFrameCount() + 1,
|
||||
g_ResFactory
|
||||
->GetResourceIdByName(opts.GetAllItemsCollected() ? "STRG_AllPickupsFound_2"
|
||||
: "STRG_AllPickupsFound_1")
|
||||
->id,
|
||||
0.f);
|
||||
opts.SetAllItemsCollected(true);
|
||||
}
|
||||
}
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 4fe24ea79605842886b1cbf607827da226621975
|
||||
Subproject commit 594c6f3c583e455de062aecfa9566b2da58e18ca
|
Loading…
Reference in New Issue