Initial CScriptPlatform collision

This commit is contained in:
Jack Andersen 2018-06-23 16:39:53 -10:00
parent 4ddec7e10c
commit 186acae5d8
10 changed files with 38 additions and 17 deletions

View File

@ -98,17 +98,19 @@ u16 CSfxManager::CSfxWrapper::GetSfxId() const
void CSfxManager::CSfxWrapper::UpdateEmitterSilent() void CSfxManager::CSfxWrapper::UpdateEmitterSilent()
{ {
if (x1c_voiceHandle)
x1c_voiceHandle->setVolume(1.f / 127.f); x1c_voiceHandle->setVolume(1.f / 127.f);
} }
void CSfxManager::CSfxWrapper::UpdateEmitter() void CSfxManager::CSfxWrapper::UpdateEmitter()
{ {
if (x1c_voiceHandle)
x1c_voiceHandle->setVolume(x20_vol); x1c_voiceHandle->setVolume(x20_vol);
} }
void CSfxManager::CSfxWrapper::SetReverb(float rev) void CSfxManager::CSfxWrapper::SetReverb(float rev)
{ {
if (IsAuxProcessingEnabled() && UseAcoustics()) if (x1c_voiceHandle && IsAuxProcessingEnabled() && UseAcoustics())
x1c_voiceHandle->setReverbVol(rev); x1c_voiceHandle->setReverbVol(rev);
} }

View File

@ -42,8 +42,8 @@ void CAutoMapper::SAutoMapperRenderState::InterpolateWithClamp(const SAutoMapper
{ {
float easeB = eases[int(b.x44_viewportEase)]; float easeB = eases[int(b.x44_viewportEase)];
float easeA = 1.f - easeB; float easeA = 1.f - easeB;
zeus::CVector2i vpA = a.m_getViewportSize(); zeus::CVector2i vpA = a.GetViewportSize();
zeus::CVector2i vpB = b.m_getViewportSize(); zeus::CVector2i vpB = b.GetViewportSize();
out.x0_viewportSize = zeus::CVector2i(vpB.x * easeB + vpA.x * easeA, out.x0_viewportSize = zeus::CVector2i(vpB.x * easeB + vpA.x * easeA,
vpB.y * easeB + vpA.y * easeA); vpB.y * easeB + vpA.y * easeA);
} }
@ -1451,14 +1451,8 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
alphaInterp = 1.f; alphaInterp = 1.f;
} }
float aspect; zeus::CVector2i vp = xa8_renderStates[0].GetViewportSize();
if (xa8_renderStates[0].m_getViewportSize) float aspect = vp.x / float(vp.y);
{
zeus::CVector2i vp = xa8_renderStates[0].m_getViewportSize();
aspect = vp.x / float(vp.y);
}
else
aspect = xa8_renderStates[0].x0_viewportSize.x / float(xa8_renderStates[0].x0_viewportSize.y);
if (aspect > 1.78f) if (aspect > 1.78f)
aspect = 1.78f; aspect = 1.78f;
float yScale = xa8_renderStates[0].x18_camDist / float yScale = xa8_renderStates[0].x18_camDist /

View File

@ -85,6 +85,14 @@ public:
x54_depth2Ease = Ease::None; x54_depth2Ease = Ease::None;
x58_alphaEase = Ease::None; x58_alphaEase = Ease::None;
} }
zeus::CVector2i GetViewportSize() const
{
if (m_getViewportSize)
return m_getViewportSize();
else
return x0_viewportSize;
}
}; };
struct SAutoMapperHintStep struct SAutoMapperHintStep

View File

@ -2006,7 +2006,7 @@ CFrontEndUI::CFrontEndUI()
m->ResetGameState(); m->ResetGameState();
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id)); g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id));
g_GameState->CurrentWorldState().SetAreaId(4); g_GameState->CurrentWorldState().SetAreaId(6);
g_GameState->GameOptions().ResetToDefaults(); g_GameState->GameOptions().ResetToDefaults();
g_GameState->WriteBackupBuf(); g_GameState->WriteBackupBuf();

View File

@ -54,7 +54,7 @@ float CPhysicsActor::GetWeight() const { return 24.525002f * xe8_mass; }
void CPhysicsActor::SetPrimitiveOffset(const zeus::CVector2f& offset) { x1e8_primitiveOffset = offset; } void CPhysicsActor::SetPrimitiveOffset(const zeus::CVector2f& offset) { x1e8_primitiveOffset = offset; }
zeus::CVector3f CPhysicsActor::GetPrimitiveOffset() { return x1e8_primitiveOffset; } zeus::CVector3f CPhysicsActor::GetPrimitiveOffset() const { return x1e8_primitiveOffset; }
void CPhysicsActor::MoveCollisionPrimitive(const zeus::CVector3f& offset) { x1e8_primitiveOffset = offset; } void CPhysicsActor::MoveCollisionPrimitive(const zeus::CVector3f& offset) { x1e8_primitiveOffset = offset; }

View File

@ -134,7 +134,7 @@ public:
float GetMass() const { return xe8_mass; } float GetMass() const { return xe8_mass; }
void SetPrimitiveOffset(const zeus::CVector2f& offset); void SetPrimitiveOffset(const zeus::CVector2f& offset);
zeus::CVector3f GetPrimitiveOffset(); zeus::CVector3f GetPrimitiveOffset() const;
void MoveCollisionPrimitive(const zeus::CVector3f& offset); void MoveCollisionPrimitive(const zeus::CVector3f& offset);
void SetBoundingBox(const zeus::CAABox& box); void SetBoundingBox(const zeus::CAABox& box);
zeus::CAABox GetMotionVolume(float dt) const; zeus::CAABox GetMotionVolume(float dt) const;

View File

@ -196,6 +196,20 @@ std::experimental::optional<zeus::CAABox> CScriptPlatform::GetTouchBounds() cons
return {CPhysicsActor::GetBoundingBox()}; return {CPhysicsActor::GetBoundingBox()};
} }
zeus::CTransform CScriptPlatform::GetPrimitiveTransform() const
{
zeus::CTransform ret = GetTransform();
ret.origin += GetPrimitiveOffset();
return ret;
}
const CCollisionPrimitive* CScriptPlatform::GetCollisionPrimitive() const
{
if (!x314_treeGroup)
return CPhysicsActor::GetCollisionPrimitive();
return x314_treeGroup.get();
}
bool CScriptPlatform::IsRider(TUniqueId id) const bool CScriptPlatform::IsRider(TUniqueId id) const
{ {
for (const SRiders& rider : x318_riders) for (const SRiders& rider : x318_riders)

View File

@ -71,6 +71,8 @@ public:
void PreThink(float, CStateManager&); void PreThink(float, CStateManager&);
void Think(float, CStateManager&); void Think(float, CStateManager&);
std::experimental::optional<zeus::CAABox> GetTouchBounds() const; std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
zeus::CTransform GetPrimitiveTransform() const;
const CCollisionPrimitive* GetCollisionPrimitive() const;
bool IsRider(TUniqueId id) const; bool IsRider(TUniqueId id) const;
bool IsSlave(TUniqueId id) const; bool IsSlave(TUniqueId id) const;
std::vector<SRiders>& GetX328() { return x328_slaves1; } std::vector<SRiders>& GetX328() { return x328_slaves1; }

View File

@ -17,6 +17,7 @@ CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const
x64_itemCounts[int(CPlayerState::EItemType::XRayVisor)] = 1; x64_itemCounts[int(CPlayerState::EItemType::XRayVisor)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::GrappleBeam)] = 1; x64_itemCounts[int(CPlayerState::EItemType::GrappleBeam)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::BoostBall)] = 1; x64_itemCounts[int(CPlayerState::EItemType::BoostBall)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::ChargeBeam)] = 1;
x10c_24_firstSpawn = defaultSpawn; x10c_24_firstSpawn = defaultSpawn;
x10c_25_morphed = morphed; x10c_25_morphed = morphed;
} }

@ -1 +1 @@
Subproject commit 1b3e19f74ccb55d4c20a8caf2f9c2a4ca06de335 Subproject commit 550955b07c86724ba27000ed230713f8e4f2f711