Skip to content

Commit a62f436

Browse files
committed
TVec3 inline fixes, d_a_obj_gtaki OK, JPAConvectionField::calc cleanup
1 parent d29477c commit a62f436

File tree

6 files changed

+30
-73
lines changed

6 files changed

+30
-73
lines changed

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ def EquivalentFor(*versions):
17071707
ActorRel(Matching, "d_a_obj_gnndemotakie"),
17081708
ActorRel(NonMatching, "d_a_obj_gnndemotakis"),
17091709
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gong"),
1710-
ActorRel(MatchingFor("D44J01"), "d_a_obj_gtaki"),
1710+
ActorRel(Matching, "d_a_obj_gtaki"),
17111711
ActorRel(NonMatching, "d_a_obj_hami2"),
17121712
ActorRel(Matching, "d_a_obj_hami3"),
17131713
ActorRel(Matching, "d_a_obj_hami4"),

include/JSystem/JGeometry.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ template <>
8585
struct TVec3<f32> : public Vec {
8686
TVec3() {}
8787

88-
TVec3(const f32 x, const f32 y, const f32 z) { set(x, y, z); }
88+
TVec3(const f32 x, const f32 y, const f32 z) { set((f32)x, (f32)y, (f32)z); }
8989

9090
TVec3(const Vec& b) { set(b); }
9191

@@ -94,9 +94,9 @@ struct TVec3<f32> : public Vec {
9494

9595
template<typename f32>
9696
void set(const TVec3<f32>& other) {
97-
x = other.x;
98-
y = other.y;
99-
z = other.z;
97+
x = (f32)other.x;
98+
y = (f32)other.y;
99+
z = (f32)other.z;
100100
}
101101

102102
void set(const Vec& vec) {
@@ -107,9 +107,9 @@ struct TVec3<f32> : public Vec {
107107

108108
template<typename f32>
109109
void set(f32 x_, f32 y_, f32 z_) {
110-
x = x_;
111-
y = y_;
112-
z = z_;
110+
x = (f32)x_;
111+
y = (f32)y_;
112+
z = (f32)z_;
113113
}
114114

115115
void zero() { x = y = z = 0.0f; }
@@ -212,13 +212,6 @@ struct TVec3<f32> : public Vec {
212212
);
213213
}
214214

215-
void cross_hack(const TVec3<f32>& a, const TVec3<f32>& b) {
216-
// obviously fake
217-
x = a.y * b.z - a.z * b.y;
218-
y = a.z * b.x - a.x * b.z;
219-
z = a.x * b.y - a.y * b.x;
220-
}
221-
222215
f32 setLength(f32 len) {
223216
f32 sq = squared();
224217
if (sq <= TUtil<f32>::epsilon()) {

src/JSystem/JParticle/JPAField.cpp

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -260,59 +260,29 @@ void JPAConvectionField::preCalc(JPAFieldData* data) {
260260

261261
/* 8025B114-8025B3CC .text calc__18JPAConvectionFieldFP12JPAFieldDataP15JPABaseParticle */
262262
void JPAConvectionField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
263-
/* Nonmatching - regalloc, maybe related to cross_hack fake inline? */
263+
/* Nonmatching - fpr regalloc */
264264

265-
JGeometry::TVec3<f32> axisX, axisZ;
266-
267-
// axisX.scale(data->mWork0.dot(ptcl->mLocalPosition), data->mWork0);
268-
// axisZ.scale(data->mWork2.dot(ptcl->mLocalPosition), data->mWork2);
265+
JGeometry::TVec3<f32> axisX;
266+
JGeometry::TVec3<f32> axisZ;
269267

270268
f32 dot0 = data->mWork0.dot(ptcl->mLocalPosition);
271-
272-
// f32 f3 = data->mWork0.x * dot0;
273-
// f32 f4 = data->mWork0.y * dot0;
274-
// f32 f5 = data->mWork0.z * dot0;
275-
// axisX.set(f3, f4, f5);
276-
277-
// axisX.set(data->mWork0.x * dot0, data->mWork0.y * dot0, data->mWork0.z * dot0);
278-
279269
axisX.set(data->mWork0);
280-
// axisX.set(data->mWork0.x, data->mWork0.y, data->mWork0.z);
281270
axisX.scale(dot0);
282271

283-
// axisX.scale(dot0, data->mWork0);
284-
285-
// axisX.scale(data->mWork0.dot(ptcl->mLocalPosition), data->mWork0);
286-
287272
f32 dot2 = data->mWork2.dot(ptcl->mLocalPosition);
288-
289-
f32 f1 = data->mWork2.x * dot2;
290-
f32 f2 = data->mWork2.y * dot2;
291-
f32 f0 = data->mWork2.z * dot2;
292-
axisZ.set(f1, f2, f0);
293-
294-
// axisZ.set(data->mWork2.x * dot2, data->mWork2.y * dot2, data->mWork2.z * dot2);
295-
296-
// axisZ.set(data->mWork2);
297-
// axisZ.scale(dot2);
298-
299-
// axisZ.scale(dot2, data->mWork2);
300-
301-
// axisZ.scale(data->mWork2.dot(ptcl->mLocalPosition), data->mWork2);
273+
axisZ.set(data->mWork2);
274+
axisZ.scale(dot2);
302275

303276
JGeometry::TVec3<f32> newPos;
277+
JGeometry::TVec3<f32> newPos2;
304278
newPos.add(axisX, axisZ);
279+
newPos2.setLength(newPos, data->mVal1);
305280

306-
newPos.setLength(newPos, data->mVal1);
307-
308-
JGeometry::TVec3<f32> delta, axisY;
309-
delta.sub(ptcl->mLocalPosition, newPos);
310-
axisY.cross_hack(data->mWork1, newPos); // fake inline
311-
// axisY.cross(data->mWork1, newPos);
312-
// axisY.cross(newPos, data->mWork1);
313-
// data->mVel.cross_hack(axisY, delta); // fake inline
281+
JGeometry::TVec3<f32> delta;
282+
JGeometry::TVec3<f32> axisY;
283+
delta.sub(ptcl->mLocalPosition, newPos2);
284+
axisY.cross(data->mWork1, newPos2);
314285
data->mVel.cross(axisY, delta);
315-
// data->mVel.cross(delta, axisY);
316286
data->mVel.setLength(data->mMag);
317287

318288
if (data->mVal2 != 0.0f) {

src/c/c_damagereaction.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,9 @@ void enemy_fire(enemyfire* ef) {
546546
ef->mpFlameEmitters[i]->setDirection(ef->mDirection);
547547

548548
JGeometry::TVec3<f32> scale;
549-
scale.set(
550-
ef->mParticleScale[i],
551-
ef->mFlameScaleY * ef->mParticleScale[i],
552-
ef->mParticleScale[i]
553-
);
549+
scale.x = ef->mParticleScale[i];
550+
scale.z = ef->mParticleScale[i];
551+
scale.y = ef->mFlameScaleY * ef->mParticleScale[i];
554552
ef->mpFlameEmitters[i]->setGlobalParticleScale(scale);
555553

556554
if (ef->mHitboxFlameIdx == numFlamesLeft) {

src/d/actor/d_a_obj_gtaki.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,12 @@ void daObjGtaki_c::setDummyTexture() {
6565

6666
/* 00000280-00000484 .text CreateHeap__12daObjGtaki_cFv */
6767
BOOL daObjGtaki_c::CreateHeap() {
68-
J3DModelData* modelData;
69-
J3DAnmTextureSRTKey* btk;
70-
71-
modelData = (J3DModelData*)dComIfG_getObjectRes("Gtaki", GTAKI_BDL_GTAKI);
68+
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Gtaki", GTAKI_BDL_GTAKI);
7269
JUT_ASSERT(DEMO_SELECT(265, 267), modelData != NULL);
7370
mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
7471
if(mpModel == NULL) return FALSE;
7572

76-
btk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes("Gtaki", GTAKI_BTK_GTAKI));
73+
J3DAnmTextureSRTKey* btk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes("Gtaki", GTAKI_BTK_GTAKI));
7774
JUT_ASSERT(DEMO_SELECT(275, 277), btk != NULL);
7875
mBtkAnm.init(modelData, btk, true, J3DFrameCtrl::EMode_LOOP, 1.0, 0, -1, false, 0);
7976
setDummyTexture();
@@ -95,13 +92,12 @@ BOOL daObjGtaki_c::CreateHeap() {
9592
void daObjGtaki_c::set_effect() {
9693
JPABaseEmitter* emitter = dComIfGp_particle_setP1(dPa_name::ID_AK_SN_GANONFALLSSPLASH00, &current.pos, NULL, NULL, 0xff, NULL, -1, NULL, NULL, NULL);
9794
if(emitter != NULL){
98-
JGeometry::TVec3<f32> gd_scale;
99-
gd_scale.set(scale.x, scale.y, scale.z);
100-
emitter->setGlobalDynamicsScale(gd_scale);
95+
JGeometry::TVec3<f32> p_scale;
96+
p_scale.set(scale.x, scale.y, scale.z);
97+
emitter->setGlobalDynamicsScale(p_scale);
10198

102-
JGeometry::TVec3<f32> gp_scale;
103-
gp_scale.set(scale.x, scale.x, scale.x);
104-
emitter->setGlobalParticleScale(gp_scale);
99+
p_scale.set(scale.x, scale.x, scale.x);
100+
emitter->setGlobalParticleScale(p_scale);
105101

106102
emitter->setGlobalPrmColor(mTevStr.mColorC0.r, mTevStr.mColorC0.g, mTevStr.mColorC0.b);
107103
}

src/d/d_particle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void dPa_J3DmodelEmitter_c::draw() {
9292
vel.normalize();
9393
}
9494
JGeometry::TVec3<f32> tmp;
95-
tmp.cross_hack(params->mAxis, vel); // fake inline
95+
tmp.cross(params->mAxis, vel);
9696
if (tmp.isZero()) {
9797
tmp.set(0.0f, 0.0f, 1.0f);
9898
} else {

0 commit comments

Comments
 (0)