mirror of https://github.com/PrimeDecomp/prime.git
parent
7f83e1fa03
commit
f0ea5144ea
|
@ -1,4 +1,3 @@
|
||||||
// #pragma once
|
|
||||||
#ifndef _CGUNWEAPON
|
#ifndef _CGUNWEAPON
|
||||||
#define _CGUNWEAPON
|
#define _CGUNWEAPON
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -7,24 +7,19 @@ 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();
|
||||||
CVector3f extents = box.GetMaxPoint() - center;
|
CVector3f extents = box.GetMaxPoint() - center;
|
||||||
CTransform4f final = xf * CTransform4f::Translate(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 {
|
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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -78,7 +78,7 @@ int COsContext::OpenWindow(const char* title, int x, int y, int w, int h, bool f
|
||||||
if (mProgressiveMode) {
|
if (mProgressiveMode) {
|
||||||
x30_renderMode.viTVmode = VI_TVMODE_NTSC_PROG;
|
x30_renderMode.viTVmode = VI_TVMODE_NTSC_PROG;
|
||||||
x30_renderMode.xFBmode = VI_XFBMODE_SF;
|
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);
|
memcpy(x30_renderMode.vfilter, progressiveFilterPattern, 7);
|
||||||
}
|
}
|
||||||
VIConfigure(&x30_renderMode);
|
VIConfigure(&x30_renderMode);
|
||||||
|
|
|
@ -4,20 +4,17 @@
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStopwatch::Wait(float wait) {
|
void CStopwatch::Wait(float wait) {
|
||||||
if (fabs(wait) < 0.0010000000474974512) {
|
if (fabs(wait) < 0.0010000000474974512) {
|
||||||
mData.Wait(0.f);
|
mData.Wait(0.f);
|
||||||
} else {
|
} else {
|
||||||
mData.Wait(wait);
|
mData.Wait(wait);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CStopwatch& CStopwatch::GetGlobalTimerObj() {
|
CStopwatch& CStopwatch::GetGlobalTimerObj() { return mGlobalTimer; }
|
||||||
return mGlobalTimer;
|
|
||||||
}
|
|
||||||
|
|
|
@ -121,8 +121,8 @@ void ErrorHandler(OSError code, OSContext* context, int arg1, int arg2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetErrorHandlers() {
|
void SetErrorHandlers() {
|
||||||
OSSetErrorHandler(2, (OSErrorHandler*) ErrorHandler);
|
OSSetErrorHandler(2, (OSErrorHandler*)ErrorHandler);
|
||||||
OSSetErrorHandler(3, (OSErrorHandler*) ErrorHandler);
|
OSSetErrorHandler(3, (OSErrorHandler*)ErrorHandler);
|
||||||
OSSetErrorHandler(5, (OSErrorHandler*) ErrorHandler);
|
OSSetErrorHandler(5, (OSErrorHandler*)ErrorHandler);
|
||||||
OSSetErrorHandler(15, (OSErrorHandler*) ErrorHandler);
|
OSSetErrorHandler(15, (OSErrorHandler*)ErrorHandler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ float CLight::GetRadius() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
float CLight::CalculateLightRadius() const {
|
float CLight::CalculateLightRadius() const {
|
||||||
if (x28_distL < gkEpsilon32 && x2c_distQ < gkEpsilon32) {
|
if (x28_distL < gkEpsilon32 && x2c_distQ < gkEpsilon32) {
|
||||||
return FLT_MAX;
|
return FLT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ const char* SObjectTag::Type2Text(FourCC type) {
|
||||||
text[0] = toupper((type >> 24) & 0xFF);
|
text[0] = toupper((type >> 24) & 0xFF);
|
||||||
text[1] = toupper((type >> 16) & 0xFF);
|
text[1] = toupper((type >> 16) & 0xFF);
|
||||||
text[2] = toupper((type >> 8) & 0xFF);
|
text[2] = toupper((type >> 8) & 0xFF);
|
||||||
text[3] = toupper(type & 0xFF);
|
text[3] = toupper(type & 0xFF);
|
||||||
text[4] = '\0';
|
text[4] = '\0';
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()) {}
|
||||||
}
|
|
||||||
|
|
|
@ -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) {}
|
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -36,19 +26,19 @@ bool CTextParser::BeginsWith(const wchar_t* str1, int len, const wchar_t* str2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return str2[i] == L'\x0';
|
return str2[i] == L'\x0';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTextParser::Equals(const wchar_t* str1, int len, const wchar_t* str2) {
|
bool CTextParser::Equals(const wchar_t* str1, int len, const wchar_t* str2) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (;str2[i] != L'\x0' && i < len; ++i) {
|
for (; str2[i] != L'\x0' && i < len; ++i) {
|
||||||
if (str1[i] != str2[i]) {
|
if (str1[i] != str2[i]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return str2[i] == L'\x0';
|
return str2[i] == L'\x0';
|
||||||
}
|
}
|
||||||
|
|
||||||
uint CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) {
|
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 CTextParser::GetColorValue(const wchar_t* str) {
|
||||||
uint a = (FromHex(str[0]) << 4);
|
uint a = (FromHex(str[0]) << 4);
|
||||||
uint b = FromHex(str[1]);
|
uint b = FromHex(str[1]);
|
||||||
return b + a;
|
return b + a;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTextColor CTextParser::ParseColor(const wchar_t* str, int len) {
|
CTextColor CTextParser::ParseColor(const wchar_t* str, int len) {
|
||||||
uint r = GetColorValue(str + 1);
|
uint r = GetColorValue(str + 1);
|
||||||
uint g = GetColorValue(str + 3);
|
uint g = GetColorValue(str + 3);
|
||||||
uint b = GetColorValue(str + 5);
|
uint b = GetColorValue(str + 5);
|
||||||
uint a = len == 9 ? GetColorValue(str + 7) : 255;
|
uint a = len == 9 ? GetColorValue(str + 7) : 255;
|
||||||
|
|
||||||
return CTextColor(r, g, b, a);
|
return CTextColor(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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() {}
|
||||||
|
|
|
@ -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() {}
|
||||||
|
|
|
@ -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() {}
|
||||||
|
|
|
@ -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() {}
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,33 +5,25 @@ 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;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAxisAngle& CAxisAngle::operator+=(const CAxisAngle& rhs) {
|
const CAxisAngle& CAxisAngle::operator+=(const CAxisAngle& rhs) {
|
||||||
mVector += rhs.mVector;
|
mVector += rhs.mVector;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAxisAngle operator*(const CAxisAngle& lhs,const float& rhs) {
|
CAxisAngle operator*(const CAxisAngle& lhs, const float& rhs) {
|
||||||
CAxisAngle angle;
|
CAxisAngle angle;
|
||||||
angle.mVector = lhs.mVector * rhs;
|
angle.mVector = lhs.mVector * rhs;
|
||||||
return angle;
|
return angle;
|
||||||
|
|
|
@ -149,13 +149,14 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, int ignoreDirect
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool check_hits(EVulnerability vuln, int direct) {
|
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) ||
|
||||||
return false;
|
vuln == kVN_DirectImmune) {
|
||||||
}
|
return false;
|
||||||
return true;
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, int checkDirect) const {
|
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, int checkDirect) const {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -196,10 +196,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const CQuaternion& q, float d) const {}
|
CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const CQuaternion& q, float d) const {}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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,8 +713,9 @@ 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 &&
|
||||||
const CPowerBomb* pb = static_cast<const CPowerBomb*>(mgr.GetObjectById(x53a_powerBomb));
|
!mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) {
|
||||||
|
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;
|
||||||
} else {
|
} else {
|
||||||
|
@ -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) {}
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ int CGSFreeLook::SetAnim(CAnimData& data, int gunId, int setId, int loopState, C
|
||||||
if (!x14_idle)
|
if (!x14_idle)
|
||||||
useLoopState = loopState;
|
useLoopState = loopState;
|
||||||
x14_idle = false;
|
x14_idle = false;
|
||||||
|
|
||||||
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
|
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
|
||||||
rstl::pair< float, int > anim = pas.FindBestAnimation(
|
rstl::pair< float, int > anim = pas.FindBestAnimation(
|
||||||
CPASAnimParmData(pas::kAS_Step, CPASAnimParm::FromInt32(gunId),
|
CPASAnimParmData(pas::kAS_Step, CPASAnimParm::FromInt32(gunId),
|
||||||
|
|
|
@ -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&) {}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* 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.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -16,36 +16,36 @@
|
||||||
* Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
|
* Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
|
||||||
* Given x, find r and integer k such that
|
* 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.
|
* accuracy.
|
||||||
*
|
*
|
||||||
* 2. Approximation of ieee_exp(r) by a special rational function on
|
* 2. Approximation of ieee_exp(r) by a special rational function on
|
||||||
* the interval [0,0.34658]:
|
* the interval [0,0.34658]:
|
||||||
* Write
|
* Write
|
||||||
* R(r**2) = r*(ieee_exp(r)+1)/(ieee_exp(r)-1) = 2 + r*r/6 - r**4/360 + ...
|
* 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
|
* We use a special Remes algorithm on [0,0.34658] to generate
|
||||||
* a polynomial of degree 5 to approximate R. The maximum error
|
* a polynomial of degree 5 to approximate R. The maximum error
|
||||||
* of this polynomial approximation is bounded by 2**-59. In
|
* of this polynomial approximation is bounded by 2**-59. In
|
||||||
* other words,
|
* other words,
|
||||||
* R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5
|
* 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)
|
* (where z=r*r, and the values of P1 to P5 are listed below)
|
||||||
* and
|
* and
|
||||||
* | 5 | -59
|
* | 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
|
* The computation of ieee_exp(r) thus becomes
|
||||||
* 2*r
|
* 2*r
|
||||||
* exp(r) = 1 + -------
|
* exp(r) = 1 + -------
|
||||||
* R - r
|
* R - r
|
||||||
* r*R1(r)
|
* r*R1(r)
|
||||||
* = 1 + r + ----------- (for better accuracy)
|
* = 1 + r + ----------- (for better accuracy)
|
||||||
* 2 - R1(r)
|
* 2 - R1(r)
|
||||||
* where
|
* where
|
||||||
* 2 4 10
|
* 2 4 10
|
||||||
* R1(r) = r - (P1*r + P2*r + ... + P5*r ).
|
* R1(r) = r - (P1*r + P2*r + ... + P5*r ).
|
||||||
*
|
*
|
||||||
* 3. Scale back to obtain ieee_exp(x):
|
* 3. Scale back to obtain ieee_exp(x):
|
||||||
* From step 1, we have
|
* From step 1, we have
|
||||||
* ieee_exp(x) = 2^k * ieee_exp(r)
|
* ieee_exp(x) = 2^k * ieee_exp(r)
|
||||||
|
@ -60,13 +60,13 @@
|
||||||
* 1 ulp (unit in the last place).
|
* 1 ulp (unit in the last place).
|
||||||
*
|
*
|
||||||
* Misc. info.
|
* Misc. info.
|
||||||
* For IEEE double
|
* For IEEE double
|
||||||
* if x > 7.09782712893383973096e+02 then ieee_exp(x) overflow
|
* if x > 7.09782712893383973096e+02 then ieee_exp(x) overflow
|
||||||
* if x < -7.45133219101941108420e+02 then ieee_exp(x) underflow
|
* if x < -7.45133219101941108420e+02 then ieee_exp(x) underflow
|
||||||
*
|
*
|
||||||
* Constants:
|
* Constants:
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
@ -76,71 +76,87 @@ static const double
|
||||||
#else
|
#else
|
||||||
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,
|
||||||
o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
|
-0.5,
|
||||||
u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
|
},
|
||||||
ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
|
huge = 1.0e+300, twom1000 = 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/
|
||||||
-6.93147180369123816490e-01,},/* 0xbfe62e42, 0xfee00000 */
|
o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
|
||||||
ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
|
u_threshold = -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
|
||||||
-1.90821492927058770002e-10,},/* 0xbdea39ef, 0x35793c76 */
|
ln2HI[2] =
|
||||||
invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
|
{
|
||||||
P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
|
6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
|
||||||
P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
|
-6.93147180369123816490e-01,
|
||||||
P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
|
}, /* 0xbfe62e42, 0xfee00000 */
|
||||||
P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
|
ln2LO[2] =
|
||||||
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
{
|
||||||
|
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__
|
#ifdef __STDC__
|
||||||
double __ieee754_exp(double x) /* default IEEE double exp */
|
double __ieee754_exp(double x) /* default IEEE double exp */
|
||||||
#else
|
#else
|
||||||
double __ieee754_exp(x) /* default IEEE double exp */
|
double __ieee754_exp(x) /* default IEEE double exp */
|
||||||
double x;
|
double x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double y,hi,lo,c,t;
|
double y, hi, lo, c, t;
|
||||||
int k,xsb;
|
int k, xsb;
|
||||||
unsigned hx;
|
unsigned hx;
|
||||||
hx = __HI(x); /* high word of x */
|
hx = __HI(x); /* high word of x */
|
||||||
xsb = (hx>>31)&1; /* sign bit of x */
|
xsb = (hx >> 31) & 1; /* sign bit of x */
|
||||||
hx &= 0x7fffffff; /* high word of |x| */
|
hx &= 0x7fffffff; /* high word of |x| */
|
||||||
/* filter out non-finite argument */
|
/* filter out non-finite argument */
|
||||||
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
|
if (hx >= 0x40862E42) { /* if |x|>=709.78... */
|
||||||
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 < u_threshold) return twom1000*twom1000; /* underflow */
|
if (x > o_threshold)
|
||||||
}
|
return huge * huge; /* overflow */
|
||||||
/* argument reduction */
|
if (x < u_threshold)
|
||||||
if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
|
return twom1000 * twom1000; /* underflow */
|
||||||
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
|
}
|
||||||
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
|
/* argument reduction */
|
||||||
} else {
|
if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
|
||||||
k = (int)(invln2*x+halF[xsb]);
|
if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
|
||||||
t = k;
|
hi = x - ln2HI[xsb];
|
||||||
hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
|
lo = ln2LO[xsb];
|
||||||
lo = t*ln2LO[0];
|
k = 1 - xsb - xsb;
|
||||||
}
|
} else {
|
||||||
x = hi - lo;
|
k = (int)(invln2 * x + halF[xsb]);
|
||||||
}
|
t = k;
|
||||||
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
|
hi = x - t * ln2HI[0]; /* t*ln2HI is exact here */
|
||||||
if(huge+x>one) return one+x;/* trigger inexact */
|
lo = t * ln2LO[0];
|
||||||
}
|
}
|
||||||
else k = 0;
|
x = hi - lo;
|
||||||
/* x is now in primary range */
|
} else if (hx < 0x3e300000) { /* when |x|<2**-28 */
|
||||||
t = x*x;
|
if (huge + x > one)
|
||||||
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
|
return one + x; /* trigger inexact */
|
||||||
if(k==0) return one-((x*c)/(c-2.0)-x);
|
} else
|
||||||
else y = one-((lo-(x*c)/(2.0-c))-hi);
|
k = 0;
|
||||||
if(k >= -1021) {
|
/* x is now in primary range */
|
||||||
__HI(y) += (k<<20); /* add k to y's exponent */
|
t = x * x;
|
||||||
return y;
|
c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
|
||||||
} else {
|
if (k == 0)
|
||||||
__HI(y) += ((k+1000)<<20);/* add k to y's exponent */
|
return one - ((x * c) / (c - 2.0) - x);
|
||||||
return y*twom1000;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue