mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-04 17:09:45 -04:00
+36
-34
@@ -42,14 +42,14 @@ struct TVec3 {
|
||||
|
||||
TVec3() {}
|
||||
|
||||
template<T>
|
||||
TVec3(const T x, const T y, const T z) { set(x, y, z); }
|
||||
template <class U>
|
||||
TVec3(U x, U y, U z) { set(x, y, z); }
|
||||
|
||||
template <T>
|
||||
void set(T x_, T y_, T z_) {
|
||||
x = x_;
|
||||
y = y_;
|
||||
z = z_;
|
||||
template <class U>
|
||||
void set(U x_, U y_, U z_) {
|
||||
x = (T)x_;
|
||||
y = (T)y_;
|
||||
z = (T)z_;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,10 +58,8 @@ struct TVec3<s16> : public SVec {
|
||||
TVec3() {}
|
||||
TVec3(const SVec& b) { set(b); }
|
||||
|
||||
template<typename s16>
|
||||
TVec3(s16 x, s16 y, s16 z) { set(x, y, z); }
|
||||
|
||||
TVec3(int x, int y, int z) { set(x, y, z); }
|
||||
template <class U>
|
||||
TVec3(U x, U y, U z) { set(x, y, z); }
|
||||
|
||||
void set(const SVec& vec) {
|
||||
x = vec.x;
|
||||
@@ -69,8 +67,8 @@ struct TVec3<s16> : public SVec {
|
||||
z = vec.z;
|
||||
}
|
||||
|
||||
template<typename s16>
|
||||
void set(s16 x_, s16 y_, s16 z_) {
|
||||
template <class U>
|
||||
void set(U x_, U y_, U z_) {
|
||||
x = (s16)x_;
|
||||
y = (s16)y_;
|
||||
z = (s16)z_;
|
||||
@@ -86,19 +84,19 @@ template <>
|
||||
struct TVec3<f32> : public Vec {
|
||||
TVec3() {}
|
||||
|
||||
template<typename f32>
|
||||
TVec3(f32 x, f32 y, f32 z) { set(x, y, z); }
|
||||
template <class U>
|
||||
TVec3(U x, U y, U z) { set(x, y, z); }
|
||||
|
||||
TVec3(const Vec& b) { set(b); }
|
||||
|
||||
operator Vec*() { return (Vec*)&x; }
|
||||
operator const Vec*() const { return (Vec*)&x; }
|
||||
|
||||
template<typename f32>
|
||||
void set(const TVec3<f32>& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
template <class U>
|
||||
void set(const TVec3<U>& other) {
|
||||
x = (f32)other.x;
|
||||
y = (f32)other.y;
|
||||
z = (f32)other.z;
|
||||
}
|
||||
|
||||
void set(const Vec& vec) {
|
||||
@@ -107,8 +105,8 @@ struct TVec3<f32> : public Vec {
|
||||
z = vec.z;
|
||||
}
|
||||
|
||||
template<typename f32>
|
||||
void set(f32 x_, f32 y_, f32 z_) {
|
||||
template <class U>
|
||||
void set(U x_, U y_, U z_) {
|
||||
x = (f32)x_;
|
||||
y = (f32)y_;
|
||||
z = (f32)z_;
|
||||
@@ -235,8 +233,8 @@ struct TVec3<f32> : public Vec {
|
||||
return norm * sq;
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
void cubic(const JGeometry::TVec3<f32>& vec1, const JGeometry::TVec3<f32>& vec2, const JGeometry::TVec3<f32>& vec3, const JGeometry::TVec3<f32>& vec4, f32 f19) {
|
||||
template <class U>
|
||||
void cubic(const JGeometry::TVec3<U>& vec1, const JGeometry::TVec3<U>& vec2, const JGeometry::TVec3<U>& vec3, const JGeometry::TVec3<U>& vec4, U f19) {
|
||||
// TODO: name variables properly
|
||||
f32 f5 = f19 * f19;
|
||||
f32 f4 = f5 * f19;
|
||||
@@ -244,9 +242,9 @@ struct TVec3<f32> : public Vec {
|
||||
f32 f2 = (-2.0f * f4) + (3.0f * f5);
|
||||
f32 f1 = f19 + (f4 - (2.0f * f5));
|
||||
f32 f0 = (f4 - f5);
|
||||
this->x = (f3 * vec1.x) + (f2 * vec2.x) + (f1 * vec4.x) + (f0 * vec3.z);
|
||||
this->y = (f3 * vec1.y) + (f2 * vec2.y) + (f1 * vec4.y) + (f0 * vec3.y);
|
||||
this->z = (f3 * vec1.z) + (f2 * vec2.z) + (f1 * vec4.z) + (f0 * vec3.x);
|
||||
x = (f3 * vec1.x) + (f2 * vec2.x) + (f1 * vec4.x) + (f0 * vec3.z);
|
||||
y = (f3 * vec1.y) + (f2 * vec2.y) + (f1 * vec4.y) + (f0 * vec3.y);
|
||||
z = (f3 * vec1.z) + (f2 * vec2.z) + (f1 * vec4.z) + (f0 * vec3.x);
|
||||
}
|
||||
|
||||
inline TVec3<f32>& operator+=(const TVec3<f32>& b) {
|
||||
@@ -273,16 +271,20 @@ struct TVec3<f32> : public Vec {
|
||||
template <typename T>
|
||||
struct TVec2 {
|
||||
TVec2() {}
|
||||
TVec2(const T x, const T y) { set(x, y); }
|
||||
|
||||
void set(const T x, const T y) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
template <class U>
|
||||
TVec2(U x, U y) { set(x, y); }
|
||||
|
||||
template <class U>
|
||||
void set(U x_, U y_) {
|
||||
x = (T)x_;
|
||||
y = (T)y_;
|
||||
}
|
||||
|
||||
void set(const TVec2<T>& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
template <class U>
|
||||
void set(const TVec2<U>& other) {
|
||||
x = (T)other.x;
|
||||
y = (T)other.y;
|
||||
}
|
||||
|
||||
void setMin(const TVec2<T>& min) {
|
||||
|
||||
@@ -202,7 +202,7 @@ void FuseSmokeCB_c::executeAfter(JPABaseEmitter* emitter) {
|
||||
s16 lifetime = r29 + r28;
|
||||
for (f32 f19 = f20; f19 < 1.0f; f19 += f20, lifetime += r28) {
|
||||
JGeometry::TVec3<f32> vec5;
|
||||
vec5.cubic<f32>(vec1, vec2, vec3, vec4, f19);
|
||||
vec5.cubic(vec1, vec2, vec3, vec4, f19);
|
||||
|
||||
emitter->setLifeTime(lifetime);
|
||||
JPABaseParticle* particle = emitter->createParticle();
|
||||
|
||||
@@ -94,7 +94,7 @@ void daBomb_fuseSmokeEcallBack::executeAfter(JPABaseEmitter* emitter) {
|
||||
|
||||
for(f32 i = step; i < 1.0f; i += step, temp8 += temp7) {
|
||||
JGeometry::TVec3<f32> vec5;
|
||||
vec5.cubic<f32>(vec1, vec2, vec3, vec4, i);
|
||||
vec5.cubic(vec1, vec2, vec3, vec4, i);
|
||||
|
||||
emitter->setLifeTime(temp8);
|
||||
JPABaseParticle* particle = emitter->createParticle();
|
||||
|
||||
@@ -76,7 +76,7 @@ void daPy_swimTailEcallBack_c::execute(JPABaseEmitter* emitter) {
|
||||
|
||||
if (field_0x20 != NULL) {
|
||||
emitter->setGlobalTranslation(mPos.x, mPos.y, mPos.z);
|
||||
JGeometry::TVec3<s16> rot(0, field_0x20->y, 0);
|
||||
JGeometry::TVec3<s16> rot((s16)0, field_0x20->y, (s16)0);
|
||||
emitter->setGlobalRotation(rot);
|
||||
}else {
|
||||
JGeometry::TVec3<f32> sp20;
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void dPa_waveEcallBack::executeAfter(JPABaseEmitter* emitter) {
|
||||
}
|
||||
f32 speed = mVelFade1 * vel * mVelFade2;
|
||||
|
||||
JGeometry::TVec3<s16> rot(0, mpRot->y, 0);
|
||||
JGeometry::TVec3<s16> rot((s16)0, mpRot->y, (s16)0);
|
||||
emitter->setGlobalRotation(rot);
|
||||
|
||||
if (std::fabsf(speed - mVel) > mVelSpeed) {
|
||||
|
||||
Reference in New Issue
Block a user