EffectsStruct::fn_ begone

This commit is contained in:
robojumper
2025-05-04 18:20:13 +02:00
parent 820c08e1d6
commit 3bce2ab396
11 changed files with 97 additions and 35 deletions
+2 -2
View File
@@ -196,7 +196,7 @@ int dAcODungeonShip_c::actorExecute() {
mAnmMatClr.play();
mMdl.calc(false);
if (field_0x8D8) {
mEffects[0].fn_80029A10(PARTICLE_RESOURCE_ID_MAPPING_682_, &position, &rotation, nullptr, nullptr, nullptr);
mEffects[0].createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_682_, position, &rotation, nullptr, nullptr, nullptr);
}
if (field_0x8D9) {
@@ -205,7 +205,7 @@ int dAcODungeonShip_c::actorExecute() {
if (mEffects[1].hasEmitters()) {
mEffects[1].setTransform(tmpMtx);
} else if (field_0x8DA == 0) {
mEffects[1].fn_800299F0(PARTICLE_RESOURCE_ID_MAPPING_683_, &tmpMtx, nullptr, nullptr);
mEffects[1].createEffect(PARTICLE_RESOURCE_ID_MAPPING_683_, tmpMtx, nullptr, nullptr);
field_0x8DA = 1;
}
}
+1 -1
View File
@@ -231,7 +231,7 @@ void dAcOSeatSword_c::actorExecuteCommon() {
mEffPos += player->position;
mEffPos.y = position.y;
mEff.fn_80029A10(PARTICLE_RESOURCE_ID_MAPPING_76_, &mEffPos, &rotation, &mScale, nullptr, nullptr);
mEff.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_76_, mEffPos, &rotation, &mScale, nullptr, nullptr);
mEff.setGlobalAlpha(mField_0x7E4);
}
+4 -3
View File
@@ -10,6 +10,7 @@
#include "f/f_profile_name.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
#include "toBeSorted/small_sound_mgr.h"
SPECIAL_ACTOR_PROFILE(OBJ_TOWER_GEAR_D101, dAcOTowerGearD101_c, fProfile::OBJ_TOWER_GEAR_D101, 0x17E, 0, 7);
@@ -92,9 +93,9 @@ void dAcOTowerGearD101_c::executeState_Wait() {
mAng newRotation = diff * scale5 / 2400.0f;
if (newRotation != mCurrRotation) {
if (mPreviousTurnSpeed == 0) {
playSound(0xBF8);
playSound(SE_TGrD101_ROLL_START);
} else {
playSoundEffect1(0xBF9);
playSoundEffect1(SE_TGrD101_ROLL_LV);
playVisualEffect();
}
}
@@ -128,5 +129,5 @@ void dAcOTowerGearD101_c::initTransform() {
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_585_;
void dAcOTowerGearD101_c::playVisualEffect() {
mEffects.fn_80029A10(PARTICLE_RESOURCE_ID_MAPPING_585_, &field_0x3F4, &rotation, nullptr, nullptr, nullptr);
mEffects.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_585_, field_0x3F4, &rotation, nullptr, nullptr, nullptr);
}
+1 -1
View File
@@ -597,7 +597,7 @@ extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_573;
void dAcOTowerHandD101_c::initializeState_Close() {
mMdl.getAnm().setPlayState(m3d::PLAY_MODE_1);
mMdl.setRate(getCloseRate());
mEffects.fn_80029920(PARTICLE_RESOURCE_ID_MAPPING_573, &position, nullptr, nullptr, nullptr, nullptr);
mEffects.createEffect(PARTICLE_RESOURCE_ID_MAPPING_573, position, nullptr, nullptr, nullptr, nullptr);
playSound(0xC0C);
}
void dAcOTowerHandD101_c::executeState_Close() {
+1 -2
View File
@@ -56,7 +56,6 @@ int dAcOtriforce_c::doDelete() {
}
extern const u16 PARTICLE_RESOURCE_ID_MAPPING_967_;
extern "C" void fn_80029AE0(EffectsStruct *, u16, mMtx_c *, void *, void *);
int dAcOtriforce_c::actorExecute() {
int zero = 0;
@@ -73,7 +72,7 @@ int dAcOtriforce_c::actorExecute() {
PSMTXConcat(mWorldMtx.m, m, mWorldMtx.m);
mMdl.setLocalMtx(mWorldMtx);
mAnm.play();
fn_80029AE0(&mEffects, PARTICLE_RESOURCE_ID_MAPPING_967_, &mWorldMtx, nullptr, nullptr);
mEffects.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_967_, mWorldMtx, nullptr, nullptr);
return 1;
}
+1 -1
View File
@@ -2242,7 +2242,7 @@ void dLytMeterItemSelect_c::fn_800EF580() {
nw4r::math::MTX34 mtx = mpPanes[11]->GetGlobalMtx();
mVec3_c pos(mtx._03, mtx._13, 0.0f);
mVec3_c scale(mEffectScale, mEffectScale, mEffectScale);
mEffects.fn_80029A70(PARTICLE_RESOURCE_ID_MAPPING_717_, &pos, nullptr, &scale, nullptr, nullptr);
mEffects.createContinuousUIEffect(PARTICLE_RESOURCE_ID_MAPPING_717_, pos, nullptr, &scale, nullptr, nullptr);
if (field_0x57C0 != 0) {
mEffects.stopDrawParticles();
+4 -4
View File
@@ -626,8 +626,8 @@ void dLytMeterMinusBtn_c::initializeState_DemoMove() {
nw4r::math::MTX34 mtx = mpPanes[i + MINUS_BTN_PANE_ITEM_OFFSET]->GetGlobalMtx();
mVec3_c pos(mtx._03, mtx._13, 0.0f);
mSlotForEffect[numPlayingEffects] = i;
mEffects[numPlayingEffects].fn_80029980(
PARTICLE_RESOURCE_ID_MAPPING_971_, &pos, &mEffectsRot[numPlayingEffects], nullptr, nullptr, nullptr
mEffects[numPlayingEffects].createUIEffect(
PARTICLE_RESOURCE_ID_MAPPING_971_, pos, &mEffectsRot[numPlayingEffects], nullptr, nullptr, nullptr
);
numPlayingEffects++;
}
@@ -665,8 +665,8 @@ void dLytMeterMinusBtn_c::executeState_DemoMove() {
nw4r::math::MTX34 mtx = getPaneByIndex(mSlotToDemo + MINUS_BTN_PANE_ITEM_OFFSET)->GetGlobalMtx();
mVec3_c pos(mtx._03, mtx._13, 0.0f);
mSlotForEffect[0] = mSlotToDemo;
mEffects[0].fn_80029980(
PARTICLE_RESOURCE_ID_MAPPING_971_, &pos, &mEffectsRot[0], nullptr, nullptr, nullptr
mEffects[0].createUIEffect(
PARTICLE_RESOURCE_ID_MAPPING_971_, pos, &mEffectsRot[0], nullptr, nullptr, nullptr
);
}
} else if (mDemoFrame > 0) {
+51 -3
View File
@@ -1,3 +1,10 @@
// clang-format off
// vtable order
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAParticle.h"
#include "toBeSorted/d_d3d.h"
// clang-format on
#include "JSystem/JParticle/JPADrawInfo.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "c/c_math.h"
@@ -36,8 +43,9 @@
#include "rvl/GX.h"
#include "rvl/MTX.h"
// TODO: This file suffers from vtable and weak function order problems, big time.
// Some of what we think are weak functions may not be weak functions?
// There's a data gap at 0x805013b4 (right after dParticleFogProc_c's vtable)
// so maybe that's a data split. Unsure how to get all those vtables to appear
// there though...
void float_ordering_1(s32 a) {
(f32) a;
@@ -684,6 +692,20 @@ void dJEffManager_c::removeEffManagers() {
}
}
void dJEffManager_c::doCustomSkywardSwordThing(f32 x, f32 y) {
EffectsList::Iterator it = sPlayingEffectsList.GetBeginIter();
while (it != sPlayingEffectsList.GetEndIter()) {
if (it->getEmitterCallback() != nullptr && it->hasEmitters() && it->getGroupId() < 12) {
it->getEmitterCallback()->vt_0x20(x, y);
}
++it;
}
for (s32 i = 0; i < 12; i++) {
dParticle::mgr_c::GetInstance()->doCustomSkywardSwordThing(i, x, y);
}
}
// TODO explain this
static u32 sInts[] = {0x28, 0x29, 0x87, 0x88, 0x89, 0x8A, 0x8C, 0x8D, 0x91, 0x86, 0x1, 0x2};
static u32 sInts2[] = {0x2, 0x87, 0x8B};
@@ -858,6 +880,32 @@ dEmitterBase_c *dJEffManager_c::spawnEffect(
return spawnEffectInternal(effectResourceId, transform, c1, c2, idx1, idx2);
}
bool EffectsStruct::createEffect(u16 resourceId, const mVec3_c &pos, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1, const GXColor *c2) {
return createEffect(true, resourceId, pos, rot, scale, c1, c2);
}
bool EffectsStruct::createUIEffect(u16 resourceId, const mVec3_c &pos, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1, const GXColor *c2) {
mVec3_c adjustedPosition(pos.x * getlbl_80571C50(), pos.y, pos.z);
return createEffect(true, resourceId, adjustedPosition, rot, scale, c1, c2);
}
bool EffectsStruct::createEffect(u16 resourceId, const mMtx_c &transform, const GXColor *c1, const GXColor *c2) {
return createEffect(true, resourceId, transform, c1, c2);
}
bool EffectsStruct::createContinuousEffect(u16 resourceId, const mVec3_c &pos, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1, const GXColor *c2) {
return createEffect(false, resourceId, pos, rot, scale, c1, c2);
}
bool EffectsStruct::createContinuousUIEffect(u16 resourceId, const mVec3_c &pos, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1, const GXColor *c2) {
mVec3_c adjustedPosition(pos.x * getlbl_80571C50(), pos.y, pos.z);
return createEffect(false, resourceId, adjustedPosition, rot, scale, c1, c2);
}
bool EffectsStruct::createContinuousEffect(u16 resourceId, const mMtx_c &transform, const GXColor *c1, const GXColor *c2) {
return createEffect(false, resourceId, transform, c1, c2);
}
void dEmitterBase_c::loadColors(
JPABaseEmitter *emitter, const GXColor *color1, const GXColor *color2, s32 plltIdx1, s32 plltIdx2
) {
@@ -1051,7 +1099,7 @@ void dWaterEffect_c::execute(f32 water, f32 ground) {
// Spawn effect upon leaving water
mVec3_c pos(ac->position.x, water, ac->position.z);
mVec3_c scale(mScale, mScale, mScale);
mEff.fn_80029A10(PARTICLE_RESOURCE_ID_MAPPING_127_, &pos, nullptr, &scale, nullptr, nullptr);
mEff.createEffect(PARTICLE_RESOURCE_ID_MAPPING_127_, pos, nullptr, &scale, nullptr, nullptr);
f32 rate = nw4r::math::FAbs(ac->forwardSpeed) * 0.02f;
rate = rate > 0.95f ? 0.95f : rate;
mEff.setRate(rate + 0.05f);