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
#define _CGUNWEAPON

View File

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

View File

@ -7,24 +7,19 @@ COBBox::COBBox(const CTransform4f& xf, const CVector3f& extents)
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) {
CVector3f center = box.GetCenterPoint();
CVector3f extents = box.GetMaxPoint() - center;
CTransform4f final = xf * CTransform4f::Translate(center);
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 {
return OBBIntersectsBox(FromAABox(box, CTransform4f::Identity()));
}
bool COBBox::OBBIntersectsBox(const COBBox& box) const {
return false;
}
bool COBBox::OBBIntersectsBox(const COBBox& box) const { return false; }

View File

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

View File

@ -78,7 +78,7 @@ int COsContext::OpenWindow(const char* title, int x, int y, int w, int h, bool f
if (mProgressiveMode) {
x30_renderMode.viTVmode = VI_TVMODE_NTSC_PROG;
x30_renderMode.xFBmode = VI_XFBMODE_SF;
u8 progressiveFilterPattern[7] = {4, 4, 16, 16, 16, 4, 4 };
u8 progressiveFilterPattern[7] = {4, 4, 16, 16, 16, 4, 4};
memcpy(x30_renderMode.vfilter, progressiveFilterPattern, 7);
}
VIConfigure(&x30_renderMode);

View File

@ -4,20 +4,17 @@
CStopwatch::CSWData CStopwatch::mData;
CStopwatch CStopwatch::mGlobalTimer;
bool CStopwatch::InitGlobalTimer() {
mGlobalTimer.Reset();
return true;
mGlobalTimer.Reset();
return true;
}
void CStopwatch::Wait(float wait) {
if (fabs(wait) < 0.0010000000474974512) {
mData.Wait(0.f);
} else {
mData.Wait(wait);
}
if (fabs(wait) < 0.0010000000474974512) {
mData.Wait(0.f);
} else {
mData.Wait(wait);
}
}
CStopwatch& CStopwatch::GetGlobalTimerObj() {
return mGlobalTimer;
}
CStopwatch& CStopwatch::GetGlobalTimerObj() { return mGlobalTimer; }

View File

@ -121,8 +121,8 @@ void ErrorHandler(OSError code, OSContext* context, int arg1, int arg2) {
}
void SetErrorHandlers() {
OSSetErrorHandler(2, (OSErrorHandler*) ErrorHandler);
OSSetErrorHandler(3, (OSErrorHandler*) ErrorHandler);
OSSetErrorHandler(5, (OSErrorHandler*) ErrorHandler);
OSSetErrorHandler(15, (OSErrorHandler*) ErrorHandler);
}
OSSetErrorHandler(2, (OSErrorHandler*)ErrorHandler);
OSSetErrorHandler(3, (OSErrorHandler*)ErrorHandler);
OSSetErrorHandler(5, (OSErrorHandler*)ErrorHandler);
OSSetErrorHandler(15, (OSErrorHandler*)ErrorHandler);
}

View File

@ -106,7 +106,7 @@ float CLight::GetRadius() const {
}
float CLight::CalculateLightRadius() const {
if (x28_distL < gkEpsilon32 && x2c_distQ < gkEpsilon32) {
if (x28_distL < gkEpsilon32 && x2c_distQ < gkEpsilon32) {
return FLT_MAX;
}
@ -134,7 +134,9 @@ float CLight::GetIntensity() const {
if (x1c_type == kLT_Custom) {
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;
}

View File

@ -8,7 +8,7 @@ const char* SObjectTag::Type2Text(FourCC type) {
text[0] = toupper((type >> 24) & 0xFF);
text[1] = toupper((type >> 16) & 0xFF);
text[2] = toupper((type >> 8) & 0xFF);
text[3] = toupper(type & 0xFF);
text[3] = toupper(type & 0xFF);
text[4] = '\0';
for (int i = 0; i < 4; ++i) {

View File

@ -2,11 +2,10 @@
#include "Kyoto/Math/CMath.hpp"
CPlane::CPlane(const CVector3f& a, const CVector3f& b, const CVector3f& c)
: x0_normal(CVector3f::Cross(b - a, c - a))
, xc_constant(CVector3f::Dot(x0_normal, a)) {
}
: x0_normal(CVector3f::Cross(b - a, c - a)), xc_constant(CVector3f::Dot(x0_normal, a)) {}
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);
}

View File

@ -1,5 +1,4 @@
#include "Kyoto/Math/CUnitVector3f.hpp"
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"
CVector3i::CVector3i(int x, int y, int z)
: mX(x), mY(y), mZ(z) {}
CVector3i::CVector3i(int x, int y, int z) : mX(x), mY(y), mZ(z) {}

View File

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

View File

@ -1,33 +1,23 @@
#include <Kyoto/Text/CTextParser.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
#include <Kyoto/IObjectStore.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
CTextParser::CTextParser(IObjectStore& store)
: mObjectStore(store) {}
CTextParser::CTextParser(IObjectStore& 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) {
return -1;
}
uint CTextParser::GetImage(const wchar_t* str, int len) {
return -1;
}
uint CTextParser::GetImage(const wchar_t* str, int len) { return -1; }
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) {
int i = 0;
@ -36,19 +26,19 @@ bool CTextParser::BeginsWith(const wchar_t* str1, int len, const wchar_t* str2)
return false;
}
}
return str2[i] == L'\x0';
}
bool CTextParser::Equals(const wchar_t* str1, int len, const wchar_t* str2) {
int i = 0;
for (;str2[i] != L'\x0' && i < len; ++i) {
if (str1[i] != str2[i]) {
return false;
}
int i = 0;
for (; str2[i] != L'\x0' && i < len; ++i) {
if (str1[i] != str2[i]) {
return false;
}
}
return str2[i] == L'\x0';
return str2[i] == L'\x0';
}
uint CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) {
@ -84,16 +74,16 @@ uint CTextParser::FromHex(wchar_t ch) {
}
uint CTextParser::GetColorValue(const wchar_t* str) {
uint a = (FromHex(str[0]) << 4);
uint b = FromHex(str[1]);
return b + a;
uint a = (FromHex(str[0]) << 4);
uint b = FromHex(str[1]);
return b + a;
}
CTextColor CTextParser::ParseColor(const wchar_t* str, int len) {
uint r = GetColorValue(str + 1);
uint g = GetColorValue(str + 3);
uint b = GetColorValue(str + 5);
uint a = len == 9 ? GetColorValue(str + 7) : 255;
uint r = GetColorValue(str + 1);
uint g = GetColorValue(str + 3);
uint b = GetColorValue(str + 5);
uint a = len == 9 ? GetColorValue(str + 7) : 255;
return CTextColor(r, g, b, a);
return CTextColor(r, g, b, a);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -149,13 +149,14 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, int ignoreDirect
}
static inline bool check_hits(EVulnerability vuln, int direct) {
if (!direct) {
return is_not_deflect(vuln);
}
if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) || vuln == kVN_DirectImmune) {
return false;
}
return true;
if (!direct) {
return is_not_deflect(vuln);
}
if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) ||
vuln == kVN_DirectImmune) {
return false;
}
return true;
}
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, int checkDirect) const {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,6 +9,7 @@
#include "MetroidPrime/Cameras/CCameraManager.hpp"
#include "MetroidPrime/Player/CGrappleArm.hpp"
#include "MetroidPrime/Player/CPlayer.hpp"
#include "MetroidPrime/SFX/Weapons.h"
#include "MetroidPrime/Tweaks/CTweakGunRes.hpp"
#include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp"
#include "MetroidPrime/Weapons/CAuxWeapon.hpp"
@ -20,7 +21,6 @@
#include "MetroidPrime/Weapons/CWaveBeam.hpp"
#include "MetroidPrime/Weapons/GunController/CGunMotion.hpp"
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
#include "MetroidPrime/SFX/Weapons.h"
#include "Kyoto/Audio/CSfxManager.hpp"
#include "Kyoto/Graphics/CModelFlags.hpp"
@ -713,8 +713,9 @@ void CPlayerGun::UpdateWeaponFire(float dt, CPlayerState& playerState, CStateMan
x835_29_powerBombReady = false;
if (!x835_31_actorAttached) {
x835_28_bombReady = true;
if (x53a_powerBomb != kInvalidUniqueId && !mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) {
const CPowerBomb* pb = static_cast<const CPowerBomb*>(mgr.GetObjectById(x53a_powerBomb));
if (x53a_powerBomb != kInvalidUniqueId &&
!mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) {
const CPowerBomb* pb = static_cast< const CPowerBomb* >(mgr.GetObjectById(x53a_powerBomb));
if (pb && pb->GetCurTime() <= 4.25f) {
x835_28_bombReady = false;
} else {
@ -752,7 +753,8 @@ void CPlayerGun::UpdateWeaponFire(float dt, CPlayerState& playerState, CStateMan
FireSecondary(dt, mgr);
} else {
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 {
x2e4_invalidSfx.Clear();
}
@ -827,14 +829,15 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x833_24_notFidgeting =
!(player.GetSurfaceRestraint() != CPlayer::kSR_Water &&
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_Scan &&
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == kCP_NotCharging && !x832_29_lockedOn &&
(x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == kCP_NotCharging &&
!x832_29_lockedOn && (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
player.GetPlayerMovementState() == NPlayer::kMS_OnGround && !player.IsInFreeLook() &&
!player.GetFreeLookStickState() && player.GetOrbitState() == CPlayer::kOS_NoOrbit &&
fabs(player.GetAngularVelocityOR().GetAngle()) <= 0.1f && camBobT <= 0.01f &&
!mgr.GetCameraManager()->IsInCinematicCamera() &&
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 (!x834_30_inBigStrike) {
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;
x834_31_gunMotionInFidgetBasePosition = 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_31_gunMotionInFidgetBasePosition = false;
}
} 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:
if (x324_idleState != kIS_Idle) {
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_25_gunMotionFidgeting
? 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) {
x3a4_fidget.ResetMinor();
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::DamageRumble(const CVector3f&, const CStateManager&) {}
@ -959,9 +964,7 @@ void CPlayerGun::AsyncLoadFidget(CStateManager&) {}
void CPlayerGun::UnLoadFidget() {}
bool CPlayerGun::IsFidgetLoaded() {
return false;
}
bool CPlayerGun::IsFidgetLoaded() { return false; }
void CPlayerGun::SetFidgetAnimBits(int, bool) {}

View File

@ -1,9 +1,7 @@
#include "MetroidPrime/ScriptObjects/CFire.hpp"
#include "MetroidPrime/CActorParameters.hpp"
static inline CMaterialList MakeMaterialList() {
return CMaterialList(kMT_Projectile);
}
static inline CMaterialList MakeMaterialList() { return CMaterialList(kMT_Projectile); }
CFire::CFire(TToken< CGenDescription > effect, TUniqueId uid, TAreaId area, bool active,
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());
}
CFire::~CFire() {
}
CFire::~CFire() {}

View File

@ -40,7 +40,7 @@ int CGSFreeLook::SetAnim(CAnimData& data, int gunId, int setId, int loopState, C
if (!x14_idle)
useLoopState = loopState;
x14_idle = false;
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
rstl::pair< float, int > anim = pas.FindBestAnimation(
CPASAnimParmData(pas::kAS_Step, CPASAnimParm::FromInt32(gunId),

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@ -16,36 +16,36 @@
* Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
* Given x, find r and integer k such that
*
* x = k*ln2 + r, |r| <= 0.5*ln2.
* x = k*ln2 + r, |r| <= 0.5*ln2.
*
* Here r will be represented as r = hi-lo for better
* Here r will be represented as r = hi-lo for better
* accuracy.
*
* 2. Approximation of ieee_exp(r) by a special rational function on
* the interval [0,0.34658]:
* Write
* R(r**2) = r*(ieee_exp(r)+1)/(ieee_exp(r)-1) = 2 + r*r/6 - r**4/360 + ...
* We use a special Remes algorithm on [0,0.34658] to generate
* a polynomial of degree 5 to approximate R. The maximum error
* We use a special Remes algorithm on [0,0.34658] to generate
* a polynomial of degree 5 to approximate R. The maximum error
* of this polynomial approximation is bounded by 2**-59. In
* other words,
* R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5
* (where z=r*r, and the values of P1 to P5 are listed below)
* and
* | 5 | -59
* | 2.0+P1*z+...+P5*z - R(z) | <= 2
* | 2.0+P1*z+...+P5*z - R(z) | <= 2
* | |
* The computation of ieee_exp(r) thus becomes
* 2*r
* exp(r) = 1 + -------
* R - r
* r*R1(r)
* r*R1(r)
* = 1 + r + ----------- (for better accuracy)
* 2 - R1(r)
* where
* 2 4 10
* R1(r) = r - (P1*r + P2*r + ... + P5*r ).
*
*
* 3. Scale back to obtain ieee_exp(x):
* From step 1, we have
* ieee_exp(x) = 2^k * ieee_exp(r)
@ -60,13 +60,13 @@
* 1 ulp (unit in the last place).
*
* Misc. info.
* For IEEE double
* For IEEE double
* if x > 7.09782712893383973096e+02 then ieee_exp(x) overflow
* if x < -7.45133219101941108420e+02 then ieee_exp(x) underflow
*
* Constants:
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
@ -76,71 +76,87 @@ static const double
#else
static double
#endif
one = 1.0,
halF[2] = {0.5,-0.5,},
huge = 1.0e+300,
twom1000= 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/
o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
-6.93147180369123816490e-01,},/* 0xbfe62e42, 0xfee00000 */
ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
-1.90821492927058770002e-10,},/* 0xbdea39ef, 0x35793c76 */
invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
one = 1.0,
halF[2] =
{
0.5,
-0.5,
},
huge = 1.0e+300, twom1000 = 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/
o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
u_threshold = -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
ln2HI[2] =
{
6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
-6.93147180369123816490e-01,
}, /* 0xbfe62e42, 0xfee00000 */
ln2LO[2] =
{
1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
-1.90821492927058770002e-10,
}, /* 0xbdea39ef, 0x35793c76 */
invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
#ifdef __STDC__
double __ieee754_exp(double x) /* default IEEE double exp */
double __ieee754_exp(double x) /* default IEEE double exp */
#else
double __ieee754_exp(x) /* default IEEE double exp */
double x;
double __ieee754_exp(x) /* default IEEE double exp */
double x;
#endif
{
double y,hi,lo,c,t;
int k,xsb;
unsigned hx;
hx = __HI(x); /* high word of x */
xsb = (hx>>31)&1; /* sign bit of x */
hx &= 0x7fffffff; /* high word of |x| */
/* filter out non-finite argument */
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
if(hx>=0x7ff00000) {
if(((hx&0xfffff)|__LO(x))!=0)
return x+x; /* NaN */
else return (xsb==0)? x:0.0; /* ieee_exp(+-inf)={inf,0} */
}
if(x > o_threshold) return huge*huge; /* overflow */
if(x < u_threshold) return twom1000*twom1000; /* underflow */
}
/* argument reduction */
if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
} else {
k = (int)(invln2*x+halF[xsb]);
t = k;
hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
lo = t*ln2LO[0];
}
x = hi - lo;
}
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
if(huge+x>one) return one+x;/* trigger inexact */
}
else k = 0;
/* x is now in primary range */
t = x*x;
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi);
if(k >= -1021) {
__HI(y) += (k<<20); /* add k to y's exponent */
return y;
} else {
__HI(y) += ((k+1000)<<20);/* add k to y's exponent */
return y*twom1000;
}
double y, hi, lo, c, t;
int k, xsb;
unsigned hx;
hx = __HI(x); /* high word of x */
xsb = (hx >> 31) & 1; /* sign bit of x */
hx &= 0x7fffffff; /* high word of |x| */
/* filter out non-finite argument */
if (hx >= 0x40862E42) { /* if |x|>=709.78... */
if (hx >= 0x7ff00000) {
if (((hx & 0xfffff) | __LO(x)) != 0)
return x + x; /* NaN */
else
return (xsb == 0) ? x : 0.0; /* ieee_exp(+-inf)={inf,0} */
}
if (x > o_threshold)
return huge * huge; /* overflow */
if (x < u_threshold)
return twom1000 * twom1000; /* underflow */
}
/* argument reduction */
if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
hi = x - ln2HI[xsb];
lo = ln2LO[xsb];
k = 1 - xsb - xsb;
} else {
k = (int)(invln2 * x + halF[xsb]);
t = k;
hi = x - t * ln2HI[0]; /* t*ln2HI is exact here */
lo = t * ln2LO[0];
}
x = hi - lo;
} else if (hx < 0x3e300000) { /* when |x|<2**-28 */
if (huge + x > one)
return one + x; /* trigger inexact */
} else
k = 0;
/* x is now in primary range */
t = x * x;
c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
if (k == 0)
return one - ((x * c) / (c - 2.0) - x);
else
y = one - ((lo - (x * c) / (2.0 - c)) - hi);
if (k >= -1021) {
__HI(y) += (k << 20); /* add k to y's exponent */
return y;
} else {
__HI(y) += ((k + 1000) << 20); /* add k to y's exponent */
return y * twom1000;
}
}

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);
}
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) {
out->t[0] = 1.f;
}
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) { out->t[0] = 1.f; }