mirror of https://github.com/AxioDL/metaforce.git
Implement CScriptSpindleCamera
This commit is contained in:
parent
88591f48f0
commit
01af7b735d
|
@ -12,6 +12,25 @@
|
|||
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
|
||||
</Objective-C>
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="hpp" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
|
|
|
@ -11,15 +11,15 @@ struct NewCameraShaker : IScriptObject {
|
|||
String<-1> name;
|
||||
Value<atVec3f> location;
|
||||
Value<bool> active;
|
||||
PlayerParameters flags;
|
||||
PropertyFlags flags;
|
||||
Value<float> duration;
|
||||
Value<float> sfxDist;
|
||||
struct CameraShakerComponent : BigDNA {
|
||||
AT_DECL_DNA
|
||||
PlayerParameters flags;
|
||||
PropertyFlags flags;
|
||||
struct CameraShakePoint : BigDNA {
|
||||
AT_DECL_DNA
|
||||
PlayerParameters flags;
|
||||
PropertyFlags flags;
|
||||
Value<float> attackTime;
|
||||
Value<float> sustainTime;
|
||||
Value<float> duration;
|
||||
|
|
|
@ -350,7 +350,7 @@ struct VisorParameters : BigDNA {
|
|||
Value<atUint32> visorMask;
|
||||
};
|
||||
|
||||
struct PlayerParameters : BigDNA {
|
||||
struct PropertyFlags : BigDNA {
|
||||
AT_DECL_DNA_YAML
|
||||
Value<atUint32> propertyCount;
|
||||
Vector<bool, AT_DNA_COUNT(propertyCount)> bools;
|
||||
|
|
|
@ -25,7 +25,7 @@ struct PlayerActor : IScriptObject {
|
|||
Value<bool> snow;
|
||||
Value<bool> solid;
|
||||
Value<bool> active;
|
||||
PlayerParameters playerParameters;
|
||||
PropertyFlags playerParameters;
|
||||
Value<atUint32> beamId;
|
||||
|
||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
|
||||
|
|
|
@ -5,26 +5,59 @@
|
|||
#include "Parameters.hpp"
|
||||
|
||||
namespace DataSpec::DNAMP1 {
|
||||
|
||||
struct SpindleCamera : IScriptObject {
|
||||
AT_DECL_DNA_YAML
|
||||
AT_DECL_DNAV
|
||||
String<-1> name;
|
||||
Value<atVec3f> location;
|
||||
Value<atVec3f> orientation;
|
||||
Value<bool> unknown1;
|
||||
PlayerParameters playerParameters;
|
||||
Value<float> unknown2;
|
||||
Value<float> unknown3;
|
||||
Value<float> unknown4;
|
||||
Value<float> unknown5;
|
||||
Value<bool> active;
|
||||
/*
|
||||
* 0x1: Look toward hint
|
||||
* 0x2: Flat look delta
|
||||
* 0x8: force minimum-clamp ball-to-cam azimuth
|
||||
* 0x10: minimum-clamp ball-to-cam azimuth
|
||||
* 0x20: Enable clampedAzimuthFromHintDir
|
||||
* 0x40: Enable distOffsetFromBallDist
|
||||
* 0x80: Use ball pos for cam pos Z (vs. hint pos)
|
||||
* 0x100: Enable deltaAngleScaleWithCamDist
|
||||
* 0x200: Use ball pos for look pos Z (vs. hint pos)
|
||||
* 0x400: unused
|
||||
* 0x800: Variable hint-to-ball direction
|
||||
* 0x1000: Damp look azimuth with hint ball-to-cam azimuth < 10-degrees
|
||||
* 0x2000: Enable deleteHintBallDist
|
||||
* 0x4000: Ignore ball-to-cam azimuth sign
|
||||
*/
|
||||
PropertyFlags flags;
|
||||
Value<float> hintToCamDistMin;
|
||||
Value<float> hintToCamDistMax;
|
||||
Value<float> hintToCamVOffMin;
|
||||
Value<float> hintToCamVOffMax;
|
||||
struct SpindleCameraParameters : BigDNA {
|
||||
AT_DECL_DNA
|
||||
Value<atUint32> unknown1;
|
||||
PlayerParameters playerParameters;
|
||||
Value<float> unknown5;
|
||||
Value<float> unknown6;
|
||||
Value<float> unknown7;
|
||||
Value<float> unknown8;
|
||||
} spindleCameraParameters[15];
|
||||
AT_DECL_DNA_YAML
|
||||
Value<atUint32> input;
|
||||
PropertyFlags flags; // high reflect, low reflect
|
||||
Value<float> lowOut;
|
||||
Value<float> highOut;
|
||||
Value<float> lowIn;
|
||||
Value<float> highIn;
|
||||
};
|
||||
SpindleCameraParameters targetHintToCamDeltaAngleVel;
|
||||
SpindleCameraParameters deltaAngleScaleWithCamDist;
|
||||
SpindleCameraParameters hintToCamDist;
|
||||
SpindleCameraParameters distOffsetFromBallDist;
|
||||
SpindleCameraParameters hintBallToCamAzimuth;
|
||||
SpindleCameraParameters unused;
|
||||
SpindleCameraParameters maxHintBallToCamAzimuth;
|
||||
SpindleCameraParameters camLookRelAzimuth;
|
||||
SpindleCameraParameters lookPosZOffset;
|
||||
SpindleCameraParameters camPosZOffset;
|
||||
SpindleCameraParameters clampedAzimuthFromHintDir;
|
||||
SpindleCameraParameters dampingAzimuthSpeed;
|
||||
SpindleCameraParameters targetHintToCamDeltaAngleVelRange;
|
||||
SpindleCameraParameters deleteHintBallDist;
|
||||
SpindleCameraParameters recoverClampedAzimuthFromHintDir;
|
||||
};
|
||||
|
||||
} // namespace DataSpec::DNAMP1
|
||||
|
|
|
@ -35,7 +35,7 @@ void CRelayTracker::RemoveRelay(TEditorId id) {
|
|||
x0_relayStates.erase(std::remove(x0_relayStates.begin(), x0_relayStates.end(), id), x0_relayStates.end());
|
||||
}
|
||||
|
||||
void CRelayTracker::SendMsgs(const TAreaId& areaId, CStateManager& stateMgr) {
|
||||
void CRelayTracker::SendMsgs(TAreaId areaId, CStateManager& stateMgr) {
|
||||
const CWorld* world = stateMgr.WorldNC();
|
||||
u32 relayCount = world->GetRelayCount();
|
||||
|
||||
|
@ -73,8 +73,11 @@ void CRelayTracker::PutTo(CBitStreamWriter& out, const CSaveWorld& saveworld) {
|
|||
u32 relayCount = saveworld.GetRelayCount();
|
||||
std::vector<bool> relays(relayCount);
|
||||
|
||||
for (const TEditorId& id : x0_relayStates)
|
||||
relays[saveworld.GetRelayIndex(id)] = true;
|
||||
for (const TEditorId& id : x0_relayStates) {
|
||||
s32 idx = saveworld.GetRelayIndex(id);
|
||||
if (idx >= 0)
|
||||
relays[idx] = true;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < relayCount; ++i)
|
||||
out.WriteEncoded(u32(relays[i]), 1);
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
bool HasRelay(TEditorId);
|
||||
void AddRelay(TEditorId);
|
||||
void RemoveRelay(TEditorId);
|
||||
void SendMsgs(const TAreaId&, CStateManager&);
|
||||
void SendMsgs(TAreaId, CStateManager&);
|
||||
void PutTo(CBitStreamWriter&, const CSaveWorld&);
|
||||
};
|
||||
|
||||
|
|
|
@ -259,6 +259,7 @@ public:
|
|||
void ResetPosition(CStateManager& mgr);
|
||||
void DoorClosed(TUniqueId doorId);
|
||||
void DoorClosing(TUniqueId doorId);
|
||||
const zeus::CVector3f& GetLookPosAhead() const { return x1c0_lookPosAhead; }
|
||||
const zeus::CVector3f& GetFixedLookPos() const { return x1cc_fixedLookPos; }
|
||||
|
||||
static bool IsBallNearDoor(const zeus::CVector3f& pos, CStateManager& mgr);
|
||||
|
|
|
@ -322,7 +322,7 @@ bool CCollidableOBBTree::AABoxCollideWithLeafMoving(const COBBTree::CLeafData& l
|
|||
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
u16 vertIdx = vertIndices[k];
|
||||
const zeus::CVector3f& vtx = x10_tree->GetVert(vertIdx);
|
||||
const zeus::CVector3f& vtx = surf.GetVert(k);
|
||||
if (CMetroidAreaCollider::g_DupPrimitiveCheckCount != CMetroidAreaCollider::g_DupVertexList[vertIdx]) {
|
||||
CMetroidAreaCollider::g_DupVertexList[vertIdx] = CMetroidAreaCollider::g_DupPrimitiveCheckCount;
|
||||
if (movedAABB.pointInside(vtx)) {
|
||||
|
@ -346,7 +346,6 @@ bool CCollidableOBBTree::AABoxCollideWithLeafMoving(const COBBTree::CLeafData& l
|
|||
CMaterialList edgeMat(x10_tree->GetEdgeMaterial(edgeIdx));
|
||||
if (!edgeMat.HasMaterial(EMaterialTypes::NoEdgeCollision)) {
|
||||
d = dOut;
|
||||
const CCollisionEdge& edge = x10_tree->GetEdge(edgeIdx);
|
||||
if (CMetroidAreaCollider::MovingAABoxCollisionCheck_Edge(surf.GetVert(k), surf.GetVert((k + 1) % 3),
|
||||
components.x0_edges, dir, d, normal, point) &&
|
||||
d < dOut) {
|
||||
|
|
|
@ -24,13 +24,17 @@ CIOWin::EMessageReturn CStateSetterFlow::OnMessage(const CArchitectureMessage& m
|
|||
m->ResetGameState();
|
||||
|
||||
g_GameState->SetCurrentWorldId(worldId);
|
||||
CWorldLayerState& layers = *g_GameState->StateForWorld(worldId).GetLayerState();
|
||||
CWorldState& ws = g_GameState->StateForWorld(worldId);
|
||||
CWorldLayerState& layers = *ws.GetLayerState();
|
||||
if (m->m_warpAreaId < layers.GetAreaCount()) {
|
||||
g_GameState->StateForWorld(worldId).SetAreaId(m->m_warpAreaId);
|
||||
ws.SetAreaId(m->m_warpAreaId);
|
||||
if (m->m_warpLayerBits) {
|
||||
for (u32 i = 0; i < layers.GetAreaLayerCount(m->m_warpAreaId); ++i)
|
||||
layers.SetLayerActive(m->m_warpAreaId, i, ((m->m_warpLayerBits >> i) & 1) != 0);
|
||||
}
|
||||
CRelayTracker& relays = *ws.RelayTracker();
|
||||
for (const auto& r : m->m_warpMemoryRelays)
|
||||
relays.AddRelay(r);
|
||||
}
|
||||
g_GameState->GameOptions().ResetToDefaults();
|
||||
g_GameState->WriteBackupBuf();
|
||||
|
|
|
@ -474,7 +474,7 @@ void CMain::Teleport(hecl::Console*, const std::vector<std::string>& args) {
|
|||
zeus::CTransform xf = g_StateManager->Player()->GetTransform();
|
||||
xf.origin = loc;
|
||||
|
||||
if (args.size() == 6) {
|
||||
if (args.size() >= 6) {
|
||||
zeus::CVector3f angle;
|
||||
for (u32 i = 0; i < 3; ++i)
|
||||
angle[i] = zeus::degToRad(strtof(args[i + 3].c_str(), nullptr));
|
||||
|
@ -676,10 +676,10 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana
|
|||
const hecl::SystemChar* areaIdxStr = (*(it + 2)).c_str();
|
||||
|
||||
hecl::SystemChar* endptr;
|
||||
m_warpWorldIdx = hecl::StrToUl(worldIdxStr, &endptr, 0);
|
||||
m_warpWorldIdx = TAreaId(hecl::StrToUl(worldIdxStr, &endptr, 0));
|
||||
if (endptr == worldIdxStr)
|
||||
m_warpWorldIdx = 0;
|
||||
m_warpAreaId = hecl::StrToUl(areaIdxStr, &endptr, 0);
|
||||
m_warpAreaId = TAreaId(hecl::StrToUl(areaIdxStr, &endptr, 0));
|
||||
if (endptr == areaIdxStr)
|
||||
m_warpAreaId = 0;
|
||||
|
||||
|
@ -696,15 +696,21 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana
|
|||
break;
|
||||
}
|
||||
|
||||
if (args.end() - it >= 4) {
|
||||
while (args.end() - it >= 4) {
|
||||
const hecl::SystemChar* layerStr = (*(it + 3)).c_str();
|
||||
if (layerStr[0] == _SYS_STR('0') || layerStr[0] == _SYS_STR('1'))
|
||||
if (!(layerStr[0] == _SYS_STR('0') && layerStr[1] == _SYS_STR('x')) &&
|
||||
(layerStr[0] == _SYS_STR('0') || layerStr[0] == _SYS_STR('1'))) {
|
||||
for (const auto* cur = layerStr; *cur != _SYS_STR('\0'); ++cur)
|
||||
if (*cur == _SYS_STR('1'))
|
||||
m_warpLayerBits |= u64(1) << (cur - layerStr);
|
||||
} else if (layerStr[0] == _SYS_STR('0') && layerStr[1] == _SYS_STR('x')) {
|
||||
m_warpMemoryRelays.push_back(TAreaId(hecl::StrToUl(layerStr + 2, nullptr, 16)));
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
SetFlowState(EFlowState::StateSetter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -712,7 +718,7 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana
|
|||
x164_archSupport.reset(new CGameArchitectureSupport(*this, voiceEngine, backend));
|
||||
g_archSupport = x164_archSupport.get();
|
||||
x164_archSupport->PreloadAudio();
|
||||
std::srand(std::time(nullptr));
|
||||
std::srand(static_cast<unsigned int>(std::time(nullptr)));
|
||||
// g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
||||
}
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@ public:
|
|||
int m_warpWorldIdx = -1;
|
||||
TAreaId m_warpAreaId = 0;
|
||||
u64 m_warpLayerBits = 0;
|
||||
std::vector<TEditorId> m_warpMemoryRelays;
|
||||
};
|
||||
|
||||
} // namespace MP1
|
||||
|
|
|
@ -101,5 +101,6 @@ public:
|
|||
s32 GetPriority() const { return xe8_priority; }
|
||||
const CCameraHint& GetHint() const { return xec_hint; }
|
||||
TUniqueId GetDelegatedCamera() const { return x164_delegatedCamera; }
|
||||
const zeus::CTransform& GetOriginalTransform() const { return x168_origXf; }
|
||||
};
|
||||
} // namespace urde
|
||||
|
|
|
@ -13,6 +13,8 @@ CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const
|
|||
bool defaultSpawn, bool active, bool morphed)
|
||||
: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts) {
|
||||
#ifndef NDEBUG
|
||||
x64_itemCounts[int(CPlayerState::EItemType::MorphBall)] = 1;
|
||||
x64_itemCounts[int(CPlayerState::EItemType::MorphBallBombs)] = 1;
|
||||
x64_itemCounts[int(CPlayerState::EItemType::GravitySuit)] = 1;
|
||||
x64_itemCounts[int(CPlayerState::EItemType::ThermalVisor)] = 1;
|
||||
x64_itemCounts[int(CPlayerState::EItemType::XRayVisor)] = 1;
|
||||
|
|
|
@ -3,65 +3,340 @@
|
|||
#include "CStateManager.hpp"
|
||||
#include "ScriptLoader.hpp"
|
||||
#include "Camera/CBallCamera.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
#include "World/CScriptCameraHint.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
SSpindleProperty::SSpindleProperty(CInputStream& in)
|
||||
: x0_(in.readUint32Big())
|
||||
, x4_paramFlags(ScriptLoader::LoadParameterFlags(in))
|
||||
, x8_(in.readFloatBig())
|
||||
, xc_(in.readFloatBig())
|
||||
, x10_(in.readFloatBig())
|
||||
, x14_(in.readFloatBig()) {}
|
||||
SSpindleProperty::SSpindleProperty(CInputStream& in) {
|
||||
x4_input = ESpindleInput(in.readUint32Big());
|
||||
x0_flags = ScriptLoader::LoadParameterFlags(in);
|
||||
x8_lowOut = in.readFloatBig();
|
||||
xc_highOut = in.readFloatBig();
|
||||
x10_lowIn = in.readFloatBig();
|
||||
x14_highIn = in.readFloatBig();
|
||||
switch (x4_input) {
|
||||
case ESpindleInput::HintBallAngle:
|
||||
case ESpindleInput::HintBallRightAngle:
|
||||
case ESpindleInput::HintBallLeftAngle:
|
||||
x10_lowIn = zeus::degToRad(x10_lowIn);
|
||||
x14_highIn = zeus::degToRad(x14_highIn);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CScriptSpindleCamera::CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, bool active, u32 r9, float f1, float f2,
|
||||
float f3, float f4, const SSpindleProperty& seg1,
|
||||
const SSpindleProperty& seg2, const SSpindleProperty& seg3,
|
||||
const SSpindleProperty& seg4, const SSpindleProperty& seg5,
|
||||
const SSpindleProperty& seg6, const SSpindleProperty& seg7,
|
||||
const SSpindleProperty& seg8, const SSpindleProperty& seg9,
|
||||
const SSpindleProperty& seg10, const SSpindleProperty& seg11,
|
||||
const SSpindleProperty& seg12, const SSpindleProperty& seg13,
|
||||
const SSpindleProperty& seg14, const SSpindleProperty& seg15)
|
||||
const zeus::CTransform& xf, bool active, u32 flags, float hintToCamDistMin,
|
||||
float hintToCamDistMax, float hintToCamVOffMin, float hintToCamVOffMax,
|
||||
const SSpindleProperty& targetHintToCamDeltaAngleVel,
|
||||
const SSpindleProperty& deltaAngleScaleWithCamDist,
|
||||
const SSpindleProperty& hintToCamDist,
|
||||
const SSpindleProperty& distOffsetFromBallDist,
|
||||
const SSpindleProperty& hintBallToCamAzimuth,
|
||||
const SSpindleProperty& unused,
|
||||
const SSpindleProperty& maxHintBallToCamAzimuth,
|
||||
const SSpindleProperty& camLookRelAzimuth,
|
||||
const SSpindleProperty& lookPosZOffset,
|
||||
const SSpindleProperty& camPosZOffset,
|
||||
const SSpindleProperty& clampedAzimuthFromHintDir,
|
||||
const SSpindleProperty& dampingAzimuthSpeed,
|
||||
const SSpindleProperty& targetHintToCamDeltaAngleVelRange,
|
||||
const SSpindleProperty& deleteHintBallDist,
|
||||
const SSpindleProperty& recoverClampedAzimuthFromHintDir)
|
||||
: CGameCamera(uid, active, name, info, xf, CCameraManager::ThirdPersonFOV(), CCameraManager::NearPlane(),
|
||||
CCameraManager::FarPlane(), CCameraManager::Aspect(), kInvalidUniqueId, false, 0)
|
||||
, x188_r9(r9)
|
||||
, x1b0_f1(f1)
|
||||
, x1b4_f2(f2)
|
||||
, x1b8_f3(f2)
|
||||
, x1bc_f4(f4)
|
||||
, x1c0_seg1(seg1)
|
||||
, x1d8_seg2(seg2)
|
||||
, x1f0_seg3(seg3)
|
||||
, x208_seg4(seg4)
|
||||
, x220_seg5(seg5)
|
||||
, x238_seg6(seg6)
|
||||
, x250_seg7(seg7)
|
||||
, x268_seg8(seg8)
|
||||
, x280_seg9(seg9)
|
||||
, x298_seg10(seg10)
|
||||
, x2b0_seg11(seg11)
|
||||
, x2c8_seg12(seg12)
|
||||
, x2e0_seg13(seg13)
|
||||
, x2f8_seg14(seg14)
|
||||
, x310_seg15(seg15)
|
||||
, x188_flags(flags)
|
||||
, x1b0_hintToCamDistMin(hintToCamDistMin)
|
||||
, x1b4_hintToCamDistMax(hintToCamDistMax)
|
||||
, x1b8_hintToCamVOffMin(hintToCamVOffMin)
|
||||
, x1bc_hintToCamVOffMax(hintToCamVOffMax)
|
||||
, x1c0_targetHintToCamDeltaAngleVel(targetHintToCamDeltaAngleVel)
|
||||
, x1d8_deltaAngleScaleWithCamDist(deltaAngleScaleWithCamDist)
|
||||
, x1f0_hintToCamDist(hintToCamDist)
|
||||
, x208_distOffsetFromBallDist(distOffsetFromBallDist)
|
||||
, x220_hintBallToCamAzimuth(hintBallToCamAzimuth)
|
||||
, x238_unused(unused)
|
||||
, x250_maxHintBallToCamAzimuth(maxHintBallToCamAzimuth)
|
||||
, x268_camLookRelAzimuth(camLookRelAzimuth)
|
||||
, x280_lookPosZOffset(lookPosZOffset)
|
||||
, x298_camPosZOffset(camPosZOffset)
|
||||
, x2b0_clampedAzimuthFromHintDir(clampedAzimuthFromHintDir)
|
||||
, x2c8_dampingAzimuthSpeed(dampingAzimuthSpeed)
|
||||
, x2e0_targetHintToCamDeltaAngleVelRange(targetHintToCamDeltaAngleVelRange)
|
||||
, x2f8_deleteHintBallDist(deleteHintBallDist)
|
||||
, x310_recoverClampedAzimuthFromHintDir(recoverClampedAzimuthFromHintDir)
|
||||
, x330_lookDir(xf.basis[1]) {}
|
||||
|
||||
void CScriptSpindleCamera::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
void CScriptSpindleCamera::ProcessInput(const CFinalInput& input, CStateManager& mgr) {}
|
||||
void CScriptSpindleCamera::ProcessInput(const CFinalInput& input, CStateManager& mgr) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
void CScriptSpindleCamera::Reset(const zeus::CTransform& xf, CStateManager& mgr) {
|
||||
const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr);
|
||||
if (!GetActive() || hint == nullptr)
|
||||
return;
|
||||
|
||||
x33c_24_ = true;
|
||||
x33c_24_inResetThink = true;
|
||||
mgr.GetCameraManager()->GetBallCamera()->UpdateLookAtPosition(0.01f, mgr);
|
||||
Think(0.01f, mgr);
|
||||
x33c_24_inResetThink = false;
|
||||
}
|
||||
|
||||
void CScriptSpindleCamera::Think(float, CStateManager&) {}
|
||||
void CScriptSpindleCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
|
||||
CGameCamera::AcceptScriptMsg(msg, sender, mgr);
|
||||
}
|
||||
|
||||
float SSpindleProperty::GetValue(float inVar) const {
|
||||
if (x4_input == ESpindleInput::Constant)
|
||||
return x8_lowOut;
|
||||
|
||||
float reflectRange = x14_highIn - x10_lowIn;
|
||||
if (zeus::close_enough(reflectRange, 0.f))
|
||||
return x8_lowOut;
|
||||
|
||||
float reflectedVar = inVar;
|
||||
if (x0_flags & 0x1 && inVar > x14_highIn)
|
||||
reflectedVar = x14_highIn - (inVar - x14_highIn);
|
||||
if (x0_flags & 0x2 && inVar < x10_lowIn)
|
||||
reflectedVar = x10_lowIn + (x10_lowIn - inVar);
|
||||
|
||||
float outRange = xc_highOut - x8_lowOut;
|
||||
float res = (reflectedVar - x10_lowIn) * outRange / reflectRange + x8_lowOut;
|
||||
if (x8_lowOut < xc_highOut)
|
||||
return zeus::clamp(x8_lowOut, res, xc_highOut);
|
||||
else
|
||||
return zeus::clamp(xc_highOut, res, x8_lowOut);
|
||||
}
|
||||
|
||||
void CScriptSpindleCamera::Think(float dt, CStateManager& mgr) {
|
||||
const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr);
|
||||
if (!GetActive() || hint == nullptr)
|
||||
return;
|
||||
|
||||
zeus::CVector3f hintPos = hint->GetTranslation();
|
||||
zeus::CVector2f lookAheadPos = mgr.GetCameraManager()->GetBallCamera()->GetLookPosAhead().toVec2f();
|
||||
zeus::CVector3f hintToCamDir = GetTranslation() - hintPos;
|
||||
hintToCamDir.z() = 0.f;
|
||||
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
|
||||
zeus::CVector3f hintToBallDir = ballPos - hintPos;
|
||||
float hintToBallVOff = hintToBallDir.z();
|
||||
hintToBallDir.z() = 0.f;
|
||||
zeus::CVector3f hintDir = hint->GetTransform().basis[1];
|
||||
hintDir.z() = 0.f;
|
||||
if (hintDir.canBeNormalized())
|
||||
hintDir.normalize();
|
||||
else
|
||||
hintDir = zeus::CVector3f::skForward;
|
||||
float hintToBallDist = 0.f;
|
||||
if (hintToBallDir.canBeNormalized()) {
|
||||
hintToBallDist = hintToBallDir.magnitude();
|
||||
hintToBallDir.normalize();
|
||||
} else {
|
||||
hintToBallDir = hintDir;
|
||||
}
|
||||
|
||||
x18c_inVars.clear();
|
||||
x18c_inVars.push_back(0.f); // Zero
|
||||
x18c_inVars.push_back(hintToBallDist); // HintToBallDist
|
||||
x18c_inVars.push_back(std::fabs(hintToBallVOff)); // HintToBallVOff
|
||||
float hintBallAngle = std::fabs(std::acos(zeus::clamp(-1.f, hintToBallDir.dot(hintDir), 1.f)));
|
||||
x18c_inVars.push_back(hintBallAngle); // HintBallAngle
|
||||
float hintBallCross = hintToBallDir.toVec2f().cross(hintDir.toVec2f());
|
||||
if (hintBallCross >= 0.f) {
|
||||
x18c_inVars.push_back(hintBallAngle); // HintBallRightAngle
|
||||
x18c_inVars.push_back(2.f * M_PIF - hintBallAngle); // HintBallLeftAngle
|
||||
} else {
|
||||
x18c_inVars.push_back(2.f * M_PIF - hintBallAngle); // HintBallRightAngle
|
||||
x18c_inVars.push_back(hintBallAngle); // HintBallLeftAngle
|
||||
}
|
||||
zeus::CVector3f hintDelta = hint->GetTranslation() - hint->GetOriginalTransform().origin;
|
||||
float hintDeltaVOff = std::fabs(hintDelta.z());
|
||||
hintDelta.z() = 0.f;
|
||||
x18c_inVars.push_back(hintDelta.canBeNormalized() ? hintDelta.magnitude() : 0.f); // HintDeltaDist
|
||||
x18c_inVars.push_back(hintDeltaVOff); // HintDeltaVOff
|
||||
|
||||
if ((x188_flags & 0x2000) && hintToBallDist >
|
||||
x2f8_deleteHintBallDist.GetValue(GetInVar(x2f8_deleteHintBallDist))) {
|
||||
|
||||
if (hint->GetDelegatedCamera() == GetUniqueId())
|
||||
mgr.GetCameraManager()->DeleteCameraHint(hint->GetUniqueId(), mgr);
|
||||
|
||||
} else {
|
||||
|
||||
if (!(x188_flags & 0x800))
|
||||
hintToBallDir = hintDir;
|
||||
if (x188_flags & 0x20) {
|
||||
if (!x32c_outsideClampedAzimuth) {
|
||||
if (hintBallAngle > x2b0_clampedAzimuthFromHintDir.GetValue(GetInVar(x2b0_clampedAzimuthFromHintDir))) {
|
||||
x330_lookDir = hintToBallDir;
|
||||
x32c_outsideClampedAzimuth = true;
|
||||
}
|
||||
} else {
|
||||
float hintCamCross = hintToCamDir.toVec2f().cross(hintDir.toVec2f());
|
||||
if ((hintBallAngle < x310_recoverClampedAzimuthFromHintDir.
|
||||
GetValue(GetInVar(x310_recoverClampedAzimuthFromHintDir)) && hintBallCross * hintCamCross < 0.f) ||
|
||||
hintBallAngle <= x2b0_clampedAzimuthFromHintDir.GetValue(GetInVar(x2b0_clampedAzimuthFromHintDir))) {
|
||||
x32c_outsideClampedAzimuth = false;
|
||||
} else {
|
||||
hintToBallDir = x330_lookDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float newHintToCamDist = x1f0_hintToCamDist.GetValue(GetInVar(x1f0_hintToCamDist));
|
||||
if (x188_flags & 0x40)
|
||||
newHintToCamDist = hintToBallDist +
|
||||
x208_distOffsetFromBallDist.GetValue(GetInVar(x208_distOffsetFromBallDist));
|
||||
newHintToCamDist = zeus::clamp(x1b0_hintToCamDistMin, newHintToCamDist, x1b4_hintToCamDistMax);
|
||||
zeus::CVector3f newCamPos = GetTranslation();
|
||||
float hintToCamDist = hintToCamDir.magnitude();
|
||||
if (hintToCamDir.canBeNormalized()) {
|
||||
hintToCamDir.normalize();
|
||||
} else {
|
||||
hintToCamDir = hintDir;
|
||||
hintToCamDist = x1f0_hintToCamDist.GetValue(GetInVar(x1f0_hintToCamDist));
|
||||
}
|
||||
|
||||
float hintBallToCamTargetAzimuth =
|
||||
x220_hintBallToCamAzimuth.GetValue(GetInVar(x220_hintBallToCamAzimuth));
|
||||
if (!(x188_flags & 0x4000) && hintToCamDir.cross(hintToBallDir).z() >= 0.f)
|
||||
hintBallToCamTargetAzimuth = -hintBallToCamTargetAzimuth;
|
||||
zeus::CQuaternion hintBallToCamTargetAzimuthQuat;
|
||||
hintBallToCamTargetAzimuthQuat.rotateZ(hintBallToCamTargetAzimuth);
|
||||
zeus::CVector3f targetHintToCam = hintBallToCamTargetAzimuthQuat.transform(hintToBallDir);
|
||||
zeus::CVector3f newHintToCamDir = hintToCamDir;
|
||||
float hintToCamDeltaAngleRange = std::fabs(std::acos(zeus::clamp(-1.f, hintToCamDir.dot(targetHintToCam), 1.f)));
|
||||
float hintToCamDeltaAngleSpeedFactor =
|
||||
zeus::clamp(-1.f, hintToCamDeltaAngleRange /
|
||||
x2c8_dampingAzimuthSpeed.GetValue(GetInVar(x2c8_dampingAzimuthSpeed)), 1.f);
|
||||
float targetHintToCamDeltaAngleVel =
|
||||
x1c0_targetHintToCamDeltaAngleVel.GetValue(GetInVar(x1c0_targetHintToCamDeltaAngleVel));
|
||||
if (x188_flags & 0x100)
|
||||
targetHintToCamDeltaAngleVel = zeus::clamp(-targetHintToCamDeltaAngleVel,
|
||||
x1d8_deltaAngleScaleWithCamDist.GetValue(GetInVar(x1d8_deltaAngleScaleWithCamDist)) / hintToCamDist,
|
||||
targetHintToCamDeltaAngleVel);
|
||||
if ((hintToBallDir.cross(hintToCamDir).z() >= 0.f && targetHintToCam.cross(hintToCamDir).z() < 0.f) ||
|
||||
(hintToBallDir.cross(hintToCamDir).z() < 0.f && targetHintToCam.cross(hintToCamDir).z() >= 0.f)) {
|
||||
float targetHintToCamDeltaAngleVelRange =
|
||||
x2e0_targetHintToCamDeltaAngleVelRange.GetValue(GetInVar(x2e0_targetHintToCamDeltaAngleVelRange));
|
||||
targetHintToCamDeltaAngleVel = zeus::clamp(-targetHintToCamDeltaAngleVelRange,
|
||||
targetHintToCamDeltaAngleVel, targetHintToCamDeltaAngleVelRange);
|
||||
}
|
||||
|
||||
zeus::CVector3f camToBall = ballPos - GetTranslation();
|
||||
camToBall.z() = 0.f;
|
||||
float targetHintToCamDeltaAngle = targetHintToCamDeltaAngleVel * dt * hintToCamDeltaAngleSpeedFactor;
|
||||
float camToBallDist = 0.f;
|
||||
if (camToBall.canBeNormalized())
|
||||
camToBallDist = camToBall.magnitude();
|
||||
targetHintToCamDeltaAngle *= (1.f - zeus::clamp(0.f, (camToBallDist - 2.f) * 0.5f, 1.f)) * 10.f + 1.f;
|
||||
targetHintToCamDeltaAngle = zeus::clamp(-hintToCamDeltaAngleRange,
|
||||
targetHintToCamDeltaAngle, hintToCamDeltaAngleRange);
|
||||
if (std::fabs(zeus::clamp(-1.f, hintToCamDir.dot(targetHintToCam), 1.f)) < 0.99999f)
|
||||
newHintToCamDir = zeus::CQuaternion::lookAt(hintToCamDir, targetHintToCam,
|
||||
targetHintToCamDeltaAngle).transform(hintToCamDir);
|
||||
float hintBallToCamAzimuth = std::acos(zeus::clamp(-1.f, hintToBallDir.dot(newHintToCamDir), 1.f));
|
||||
if (x188_flags & 0x10) {
|
||||
if (std::fabs(hintBallToCamAzimuth) <
|
||||
x220_hintBallToCamAzimuth.GetValue(GetInVar(x220_hintBallToCamAzimuth)) ||
|
||||
(x188_flags & 0x8) || x33c_24_inResetThink)
|
||||
newHintToCamDir = targetHintToCam;
|
||||
}
|
||||
|
||||
float maxHintBallToCamAzimuth = x250_maxHintBallToCamAzimuth.GetValue(GetInVar(x250_maxHintBallToCamAzimuth));
|
||||
if (std::fabs(hintBallToCamAzimuth) > maxHintBallToCamAzimuth) {
|
||||
x328_maxAzimuthInterpTimer += dt;
|
||||
if (x328_maxAzimuthInterpTimer < 3.f) {
|
||||
float ballToCamAzimuthInterp = zeus::clamp(-1.f, x328_maxAzimuthInterpTimer / 3.f, 1.f);
|
||||
float hintBallToCamAzimuthDelta = std::fabs(maxHintBallToCamAzimuth - hintBallToCamAzimuth);
|
||||
if (hintToBallDir.cross(newHintToCamDir).z() > 0.f)
|
||||
hintBallToCamAzimuthDelta = -hintBallToCamAzimuthDelta;
|
||||
zeus::CQuaternion hintBallToCamAzimuthQuat;
|
||||
hintBallToCamAzimuthQuat.rotateZ(hintBallToCamAzimuthDelta * ballToCamAzimuthInterp);
|
||||
newHintToCamDir = hintBallToCamAzimuthQuat.transform(newHintToCamDir);
|
||||
} else {
|
||||
zeus::CQuaternion hintBallToCamAzimuthQuat;
|
||||
if (hintBallToCamTargetAzimuth > 0.f)
|
||||
hintBallToCamAzimuthQuat.rotateZ(maxHintBallToCamAzimuth);
|
||||
else
|
||||
hintBallToCamAzimuthQuat.rotateZ(-maxHintBallToCamAzimuth);
|
||||
newHintToCamDir = hintBallToCamAzimuthQuat.transform(hintToBallDir);
|
||||
}
|
||||
} else {
|
||||
x328_maxAzimuthInterpTimer = 0.f;
|
||||
}
|
||||
|
||||
if (x188_flags & 0x20) {
|
||||
zeus::CVector3f hintDir2 = hint->GetTransform().basis[1];
|
||||
hintDir2.z() = 0.f;
|
||||
if (hintDir2.canBeNormalized()) {
|
||||
hintDir2.normalize();
|
||||
float hintCamAzimuth = std::fabs(std::acos(zeus::clamp(-1.f, hintDir2.dot(newHintToCamDir), 1.f)));
|
||||
float hintCamAzimuthRange =
|
||||
x2b0_clampedAzimuthFromHintDir.GetValue(GetInVar(x2b0_clampedAzimuthFromHintDir));
|
||||
hintCamAzimuth = zeus::clamp(-hintCamAzimuthRange, hintCamAzimuth, hintCamAzimuthRange);
|
||||
if (hintDir2.cross(newHintToCamDir).z() < 0.f)
|
||||
hintCamAzimuth = -hintCamAzimuth;
|
||||
zeus::CQuaternion hintCamAzimuthQuat;
|
||||
hintCamAzimuthQuat.rotateZ(hintCamAzimuth);
|
||||
newHintToCamDir = hintCamAzimuthQuat.transform(hintDir2);
|
||||
}
|
||||
}
|
||||
|
||||
newCamPos = hintPos + newHintToCamDir * newHintToCamDist;
|
||||
if (x188_flags & 0x80)
|
||||
newCamPos.z() = ballPos.z() + x298_camPosZOffset.GetValue(GetInVar(x298_camPosZOffset));
|
||||
else
|
||||
newCamPos.z() = hintPos.z() + x298_camPosZOffset.GetValue(GetInVar(x298_camPosZOffset));
|
||||
newCamPos.z() = zeus::clamp(x1b8_hintToCamVOffMin, newCamPos.z() - hintPos.z(), x1bc_hintToCamVOffMax) +
|
||||
hintPos.z();
|
||||
|
||||
float lookPosZ;
|
||||
if (x188_flags & 0x200)
|
||||
lookPosZ = ballPos.z() + x280_lookPosZOffset.GetValue(GetInVar(x280_lookPosZOffset));
|
||||
else
|
||||
lookPosZ = hintPos.z() + x280_lookPosZOffset.GetValue(GetInVar(x280_lookPosZOffset));
|
||||
|
||||
zeus::CVector3f newLookDelta(lookAheadPos - newCamPos.toVec2f(), lookPosZ - newCamPos.z());
|
||||
zeus::CVector3f newLookDirFlat = newLookDelta;
|
||||
newLookDirFlat.z() = 0.f;
|
||||
if (newLookDirFlat.canBeNormalized()) {
|
||||
float newLookDistFlat = newLookDirFlat.magnitude();
|
||||
newLookDirFlat.normalize();
|
||||
float camLookRelAzimuth = -x268_camLookRelAzimuth.GetValue(GetInVar(x268_camLookRelAzimuth));
|
||||
zeus::CVector3f newHintToCamDirFlat = newCamPos - hintPos;
|
||||
newHintToCamDirFlat.z() = 0.f;
|
||||
if (newHintToCamDirFlat.canBeNormalized())
|
||||
newHintToCamDirFlat.normalize();
|
||||
else
|
||||
newHintToCamDirFlat = zeus::CVector3f::skForward;
|
||||
if (newHintToCamDirFlat.cross(hintToBallDir).z() >= 0.f)
|
||||
camLookRelAzimuth = -camLookRelAzimuth;
|
||||
if (x188_flags & 0x1000)
|
||||
camLookRelAzimuth *= zeus::clamp(-1.f, std::acos(std::fabs(
|
||||
zeus::clamp(-1.f, hintToBallDir.dot(newHintToCamDirFlat), 1.f))) / zeus::degToRad(10.f), 1.f);
|
||||
zeus::CQuaternion azimuthQuat;
|
||||
azimuthQuat.rotateZ(camLookRelAzimuth);
|
||||
lookAheadPos = azimuthQuat.transform(newLookDirFlat).toVec2f() * std::cos(camLookRelAzimuth) * newLookDistFlat +
|
||||
newCamPos.toVec2f();
|
||||
}
|
||||
newLookDelta = zeus::CVector3f(lookAheadPos, lookPosZ) - newCamPos;
|
||||
if (x188_flags & 0x1)
|
||||
newLookDelta = zeus::CVector3f(hintPos.toVec2f() - newCamPos.toVec2f(), newLookDelta.z());
|
||||
if (x188_flags & 0x2)
|
||||
newLookDelta = lookAheadPos - hintPos.toVec2f();
|
||||
if (newLookDelta.canBeNormalized())
|
||||
SetTransform(zeus::lookAt(newCamPos, newCamPos + newLookDelta.normalized()));
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptSpindleCamera::Render(const CStateManager&) const {
|
||||
// Empty
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
|
|
@ -4,59 +4,102 @@
|
|||
|
||||
namespace urde {
|
||||
|
||||
enum class ESpindleInput {
|
||||
Constant,
|
||||
HintToBallDist,
|
||||
HintToBallVOff,
|
||||
HintBallAngle,
|
||||
HintBallRightAngle,
|
||||
HintBallLeftAngle,
|
||||
HintDeltaDist,
|
||||
HintDeltaVOff
|
||||
};
|
||||
|
||||
struct SSpindleProperty {
|
||||
u32 x0_;
|
||||
u32 x4_paramFlags;
|
||||
float x8_;
|
||||
float xc_;
|
||||
float x10_;
|
||||
float x14_;
|
||||
u32 x0_flags;
|
||||
ESpindleInput x4_input;
|
||||
float x8_lowOut;
|
||||
float xc_highOut;
|
||||
float x10_lowIn;
|
||||
float x14_highIn;
|
||||
|
||||
SSpindleProperty(CInputStream& in);
|
||||
void FixupAngles() {
|
||||
x8_ = zeus::degToRad(x8_);
|
||||
xc_ = zeus::degToRad(xc_);
|
||||
x8_lowOut = zeus::degToRad(x8_lowOut);
|
||||
xc_highOut = zeus::degToRad(xc_highOut);
|
||||
}
|
||||
float GetValue(float inVar) const;
|
||||
};
|
||||
|
||||
class CScriptSpindleCamera : public CGameCamera {
|
||||
u32 x188_r9;
|
||||
u32 x18c_ = 0;
|
||||
float x1b0_f1;
|
||||
float x1b4_f2;
|
||||
float x1b8_f3;
|
||||
float x1bc_f4;
|
||||
SSpindleProperty x1c0_seg1;
|
||||
SSpindleProperty x1d8_seg2;
|
||||
SSpindleProperty x1f0_seg3;
|
||||
SSpindleProperty x208_seg4;
|
||||
SSpindleProperty x220_seg5;
|
||||
SSpindleProperty x238_seg6;
|
||||
SSpindleProperty x250_seg7;
|
||||
SSpindleProperty x268_seg8;
|
||||
SSpindleProperty x280_seg9;
|
||||
SSpindleProperty x298_seg10;
|
||||
SSpindleProperty x2b0_seg11;
|
||||
SSpindleProperty x2c8_seg12;
|
||||
SSpindleProperty x2e0_seg13;
|
||||
SSpindleProperty x2f8_seg14;
|
||||
SSpindleProperty x310_seg15;
|
||||
float x328_ = 0.f;
|
||||
bool x32c_24 = false;
|
||||
/*
|
||||
* 0x1: Look toward hint
|
||||
* 0x2: Flat look delta
|
||||
* 0x8: force minimum-clamp ball-to-cam azimuth
|
||||
* 0x10: minimum-clamp ball-to-cam azimuth
|
||||
* 0x20: Enable clampedAzimuthFromHintDir
|
||||
* 0x40: Enable distOffsetFromBallDist
|
||||
* 0x80: Use ball pos for cam pos Z (vs. hint pos)
|
||||
* 0x100: Enable deltaAngleScaleWithCamDist
|
||||
* 0x200: Use ball pos for look pos Z (vs. hint pos)
|
||||
* 0x400: unused
|
||||
* 0x800: Variable hint-to-ball direction
|
||||
* 0x1000: Damp look azimuth with hint ball-to-cam azimuth < 10-degrees
|
||||
* 0x2000: Enable deleteHintBallDist
|
||||
* 0x4000: Ignore ball-to-cam azimuth sign
|
||||
*/
|
||||
u32 x188_flags;
|
||||
rstl::reserved_vector<float, 8> x18c_inVars;
|
||||
float x1b0_hintToCamDistMin;
|
||||
float x1b4_hintToCamDistMax;
|
||||
float x1b8_hintToCamVOffMin;
|
||||
float x1bc_hintToCamVOffMax;
|
||||
SSpindleProperty x1c0_targetHintToCamDeltaAngleVel;
|
||||
SSpindleProperty x1d8_deltaAngleScaleWithCamDist;
|
||||
SSpindleProperty x1f0_hintToCamDist;
|
||||
SSpindleProperty x208_distOffsetFromBallDist;
|
||||
SSpindleProperty x220_hintBallToCamAzimuth;
|
||||
SSpindleProperty x238_unused;
|
||||
SSpindleProperty x250_maxHintBallToCamAzimuth;
|
||||
SSpindleProperty x268_camLookRelAzimuth;
|
||||
SSpindleProperty x280_lookPosZOffset;
|
||||
SSpindleProperty x298_camPosZOffset;
|
||||
SSpindleProperty x2b0_clampedAzimuthFromHintDir;
|
||||
SSpindleProperty x2c8_dampingAzimuthSpeed;
|
||||
SSpindleProperty x2e0_targetHintToCamDeltaAngleVelRange;
|
||||
SSpindleProperty x2f8_deleteHintBallDist;
|
||||
SSpindleProperty x310_recoverClampedAzimuthFromHintDir;
|
||||
float x328_maxAzimuthInterpTimer = 0.f;
|
||||
bool x32c_outsideClampedAzimuth = false;
|
||||
zeus::CVector3f x330_lookDir;
|
||||
bool x33c_24_;
|
||||
bool x33c_24_inResetThink;
|
||||
|
||||
float GetInVar(const SSpindleProperty& seg) const { return x18c_inVars[int(seg.x4_input)]; }
|
||||
|
||||
public:
|
||||
CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
bool active, u32 r9, float f1, float f2, float f3, float f4, const SSpindleProperty& seg1,
|
||||
const SSpindleProperty& seg2, const SSpindleProperty& seg3, const SSpindleProperty& seg4,
|
||||
const SSpindleProperty& seg5, const SSpindleProperty& seg6, const SSpindleProperty& seg7,
|
||||
const SSpindleProperty& seg8, const SSpindleProperty& seg9, const SSpindleProperty& seg10,
|
||||
const SSpindleProperty& seg11, const SSpindleProperty& seg12, const SSpindleProperty& seg13,
|
||||
const SSpindleProperty& seg14, const SSpindleProperty& seg15);
|
||||
CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, bool active, u32 flags, float hintToCamDistMin,
|
||||
float hintToCamDistMax, float hintToCamVOffMin, float hintToCamVOffMax,
|
||||
const SSpindleProperty& targetHintToCamDeltaAngleVel,
|
||||
const SSpindleProperty& deltaAngleScaleWithCamDist,
|
||||
const SSpindleProperty& hintToCamDist,
|
||||
const SSpindleProperty& distOffsetFromBallDist,
|
||||
const SSpindleProperty& hintBallToCamAzimuth,
|
||||
const SSpindleProperty& unused,
|
||||
const SSpindleProperty& maxHintBallToCamAzimuth,
|
||||
const SSpindleProperty& camLookRelAzimuth,
|
||||
const SSpindleProperty& lookPosZOffset,
|
||||
const SSpindleProperty& camPosZOffset,
|
||||
const SSpindleProperty& clampedAzimuthFromHintDir,
|
||||
const SSpindleProperty& dampingAzimuthSpeed,
|
||||
const SSpindleProperty& targetHintToCamDeltaAngleVelRange,
|
||||
const SSpindleProperty& deleteHintBallDist,
|
||||
const SSpindleProperty& recoverClampedAzimuthFromHintDir);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
void Think(float, CStateManager&);
|
||||
void Render(const CStateManager&) const;
|
||||
void Reset(const zeus::CTransform& xf, CStateManager& mgr);
|
||||
void ProcessInput(const CFinalInput& input, CStateManager& mgr);
|
||||
};
|
||||
|
|
|
@ -2943,39 +2943,43 @@ CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, i
|
|||
SActorHead aHead = LoadActorHead(in, mgr);
|
||||
bool active = in.readBool();
|
||||
u32 flags = LoadParameterFlags(in);
|
||||
float f1 = in.readFloatBig();
|
||||
float f2 = in.readFloatBig();
|
||||
float f3 = in.readFloatBig();
|
||||
float f4 = in.readFloatBig();
|
||||
float hintToCamDistMin = in.readFloatBig();
|
||||
float hintToCamDistMax = in.readFloatBig();
|
||||
float hintToCamVOffMin = in.readFloatBig();
|
||||
float hintToCamVOffMax = in.readFloatBig();
|
||||
|
||||
SSpindleProperty seg1(in);
|
||||
seg1.FixupAngles();
|
||||
SSpindleProperty seg2(in);
|
||||
SSpindleProperty seg3(in);
|
||||
SSpindleProperty seg4(in);
|
||||
SSpindleProperty seg5(in);
|
||||
seg5.FixupAngles();
|
||||
SSpindleProperty seg6(in);
|
||||
seg6.FixupAngles();
|
||||
SSpindleProperty seg7(in);
|
||||
seg7.FixupAngles();
|
||||
SSpindleProperty seg8(in);
|
||||
seg8.FixupAngles();
|
||||
SSpindleProperty seg9(in);
|
||||
SSpindleProperty seg10(in);
|
||||
SSpindleProperty seg11(in);
|
||||
seg11.FixupAngles();
|
||||
SSpindleProperty seg12(in);
|
||||
seg12.FixupAngles();
|
||||
SSpindleProperty seg13(in);
|
||||
seg13.FixupAngles();
|
||||
SSpindleProperty seg14(in);
|
||||
SSpindleProperty seg15(in);
|
||||
seg15.FixupAngles();
|
||||
SSpindleProperty targetHintToCamDeltaAngleVel(in);
|
||||
targetHintToCamDeltaAngleVel.FixupAngles();
|
||||
SSpindleProperty deltaAngleScaleWithCamDist(in);
|
||||
SSpindleProperty hintToCamDist(in);
|
||||
SSpindleProperty distOffsetFromBallDist(in);
|
||||
SSpindleProperty hintBallToCamAzimuth(in);
|
||||
hintBallToCamAzimuth.FixupAngles();
|
||||
SSpindleProperty unused(in);
|
||||
unused.FixupAngles();
|
||||
SSpindleProperty maxHintBallToCamAzimuth(in);
|
||||
maxHintBallToCamAzimuth.FixupAngles();
|
||||
SSpindleProperty camLookRelAzimuth(in);
|
||||
camLookRelAzimuth.FixupAngles();
|
||||
SSpindleProperty lookPosZOffset(in);
|
||||
SSpindleProperty camPosZOffset(in);
|
||||
SSpindleProperty clampedAzimuthFromHintDir(in);
|
||||
clampedAzimuthFromHintDir.FixupAngles();
|
||||
SSpindleProperty dampingAzimuthSpeed(in);
|
||||
dampingAzimuthSpeed.FixupAngles();
|
||||
SSpindleProperty targetHintToCamDeltaAngleVelRange(in);
|
||||
targetHintToCamDeltaAngleVelRange.FixupAngles();
|
||||
SSpindleProperty deleteHintBallDist(in);
|
||||
SSpindleProperty recoverClampedAzimuthFromHintDir(in);
|
||||
recoverClampedAzimuthFromHintDir.FixupAngles();
|
||||
|
||||
return new CScriptSpindleCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, flags, f1,
|
||||
f2, f3, f4, seg1, seg2, seg3, seg4, seg5, seg6, seg7, seg8, seg9, seg10, seg11, seg12,
|
||||
seg13, seg14, seg15);
|
||||
return new CScriptSpindleCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, flags,
|
||||
hintToCamDistMin, hintToCamDistMax, hintToCamVOffMin, hintToCamVOffMax,
|
||||
targetHintToCamDeltaAngleVel, deltaAngleScaleWithCamDist, hintToCamDist,
|
||||
distOffsetFromBallDist, hintBallToCamAzimuth, unused, maxHintBallToCamAzimuth,
|
||||
camLookRelAzimuth, lookPosZOffset, camPosZOffset, clampedAzimuthFromHintDir,
|
||||
dampingAzimuthSpeed, targetHintToCamDeltaAngleVelRange, deleteHintBallDist,
|
||||
recoverClampedAzimuthFromHintDir);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 8357df410e1a0d7671e70f0446342dd8b9268d02
|
||||
Subproject commit 7fb911e44819ce6890a46b9b39b26ece50be37e9
|
Loading…
Reference in New Issue