clang-format source files

This commit is contained in:
Luke Street 2022-10-09 01:16:21 -04:00
parent 261ee48bba
commit 39700ad779
35 changed files with 211 additions and 264 deletions

View File

@ -1,4 +1,3 @@
// #pragma once
#ifndef _CGUNWEAPON #ifndef _CGUNWEAPON
#define _CGUNWEAPON #define _CGUNWEAPON

View File

@ -7,8 +7,7 @@ CMRay::CMRay(const CVector3f& start, const CVector3f& end, float length, float i
, mDelta(mEnd - mStart) , mDelta(mEnd - mStart)
, mLength(length) , mLength(length)
, mInvLength(invLength) , mInvLength(invLength)
, mDir(mInvLength * mDelta) { , mDir(mInvLength * mDelta) {}
}
CMRay::CMRay(const CVector3f& start, const CVector3f& dir, float length) CMRay::CMRay(const CVector3f& start, const CVector3f& dir, float length)
: mStart(start) : mStart(start)
@ -18,7 +17,6 @@ CMRay::CMRay(const CVector3f& start, const CVector3f& dir, float length)
, mInvLength(1.f / length) , mInvLength(1.f / length)
, mDir(dir) {} , mDir(dir) {}
CMRay CMRay::GetInvUnscaledTransformRay(const CTransform4f& xf) const { CMRay CMRay::GetInvUnscaledTransformRay(const CTransform4f& xf) const {
CTransform4f invXf = xf.GetQuickInverse(); CTransform4f invXf = xf.GetQuickInverse();
return CMRay(invXf * mStart, invXf * mEnd, mLength, mInvLength); return CMRay(invXf * mStart, invXf * mEnd, mLength, mInvLength);

View File

@ -7,8 +7,7 @@ COBBox::COBBox(const CTransform4f& xf, const CVector3f& extents)
COBBox::COBBox(CInputStream& in) : mTransform(in), mExtents(in) {} COBBox::COBBox(CInputStream& in) : mTransform(in), mExtents(in) {}
CAABox COBBox::CalculateAABox(const CTransform4f& xf) const { CAABox COBBox::CalculateAABox(const CTransform4f& xf) const {}
}
COBBox COBBox::FromAABox(const CAABox& box, const CTransform4f& xf) { COBBox COBBox::FromAABox(const CAABox& box, const CTransform4f& xf) {
CVector3f center = box.GetCenterPoint(); CVector3f center = box.GetCenterPoint();
@ -17,14 +16,10 @@ COBBox COBBox::FromAABox(const CAABox& box, const CTransform4f& xf) {
return COBBox(final, extents); return COBBox(final, extents);
} }
bool COBBox::LineIntersectsBox(const CMRay& ray, float& penetration) const { bool COBBox::LineIntersectsBox(const CMRay& ray, float& penetration) const {}
}
bool COBBox::AABoxIntersectsBox(const CAABox& box) const { bool COBBox::AABoxIntersectsBox(const CAABox& box) const {
return OBBIntersectsBox(FromAABox(box, CTransform4f::Identity())); return OBBIntersectsBox(FromAABox(box, CTransform4f::Identity()));
} }
bool COBBox::OBBIntersectsBox(const COBBox& box) const { bool COBBox::OBBIntersectsBox(const COBBox& box) const { return false; }
return false;
}

View File

@ -345,9 +345,7 @@ void DTKNextTrack() {
} }
} }
u32 DTKGetState() { u32 DTKGetState() { return __DTKState; }
return __DTKState;
}
void DTKSetVolume(u8 left, u8 right) { void DTKSetVolume(u8 left, u8 right) {
__DTKVolumeL = left; __DTKVolumeL = left;

View File

@ -4,7 +4,6 @@
CStopwatch::CSWData CStopwatch::mData; CStopwatch::CSWData CStopwatch::mData;
CStopwatch CStopwatch::mGlobalTimer; CStopwatch CStopwatch::mGlobalTimer;
bool CStopwatch::InitGlobalTimer() { bool CStopwatch::InitGlobalTimer() {
mGlobalTimer.Reset(); mGlobalTimer.Reset();
return true; return true;
@ -18,6 +17,4 @@ void CStopwatch::Wait(float wait) {
} }
} }
CStopwatch& CStopwatch::GetGlobalTimerObj() { CStopwatch& CStopwatch::GetGlobalTimerObj() { return mGlobalTimer; }
return mGlobalTimer;
}

View File

@ -134,7 +134,9 @@ float CLight::GetIntensity() const {
if (x1c_type == kLT_Custom) { if (x1c_type == kLT_Custom) {
coef = x30_angleC; coef = x30_angleC;
} }
x48_cachedIntensity = coef * rstl::max_val(x18_color.GetRed(), rstl::max_val(x18_color.GetGreen(), x18_color.GetBlue())); x48_cachedIntensity =
coef *
rstl::max_val(x18_color.GetRed(), rstl::max_val(x18_color.GetGreen(), x18_color.GetBlue()));
} }
return x48_cachedIntensity; return x48_cachedIntensity;
} }

View File

@ -2,11 +2,10 @@
#include "Kyoto/Math/CMath.hpp" #include "Kyoto/Math/CMath.hpp"
CPlane::CPlane(const CVector3f& a, const CVector3f& b, const CVector3f& c) CPlane::CPlane(const CVector3f& a, const CVector3f& b, const CVector3f& c)
: x0_normal(CVector3f::Cross(b - a, c - a)) : x0_normal(CVector3f::Cross(b - a, c - a)), xc_constant(CVector3f::Dot(x0_normal, a)) {}
, xc_constant(CVector3f::Dot(x0_normal, a)) {
}
float CPlane::ClipLineSegment(const CVector3f& start, const CVector3f& end) const { float CPlane::ClipLineSegment(const CVector3f& start, const CVector3f& end) const {
float dist = -(CVector3f::Dot(start, GetNormal()) - GetConstant()) / CVector3f::Dot(end - start, GetNormal()); float dist = -(CVector3f::Dot(start, GetNormal()) - GetConstant()) /
CVector3f::Dot(end - start, GetNormal());
return dist <= 0.f ? 0.f : (dist >= 1.f ? 1.f : dist); return dist <= 0.f ? 0.f : (dist >= 1.f ? 1.f : dist);
} }

View File

@ -1,5 +1,4 @@
#include "Kyoto/Math/CUnitVector3f.hpp" #include "Kyoto/Math/CUnitVector3f.hpp"
CUnitVector3f::CUnitVector3f(const CVector3f& vec) CUnitVector3f::CUnitVector3f(const CVector3f& vec)
: CVector3f(vec.IsNonZero() ? vec.AsNormalized() : CVector3f::Zero()) { : CVector3f(vec.IsNonZero() ? vec.AsNormalized() : CVector3f::Zero()) {}
}

View File

@ -1,4 +1,3 @@
#include "Kyoto/Math/CVector3i.hpp" #include "Kyoto/Math/CVector3i.hpp"
CVector3i::CVector3i(int x, int y, int z) CVector3i::CVector3i(int x, int y, int z) : mX(x), mY(y), mZ(z) {}
: mX(x), mY(y), mZ(z) {}

View File

@ -1,10 +1,5 @@
#include "Kyoto/Math/CMath.hpp" #include "Kyoto/Math/CMath.hpp"
float CMath::SqrtF(float x) { return 0.f; }
float CMath::SqrtF(float x) { double CMath::SqrtD(double x) { return 0.0; }
return 0.f;
}
double CMath::SqrtD(double x) {
return 0.0;
}

View File

@ -1,33 +1,23 @@
#include <Kyoto/Text/CTextParser.hpp> #include <Kyoto/Text/CTextParser.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
#include <Kyoto/IObjectStore.hpp> #include <Kyoto/IObjectStore.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
CTextParser::CTextParser(IObjectStore& store) CTextParser::CTextParser(IObjectStore& store) : mObjectStore(store) {}
: mObjectStore(store) {}
void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len) { void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len) {}
}
uint CTextParser::GetAssetIdFromString(const rstl::string& str) { uint CTextParser::GetAssetIdFromString(const rstl::string& str) {}
} uint CTextParser::GetFont(const wchar_t* str, int len) { return -1; }
uint CTextParser::GetFont(const wchar_t* str, int len) { uint CTextParser::GetImage(const wchar_t* str, int len) { return -1; }
return -1;
}
uint CTextParser::GetImage(const wchar_t* str, int len) {
return -1;
}
uint CTextParser::HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) { uint CTextParser::HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) {
return 0; return 0;
} }
void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) { void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) {}
}
bool CTextParser::BeginsWith(const wchar_t* str1, int len, const wchar_t* str2) { bool CTextParser::BeginsWith(const wchar_t* str1, int len, const wchar_t* str2) {
int i = 0; int i = 0;

View File

@ -1,11 +1,7 @@
#include "MetroidPrime/CArchMsgParmControllerStatus.hpp" #include "MetroidPrime/CArchMsgParmControllerStatus.hpp"
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmControllerStatus::CArchMsgParmControllerStatus(short channel, bool connected) CArchMsgParmControllerStatus::CArchMsgParmControllerStatus(short channel, bool connected)
: mChannel(channel) : mChannel(channel), mConnected(connected) {}
, mConnected(connected) {
}
CArchMsgParmControllerStatus::~CArchMsgParmControllerStatus() {} CArchMsgParmControllerStatus::~CArchMsgParmControllerStatus() {}

View File

@ -1,8 +1,6 @@
#include "MetroidPrime/CArchMsgParmInt32.hpp" #include "MetroidPrime/CArchMsgParmInt32.hpp"
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmInt32::CArchMsgParmInt32(int val) CArchMsgParmInt32::CArchMsgParmInt32(int val) : mVal(val) {}
: mVal(val) {}
CArchMsgParmInt32::~CArchMsgParmInt32() {} CArchMsgParmInt32::~CArchMsgParmInt32() {}

View File

@ -3,8 +3,6 @@
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmInt32Int32VoidPtr::CArchMsgParmInt32Int32VoidPtr(int val1, int val2, const void* ptr) CArchMsgParmInt32Int32VoidPtr::CArchMsgParmInt32Int32VoidPtr(int val1, int val2, const void* ptr)
: mInt1(val1) : mInt1(val1), mInt2(val2), mPtr(ptr) {}
, mInt2(val2)
, mPtr(ptr) {}
CArchMsgParmInt32Int32VoidPtr::~CArchMsgParmInt32Int32VoidPtr() {} CArchMsgParmInt32Int32VoidPtr::~CArchMsgParmInt32Int32VoidPtr() {}

View File

@ -1,8 +1,6 @@
#include "MetroidPrime/CArchMsgParmReal32.hpp" #include "MetroidPrime/CArchMsgParmReal32.hpp"
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmReal32::CArchMsgParmReal32(float val) CArchMsgParmReal32::CArchMsgParmReal32(float val) : mVal(val) {}
: mVal(val) {}
CArchMsgParmReal32::~CArchMsgParmReal32() {} CArchMsgParmReal32::~CArchMsgParmReal32() {}

View File

@ -2,11 +2,8 @@
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmUserInput::CArchMsgParmUserInput(const CFinalInput& input) CArchMsgParmUserInput::CArchMsgParmUserInput(const CFinalInput& input) : mInput(input) {}
: mInput(input) {}
CArchMsgParmUserInput::~CArchMsgParmUserInput() {} CArchMsgParmUserInput::~CArchMsgParmUserInput() {}
const CFinalInput& CArchMsgParmUserInput::GetUserInput() const { const CFinalInput& CArchMsgParmUserInput::GetUserInput() const { return mInput; }
return mInput;
}

View File

@ -5,21 +5,13 @@ const CAxisAngle CAxisAngle::sIdentity;
CAxisAngle::CAxisAngle(const CVector3f& vec) : mVector(vec) {} CAxisAngle::CAxisAngle(const CVector3f& vec) : mVector(vec) {}
CAxisAngle::CAxisAngle(const CUnitVector3f& vec, float angle) : mVector(vec * angle) {} CAxisAngle::CAxisAngle(const CUnitVector3f& vec, float angle) : mVector(vec * angle) {}
void CAxisAngle::FromVector(const CVector3f& axis) { void CAxisAngle::FromVector(const CVector3f& axis) { mVector = axis; }
mVector = axis;
}
const CAxisAngle& CAxisAngle::Identity() { const CAxisAngle& CAxisAngle::Identity() { return sIdentity; }
return sIdentity;
}
const CVector3f& CAxisAngle::GetVector() const { const CVector3f& CAxisAngle::GetVector() const { return mVector; }
return mVector;
}
float CAxisAngle::GetAngle() const { float CAxisAngle::GetAngle() const { return mVector.Magnitude(); }
return mVector.Magnitude();
}
const CAxisAngle& CAxisAngle::operator*=(const float& rhs) { const CAxisAngle& CAxisAngle::operator*=(const float& rhs) {
mVector *= rhs; mVector *= rhs;

View File

@ -152,7 +152,8 @@ static inline bool check_hits(EVulnerability vuln, int direct) {
if (!direct) { if (!direct) {
return is_not_deflect(vuln); return is_not_deflect(vuln);
} }
if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) || vuln == kVN_DirectImmune) { if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) ||
vuln == kVN_DirectImmune) {
return false; return false;
} }
return true; return true;

View File

@ -1,7 +1,6 @@
//#include <MetroidPrime/CMemoryDrawEnum.hpp> //#include <MetroidPrime/CMemoryDrawEnum.hpp>
#include <Kyoto/Alloc/IAllocator.hpp> #include <Kyoto/Alloc/IAllocator.hpp>
/* ODR strikes again! */ /* ODR strikes again! */
IAllocator::SMetrics::SMetrics(const SMetrics& other) IAllocator::SMetrics::SMetrics(const SMetrics& other)
: x0_heapSize(other.x0_heapSize) : x0_heapSize(other.x0_heapSize)

View File

@ -30,30 +30,16 @@ void CObjectList::AddObject(CEntity& ent) {
void CObjectList::RemoveObject(TUniqueId uid) {} void CObjectList::RemoveObject(TUniqueId uid) {}
CEntity* CObjectList::GetObjectById() { CEntity* CObjectList::GetObjectById() { return nullptr; }
return nullptr;
}
const CEntity* CObjectList::GetObjectById() const { const CEntity* CObjectList::GetObjectById() const { return nullptr; }
return nullptr;
}
CEntity* CObjectList::GetValidObjectById(TUniqueId uid) { CEntity* CObjectList::GetValidObjectById(TUniqueId uid) { return nullptr; }
return nullptr;
}
const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const { const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const { return nullptr; }
return nullptr;
}
CEntity* CObjectList::operator[](int idx) { CEntity* CObjectList::operator[](int idx) { return nullptr; }
return nullptr;
}
const CEntity* CObjectList::operator[](int idx) const { const CEntity* CObjectList::operator[](int idx) const { return nullptr; }
return nullptr;
}
const CEntity* CObjectList::GetValidObjectByIndex(int idx) const { const CEntity* CObjectList::GetValidObjectByIndex(int idx) const { return nullptr; }
return nullptr;
}

View File

@ -196,7 +196,6 @@ void CPhysicsActor::MoveToInOneFrameWR(const CVector3f& trans, float d) {
x18c_moveImpulse += (trans - GetTranslation()) * GetMass() * (1.f / d); x18c_moveImpulse += (trans - GetTranslation()) * GetMass() * (1.f / d);
} }
CVector3f CPhysicsActor::GetMoveToORImpulseWR(const CVector3f& trans, float d) const { CVector3f CPhysicsActor::GetMoveToORImpulseWR(const CVector3f& trans, float d) const {
CVector3f impulse = x34_transform.Rotate(trans); CVector3f impulse = x34_transform.Rotate(trans);
return (GetMass() * impulse) * (1.f / d); return (GetMass() * impulse) * (1.f / d);

View File

@ -9,7 +9,9 @@
void CCameraFilterPass::DrawWideScreen(const CColor& color, const CTexture* tex, f32 lod) { void CCameraFilterPass::DrawWideScreen(const CColor& color, const CTexture* tex, f32 lod) {
const rstl::pair< CVector2f, CVector2f > vp = gpRender->SetViewportOrtho(true, -4096.f, 4096.f); const rstl::pair< CVector2f, CVector2f > vp = gpRender->SetViewportOrtho(true, -4096.f, 4096.f);
f32 left = vp.first.GetX(); f32 left = vp.first.GetX();
f32 dVar5 = -((vp.second.GetX() - vp.first.GetX()) * 0.0625f * 9.f - (vp.second.GetY() - vp.first.GetY())) * 0.5f; f32 dVar5 = -((vp.second.GetX() - vp.first.GetX()) * 0.0625f * 9.f -
(vp.second.GetY() - vp.first.GetY())) *
0.5f;
f32 bottom = vp.first.GetY(); f32 bottom = vp.first.GetY();
f32 right = vp.second.GetX(); f32 right = vp.second.GetX();
f32 top = vp.second.GetY(); f32 top = vp.second.GetY();

View File

@ -1,12 +1,13 @@
#include "MetroidPrime/Cameras/CCameraHint.hpp" #include "MetroidPrime/Cameras/CCameraHint.hpp"
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
CCameraHint::CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, CCameraHint::CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour,
float maxDist, float backwardsDist, const CVector3f& lookAtOffset, float minDist, float maxDist, float backwardsDist,
const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, float fov, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset,
float attitudeRange, float azimuthRange, float anglePerSecond, float clampVelRange, const CVector3f& ballToCam, float fov, float attitudeRange,
float clampRotRange, float elevation, float interpolateTime, float clampVelTime, float azimuthRange, float anglePerSecond, float clampVelRange,
float controlInterpDur) float clampRotRange, float elevation, float interpolateTime,
float clampVelTime, float controlInterpDur)
: mOverrideFlags(overrideFlags) : mOverrideFlags(overrideFlags)
, mBehaviour(behaviour) , mBehaviour(behaviour)
, mMinDist(minDist) , mMinDist(minDist)

View File

@ -9,6 +9,7 @@
#include "MetroidPrime/Cameras/CCameraManager.hpp" #include "MetroidPrime/Cameras/CCameraManager.hpp"
#include "MetroidPrime/Player/CGrappleArm.hpp" #include "MetroidPrime/Player/CGrappleArm.hpp"
#include "MetroidPrime/Player/CPlayer.hpp" #include "MetroidPrime/Player/CPlayer.hpp"
#include "MetroidPrime/SFX/Weapons.h"
#include "MetroidPrime/Tweaks/CTweakGunRes.hpp" #include "MetroidPrime/Tweaks/CTweakGunRes.hpp"
#include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp" #include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp"
#include "MetroidPrime/Weapons/CAuxWeapon.hpp" #include "MetroidPrime/Weapons/CAuxWeapon.hpp"
@ -20,7 +21,6 @@
#include "MetroidPrime/Weapons/CWaveBeam.hpp" #include "MetroidPrime/Weapons/CWaveBeam.hpp"
#include "MetroidPrime/Weapons/GunController/CGunMotion.hpp" #include "MetroidPrime/Weapons/GunController/CGunMotion.hpp"
#include "MetroidPrime/Weapons/WeaponTypes.hpp" #include "MetroidPrime/Weapons/WeaponTypes.hpp"
#include "MetroidPrime/SFX/Weapons.h"
#include "Kyoto/Audio/CSfxManager.hpp" #include "Kyoto/Audio/CSfxManager.hpp"
#include "Kyoto/Graphics/CModelFlags.hpp" #include "Kyoto/Graphics/CModelFlags.hpp"
@ -713,7 +713,8 @@ void CPlayerGun::UpdateWeaponFire(float dt, CPlayerState& playerState, CStateMan
x835_29_powerBombReady = false; x835_29_powerBombReady = false;
if (!x835_31_actorAttached) { if (!x835_31_actorAttached) {
x835_28_bombReady = true; x835_28_bombReady = true;
if (x53a_powerBomb != kInvalidUniqueId && !mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) { if (x53a_powerBomb != kInvalidUniqueId &&
!mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) {
const CPowerBomb* pb = static_cast< const CPowerBomb* >(mgr.GetObjectById(x53a_powerBomb)); const CPowerBomb* pb = static_cast< const CPowerBomb* >(mgr.GetObjectById(x53a_powerBomb));
if (pb && pb->GetCurTime() <= 4.25f) { if (pb && pb->GetCurTime() <= 4.25f) {
x835_28_bombReady = false; x835_28_bombReady = false;
@ -752,7 +753,8 @@ void CPlayerGun::UpdateWeaponFire(float dt, CPlayerState& playerState, CStateMan
FireSecondary(dt, mgr); FireSecondary(dt, mgr);
} else { } else {
if (!CSfxManager::IsPlaying(x2e4_invalidSfx)) { if (!CSfxManager::IsPlaying(x2e4_invalidSfx)) {
x2e4_invalidSfx = NWeaponTypes::play_sfx(SFXwpn_invalid_action, x834_27_underwater, false, 0x4a); x2e4_invalidSfx =
NWeaponTypes::play_sfx(SFXwpn_invalid_action, x834_27_underwater, false, 0x4a);
} else { } else {
x2e4_invalidSfx.Clear(); x2e4_invalidSfx.Clear();
} }
@ -827,14 +829,15 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x833_24_notFidgeting = x833_24_notFidgeting =
!(player.GetSurfaceRestraint() != CPlayer::kSR_Water && !(player.GetSurfaceRestraint() != CPlayer::kSR_Water &&
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_Scan && mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_Scan &&
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == kCP_NotCharging && !x832_29_lockedOn && (x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == kCP_NotCharging &&
(x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f && !x832_29_lockedOn && (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
player.GetPlayerMovementState() == NPlayer::kMS_OnGround && !player.IsInFreeLook() && player.GetPlayerMovementState() == NPlayer::kMS_OnGround && !player.IsInFreeLook() &&
!player.GetFreeLookStickState() && player.GetOrbitState() == CPlayer::kOS_NoOrbit && !player.GetFreeLookStickState() && player.GetOrbitState() == CPlayer::kOS_NoOrbit &&
fabs(player.GetAngularVelocityOR().GetAngle()) <= 0.1f && camBobT <= 0.01f && fabs(player.GetAngularVelocityOR().GetAngle()) <= 0.1f && camBobT <= 0.01f &&
!mgr.GetCameraManager()->IsInCinematicCamera() && !mgr.GetCameraManager()->IsInCinematicCamera() &&
player.GetGunHolsterState() == CPlayer::kGH_Drawn && player.GetGunHolsterState() == CPlayer::kGH_Drawn &&
player.GetGrappleState() == CPlayer::kGS_None && !x834_30_inBigStrike && !x835_25_inPhazonBeam); player.GetGrappleState() == CPlayer::kGS_None && !x834_30_inBigStrike &&
!x835_25_inPhazonBeam);
if (x833_24_notFidgeting) { if (x833_24_notFidgeting) {
if (!x834_30_inBigStrike) { if (!x834_30_inBigStrike) {
bool doWander = camBobT > 0.01f && (x2f4_fireButtonStates & 0x3) == 0; bool doWander = camBobT > 0.01f && (x2f4_fireButtonStates & 0x3) == 0;
@ -858,12 +861,14 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x394_damageTimer = 0.f; x394_damageTimer = 0.f;
x834_31_gunMotionInFidgetBasePosition = true; x834_31_gunMotionInFidgetBasePosition = true;
x73c_gunMotion->BasePosition(true); x73c_gunMotion->BasePosition(true);
} else if (!x73c_gunMotion->GetModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, rstl::string_l("Whole Body"))) { } else if (!x73c_gunMotion->GetModelData().GetAnimationData()->IsAnimTimeRemaining(
0.001f, rstl::string_l("Whole Body"))) {
x834_30_inBigStrike = false; x834_30_inBigStrike = false;
x834_31_gunMotionInFidgetBasePosition = false; x834_31_gunMotionInFidgetBasePosition = false;
} }
} else { } else {
switch (x3a4_fidget.Update(x2ec_lastFireButtonStates, camBobT > 0.01f, inStrikeCooldown, dt, mgr)) { switch (x3a4_fidget.Update(x2ec_lastFireButtonStates, camBobT > 0.01f, inStrikeCooldown, dt,
mgr)) {
case CFidget::kS_NoFidget: case CFidget::kS_NoFidget:
if (x324_idleState != kIS_Idle) { if (x324_idleState != kIS_Idle) {
x73c_gunMotion->PlayPasAnim(SamusGun::kAS_Idle, mgr, 0.f, false); x73c_gunMotion->PlayPasAnim(SamusGun::kAS_Idle, mgr, 0.f, false);
@ -891,7 +896,8 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x834_26_animPlaying = x834_26_animPlaying =
x834_25_gunMotionFidgeting x834_25_gunMotionFidgeting
? x73c_gunMotion->IsAnimPlaying() ? x73c_gunMotion->IsAnimPlaying()
: x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, rstl::string_l("Whole Body")); : x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(
0.001f, rstl::string_l("Whole Body"));
if (!x834_26_animPlaying) { if (!x834_26_animPlaying) {
x3a4_fidget.ResetMinor(); x3a4_fidget.ResetMinor();
ReturnToRestPose(); ReturnToRestPose();
@ -906,7 +912,6 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
} }
} }
void CPlayerGun::CMotionState::Update(bool, float, CTransform4f&, CStateManager&) {} void CPlayerGun::CMotionState::Update(bool, float, CTransform4f&, CStateManager&) {}
void CPlayerGun::DamageRumble(const CVector3f&, const CStateManager&) {} void CPlayerGun::DamageRumble(const CVector3f&, const CStateManager&) {}
@ -959,9 +964,7 @@ void CPlayerGun::AsyncLoadFidget(CStateManager&) {}
void CPlayerGun::UnLoadFidget() {} void CPlayerGun::UnLoadFidget() {}
bool CPlayerGun::IsFidgetLoaded() { bool CPlayerGun::IsFidgetLoaded() { return false; }
return false;
}
void CPlayerGun::SetFidgetAnimBits(int, bool) {} void CPlayerGun::SetFidgetAnimBits(int, bool) {}

View File

@ -1,9 +1,7 @@
#include "MetroidPrime/ScriptObjects/CFire.hpp" #include "MetroidPrime/ScriptObjects/CFire.hpp"
#include "MetroidPrime/CActorParameters.hpp" #include "MetroidPrime/CActorParameters.hpp"
static inline CMaterialList MakeMaterialList() { static inline CMaterialList MakeMaterialList() { return CMaterialList(kMT_Projectile); }
return CMaterialList(kMT_Projectile);
}
CFire::CFire(TToken< CGenDescription > effect, TUniqueId uid, TAreaId area, bool active, CFire::CFire(TToken< CGenDescription > effect, TUniqueId uid, TAreaId area, bool active,
TUniqueId owner, const CTransform4f& xf, const CDamageInfo& dInfo, const CAABox& aabox, TUniqueId owner, const CTransform4f& xf, const CDamageInfo& dInfo, const CAABox& aabox,
@ -33,7 +31,4 @@ CFire::CFire(TToken< CGenDescription > effect, TUniqueId uid, TAreaId area, bool
xe8_->SetTranslation(xf.GetTranslation()); xe8_->SetTranslation(xf.GetTranslation());
} }
CFire::~CFire() {}
CFire::~CFire() {
}

View File

@ -17,9 +17,7 @@ void CGunController::EnterStruck(CStateManager&, float) {}
void CGunController::LoadFidgetAnimAsync(CStateManager&, int, int, int) {} void CGunController::LoadFidgetAnimAsync(CStateManager&, int, int, int) {}
int CGunController::Update(float, CStateManager&) { int CGunController::Update(float, CStateManager&) { return 0; }
return 0;
}
void CGunController::EnterIdle(CStateManager&) {} void CGunController::EnterIdle(CStateManager&) {}

View File

@ -80,9 +80,7 @@ void CGunMotion::ReturnToDefault(CStateManager& mgr) {
x4c_gunController.ReturnToDefault(mgr, 0.f); x4c_gunController.ReturnToDefault(mgr, 0.f);
} }
int CGunMotion::GetFreeLookSetId() const { int CGunMotion::GetFreeLookSetId() const { return x4c_gunController.GetFreeLookSetId(); }
return x4c_gunController.GetFreeLookSetId();
}
void CGunMotion::BasePosition(bool bigStrikeReset) { void CGunMotion::BasePosition(bool bigStrikeReset) {
CAnimData& animData = *x0_modelData.AnimationData(); CAnimData& animData = *x0_modelData.AnimationData();

View File

@ -1,4 +1,5 @@
#pragma once #ifndef _NMWEXCEPTION
#define _NMWEXCEPTION
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -18,3 +19,5 @@ void __destroy_global_chain(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // _NMWEXCEPTION

View File

@ -1,6 +1,5 @@
#include "string.h" #include "string.h"
void* memcpy(void* dst, const void* src, size_t n) { void* memcpy(void* dst, const void* src, size_t n) {
const char* p; const char* p;
char* q; char* q;
@ -18,7 +17,6 @@ void* memcpy(void* dst, const void* src, size_t n) {
return (dst); return (dst);
} }
#define cps ((unsigned char*)src) #define cps ((unsigned char*)src)
#define cpd ((unsigned char*)dst) #define cpd ((unsigned char*)dst)
#define lps ((unsigned long*)src) #define lps ((unsigned long*)src)

View File

@ -77,15 +77,24 @@ static const double
static double static double
#endif #endif
one = 1.0, one = 1.0,
halF[2] = {0.5,-0.5,}, halF[2] =
huge = 1.0e+300, {
twom1000= 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/ 0.5,
-0.5,
},
huge = 1.0e+300, twom1000 = 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/
o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
u_threshold = -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */ u_threshold = -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */ ln2HI[2] =
-6.93147180369123816490e-01,},/* 0xbfe62e42, 0xfee00000 */ {
ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
-1.90821492927058770002e-10,},/* 0xbdea39ef, 0x35793c76 */ -6.93147180369123816490e-01,
}, /* 0xbfe62e42, 0xfee00000 */
ln2LO[2] =
{
1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
-1.90821492927058770002e-10,
}, /* 0xbdea39ef, 0x35793c76 */
invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */ invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
@ -110,15 +119,20 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
if (hx >= 0x7ff00000) { if (hx >= 0x7ff00000) {
if (((hx & 0xfffff) | __LO(x)) != 0) if (((hx & 0xfffff) | __LO(x)) != 0)
return x + x; /* NaN */ return x + x; /* NaN */
else return (xsb==0)? x:0.0; /* ieee_exp(+-inf)={inf,0} */ else
return (xsb == 0) ? x : 0.0; /* ieee_exp(+-inf)={inf,0} */
} }
if(x > o_threshold) return huge*huge; /* overflow */ if (x > o_threshold)
if(x < u_threshold) return twom1000*twom1000; /* underflow */ return huge * huge; /* overflow */
if (x < u_threshold)
return twom1000 * twom1000; /* underflow */
} }
/* argument reduction */ /* argument reduction */
if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; hi = x - ln2HI[xsb];
lo = ln2LO[xsb];
k = 1 - xsb - xsb;
} else { } else {
k = (int)(invln2 * x + halF[xsb]); k = (int)(invln2 * x + halF[xsb]);
t = k; t = k;
@ -126,16 +140,18 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
lo = t * ln2LO[0]; lo = t * ln2LO[0];
} }
x = hi - lo; x = hi - lo;
} } else if (hx < 0x3e300000) { /* when |x|<2**-28 */
else if(hx < 0x3e300000) { /* when |x|<2**-28 */ if (huge + x > one)
if(huge+x>one) return one+x;/* trigger inexact */ return one + x; /* trigger inexact */
} } else
else k = 0; k = 0;
/* x is now in primary range */ /* x is now in primary range */
t = x * x; t = x * x;
c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
if(k==0) return one-((x*c)/(c-2.0)-x); if (k == 0)
else y = one-((lo-(x*c)/(2.0-c))-hi); return one - ((x * c) / (c - 2.0) - x);
else
y = one - ((lo - (x * c) / (2.0 - c)) - hi);
if (k >= -1021) { if (k >= -1021) {
__HI(y) += (k << 20); /* add k to y's exponent */ __HI(y) += (k << 20); /* add k to y's exponent */
return y; return y;

View File

@ -21,6 +21,4 @@ void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR*
out->z = (a->x * b->y) - (a->y * b->x); out->z = (a->x * b->y) - (a->y * b->x);
} }
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) { void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) { out->t[0] = 1.f; }
out->t[0] = 1.f;
}