mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-07 05:14:58 -04:00
TVec3 inline fixes, d_a_obj_gtaki OK, JPAConvectionField::calc cleanup
This commit is contained in:
+1
-1
@@ -1707,7 +1707,7 @@ config.libs = [
|
||||
ActorRel(Matching, "d_a_obj_gnndemotakie"),
|
||||
ActorRel(NonMatching, "d_a_obj_gnndemotakis"),
|
||||
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gong"),
|
||||
ActorRel(MatchingFor("D44J01"), "d_a_obj_gtaki"),
|
||||
ActorRel(Matching, "d_a_obj_gtaki"),
|
||||
ActorRel(NonMatching, "d_a_obj_hami2"),
|
||||
ActorRel(Matching, "d_a_obj_hami3"),
|
||||
ActorRel(Matching, "d_a_obj_hami4"),
|
||||
|
||||
@@ -85,7 +85,7 @@ template <>
|
||||
struct TVec3<f32> : public Vec {
|
||||
TVec3() {}
|
||||
|
||||
TVec3(const f32 x, const f32 y, const f32 z) { set(x, y, z); }
|
||||
TVec3(const f32 x, const f32 y, const f32 z) { set((f32)x, (f32)y, (f32)z); }
|
||||
|
||||
TVec3(const Vec& b) { set(b); }
|
||||
|
||||
@@ -94,9 +94,9 @@ struct TVec3<f32> : public Vec {
|
||||
|
||||
template<typename f32>
|
||||
void set(const TVec3<f32>& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
x = (f32)other.x;
|
||||
y = (f32)other.y;
|
||||
z = (f32)other.z;
|
||||
}
|
||||
|
||||
void set(const Vec& vec) {
|
||||
@@ -107,9 +107,9 @@ struct TVec3<f32> : public Vec {
|
||||
|
||||
template<typename f32>
|
||||
void set(f32 x_, f32 y_, f32 z_) {
|
||||
x = x_;
|
||||
y = y_;
|
||||
z = z_;
|
||||
x = (f32)x_;
|
||||
y = (f32)y_;
|
||||
z = (f32)z_;
|
||||
}
|
||||
|
||||
void zero() { x = y = z = 0.0f; }
|
||||
@@ -212,13 +212,6 @@ struct TVec3<f32> : public Vec {
|
||||
);
|
||||
}
|
||||
|
||||
void cross_hack(const TVec3<f32>& a, const TVec3<f32>& b) {
|
||||
// obviously fake
|
||||
x = a.y * b.z - a.z * b.y;
|
||||
y = a.z * b.x - a.x * b.z;
|
||||
z = a.x * b.y - a.y * b.x;
|
||||
}
|
||||
|
||||
f32 setLength(f32 len) {
|
||||
f32 sq = squared();
|
||||
if (sq <= TUtil<f32>::epsilon()) {
|
||||
|
||||
@@ -260,59 +260,29 @@ void JPAConvectionField::preCalc(JPAFieldData* data) {
|
||||
|
||||
/* 8025B114-8025B3CC .text calc__18JPAConvectionFieldFP12JPAFieldDataP15JPABaseParticle */
|
||||
void JPAConvectionField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching - regalloc, maybe related to cross_hack fake inline? */
|
||||
/* Nonmatching - fpr regalloc */
|
||||
|
||||
JGeometry::TVec3<f32> axisX, axisZ;
|
||||
|
||||
// axisX.scale(data->mWork0.dot(ptcl->mLocalPosition), data->mWork0);
|
||||
// axisZ.scale(data->mWork2.dot(ptcl->mLocalPosition), data->mWork2);
|
||||
JGeometry::TVec3<f32> axisX;
|
||||
JGeometry::TVec3<f32> axisZ;
|
||||
|
||||
f32 dot0 = data->mWork0.dot(ptcl->mLocalPosition);
|
||||
|
||||
// f32 f3 = data->mWork0.x * dot0;
|
||||
// f32 f4 = data->mWork0.y * dot0;
|
||||
// f32 f5 = data->mWork0.z * dot0;
|
||||
// axisX.set(f3, f4, f5);
|
||||
|
||||
// axisX.set(data->mWork0.x * dot0, data->mWork0.y * dot0, data->mWork0.z * dot0);
|
||||
|
||||
axisX.set(data->mWork0);
|
||||
// axisX.set(data->mWork0.x, data->mWork0.y, data->mWork0.z);
|
||||
axisX.scale(dot0);
|
||||
|
||||
// axisX.scale(dot0, data->mWork0);
|
||||
|
||||
// axisX.scale(data->mWork0.dot(ptcl->mLocalPosition), data->mWork0);
|
||||
|
||||
f32 dot2 = data->mWork2.dot(ptcl->mLocalPosition);
|
||||
|
||||
f32 f1 = data->mWork2.x * dot2;
|
||||
f32 f2 = data->mWork2.y * dot2;
|
||||
f32 f0 = data->mWork2.z * dot2;
|
||||
axisZ.set(f1, f2, f0);
|
||||
|
||||
// axisZ.set(data->mWork2.x * dot2, data->mWork2.y * dot2, data->mWork2.z * dot2);
|
||||
|
||||
// axisZ.set(data->mWork2);
|
||||
// axisZ.scale(dot2);
|
||||
|
||||
// axisZ.scale(dot2, data->mWork2);
|
||||
|
||||
// axisZ.scale(data->mWork2.dot(ptcl->mLocalPosition), data->mWork2);
|
||||
axisZ.set(data->mWork2);
|
||||
axisZ.scale(dot2);
|
||||
|
||||
JGeometry::TVec3<f32> newPos;
|
||||
JGeometry::TVec3<f32> newPos2;
|
||||
newPos.add(axisX, axisZ);
|
||||
newPos2.setLength(newPos, data->mVal1);
|
||||
|
||||
newPos.setLength(newPos, data->mVal1);
|
||||
|
||||
JGeometry::TVec3<f32> delta, axisY;
|
||||
delta.sub(ptcl->mLocalPosition, newPos);
|
||||
axisY.cross_hack(data->mWork1, newPos); // fake inline
|
||||
// axisY.cross(data->mWork1, newPos);
|
||||
// axisY.cross(newPos, data->mWork1);
|
||||
// data->mVel.cross_hack(axisY, delta); // fake inline
|
||||
JGeometry::TVec3<f32> delta;
|
||||
JGeometry::TVec3<f32> axisY;
|
||||
delta.sub(ptcl->mLocalPosition, newPos2);
|
||||
axisY.cross(data->mWork1, newPos2);
|
||||
data->mVel.cross(axisY, delta);
|
||||
// data->mVel.cross(delta, axisY);
|
||||
data->mVel.setLength(data->mMag);
|
||||
|
||||
if (data->mVal2 != 0.0f) {
|
||||
|
||||
@@ -546,11 +546,9 @@ void enemy_fire(enemyfire* ef) {
|
||||
ef->mpFlameEmitters[i]->setDirection(ef->mDirection);
|
||||
|
||||
JGeometry::TVec3<f32> scale;
|
||||
scale.set(
|
||||
ef->mParticleScale[i],
|
||||
ef->mFlameScaleY * ef->mParticleScale[i],
|
||||
ef->mParticleScale[i]
|
||||
);
|
||||
scale.x = ef->mParticleScale[i];
|
||||
scale.z = ef->mParticleScale[i];
|
||||
scale.y = ef->mFlameScaleY * ef->mParticleScale[i];
|
||||
ef->mpFlameEmitters[i]->setGlobalParticleScale(scale);
|
||||
|
||||
if (ef->mHitboxFlameIdx == numFlamesLeft) {
|
||||
|
||||
@@ -65,15 +65,12 @@ void daObjGtaki_c::setDummyTexture() {
|
||||
|
||||
/* 00000280-00000484 .text CreateHeap__12daObjGtaki_cFv */
|
||||
BOOL daObjGtaki_c::CreateHeap() {
|
||||
J3DModelData* modelData;
|
||||
J3DAnmTextureSRTKey* btk;
|
||||
|
||||
modelData = (J3DModelData*)dComIfG_getObjectRes("Gtaki", GTAKI_BDL_GTAKI);
|
||||
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Gtaki", GTAKI_BDL_GTAKI);
|
||||
JUT_ASSERT(DEMO_SELECT(265, 267), modelData != NULL);
|
||||
mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
|
||||
if(mpModel == NULL) return FALSE;
|
||||
|
||||
btk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes("Gtaki", GTAKI_BTK_GTAKI));
|
||||
J3DAnmTextureSRTKey* btk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes("Gtaki", GTAKI_BTK_GTAKI));
|
||||
JUT_ASSERT(DEMO_SELECT(275, 277), btk != NULL);
|
||||
mBtkAnm.init(modelData, btk, true, J3DFrameCtrl::EMode_LOOP, 1.0, 0, -1, false, 0);
|
||||
setDummyTexture();
|
||||
@@ -95,13 +92,12 @@ BOOL daObjGtaki_c::CreateHeap() {
|
||||
void daObjGtaki_c::set_effect() {
|
||||
JPABaseEmitter* emitter = dComIfGp_particle_setP1(dPa_name::ID_AK_SN_GANONFALLSSPLASH00, ¤t.pos, NULL, NULL, 0xff, NULL, -1, NULL, NULL, NULL);
|
||||
if(emitter != NULL){
|
||||
JGeometry::TVec3<f32> gd_scale;
|
||||
gd_scale.set(scale.x, scale.y, scale.z);
|
||||
emitter->setGlobalDynamicsScale(gd_scale);
|
||||
JGeometry::TVec3<f32> p_scale;
|
||||
p_scale.set(scale.x, scale.y, scale.z);
|
||||
emitter->setGlobalDynamicsScale(p_scale);
|
||||
|
||||
JGeometry::TVec3<f32> gp_scale;
|
||||
gp_scale.set(scale.x, scale.x, scale.x);
|
||||
emitter->setGlobalParticleScale(gp_scale);
|
||||
p_scale.set(scale.x, scale.x, scale.x);
|
||||
emitter->setGlobalParticleScale(p_scale);
|
||||
|
||||
emitter->setGlobalPrmColor(mTevStr.mColorC0.r, mTevStr.mColorC0.g, mTevStr.mColorC0.b);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void dPa_J3DmodelEmitter_c::draw() {
|
||||
vel.normalize();
|
||||
}
|
||||
JGeometry::TVec3<f32> tmp;
|
||||
tmp.cross_hack(params->mAxis, vel); // fake inline
|
||||
tmp.cross(params->mAxis, vel);
|
||||
if (tmp.isZero()) {
|
||||
tmp.set(0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user