Skip to content

Commit 4a5694d

Browse files
committed
EMitterViewObj naming
1 parent 0931965 commit 4a5694d

4 files changed

Lines changed: 324 additions & 297 deletions

File tree

‎include/System/EmitterViewObj.hpp‎

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,25 @@ extern TMarioParticleManager* gpMarioParticleManager;
1616
class TMarioParticleManager : public JDrama::TViewObj {
1717
public:
1818
enum {
19-
INFO_FLAG_UNK4 = 0x4,
19+
EFFECT_ONETIME_NORMAL = 0,
20+
EFFECT_LOOP_NORMAL = 1,
21+
EFFECT_ONETIME_INDIRECT = 2,
22+
EFFECT_LOOP_INDIRECT = 3,
23+
};
24+
25+
enum {
26+
ONETIME_NORMAL_FIRST = 0,
27+
ONETIME_NORMAL_COUNT = 253,
28+
LOOP_NORMAL_FIRST = 253,
29+
LOOP_NORMAL_COUNT = 214,
30+
ONETIME_INDIRECT_FIRST = 467,
31+
ONETIME_INDIRECT_COUNT = 19,
32+
LOOP_INDIRECT_FIRST = 486,
33+
LOOP_INDIRECT_COUNT = 19,
34+
};
35+
36+
enum {
37+
INFO_FLAG_KEEP_ALIVE = 0x4,
2038
INFO_FLAG_BIND_TO_POS = 0x8,
2139
INFO_FLAG_BIND_TO_RT_MTX = 0x10,
2240
INFO_FLAG_BIND_TO_SRT_MTX = 0x20,
@@ -29,8 +47,11 @@ class TMarioParticleManager : public JDrama::TViewObj {
2947
void onFlag(u16 flag) { mFlags |= flag; }
3048
void offFlag(u16 flag) { mFlags &= ~flag; }
3149

32-
/* 0x0 */ const void* unk0;
33-
/* 0x4 */ const void* unk4;
50+
/* 0x0 */ const void* mIdentity;
51+
/* 0x4 */ union {
52+
const JGeometry::TVec3<f32>* mBoundPos;
53+
MtxPtr mBoundMtx;
54+
};
3455
/* 0x8 */ u16 mPrevFrameFlags;
3556
/* 0xA */ u16 mFlags;
3657
/* 0xC */ JPABaseEmitter* mEmitter;
@@ -39,36 +60,41 @@ class TMarioParticleManager : public JDrama::TViewObj {
3960
virtual void perform(u32 cue, JDrama::TGraphics* graphics);
4061

4162
TMarioParticleManager(const char* = "MarioParticleManager");
42-
void createEffectInfoAry(int);
43-
44-
// TODO: figure out what the u8 parameters her mean conceptually
45-
46-
JPABaseEmitter* emit(s32, const JGeometry::TVec3<f32>*, u8, const void*);
47-
JPABaseEmitter* emitWithRotate(s32, const JGeometry::TVec3<f32>*, s16, s16,
48-
s16, u8, const void*);
49-
JPABaseEmitter* emitAndBindToPosPtr(s32, const JGeometry::TVec3<f32>*, u8,
50-
const void*);
51-
JPABaseEmitter* emitAndBindToMtxPtr(s32, MtxPtr, u8, const void*);
52-
JPABaseEmitter* emitAndBindToSRTMtxPtr(s32, MtxPtr, u8, const void*);
53-
JPABaseEmitter* emitAndBindToMtx(s32, MtxPtr, u8, const void*);
54-
55-
JPABaseEmitter*
56-
emitParticleCallBack(s32, const JGeometry::TVec3<f32>*, u8,
57-
JPACallBackBase2<JPABaseEmitter*, JPABaseParticle*>*,
58-
const void*);
59-
void emitTry(s32, TMarioParticleManager::TInfo*, u8);
60-
int getAvailableIdx(s32, u8, const void*);
63+
void createEffectInfoAry(int max_simultaneous_loop_emitters);
64+
65+
JPABaseEmitter* emit(s32 id, const JGeometry::TVec3<f32>* pos,
66+
u8 effect_type, const void* identity);
67+
JPABaseEmitter* emitWithRotate(s32 id, const JGeometry::TVec3<f32>* pos,
68+
s16 rot_x, s16 rot_y, s16 rot_z,
69+
u8 effect_type, const void* identity);
70+
JPABaseEmitter* emitAndBindToPosPtr(s32 id,
71+
const JGeometry::TVec3<f32>* pos,
72+
u8 effect_type, const void* identity);
73+
JPABaseEmitter* emitAndBindToMtxPtr(s32 id, MtxPtr mtx, u8 effect_type,
74+
const void* identity);
75+
JPABaseEmitter* emitAndBindToSRTMtxPtr(s32 id, MtxPtr mtx, u8 effect_type,
76+
const void* identity);
77+
JPABaseEmitter* emitAndBindToMtx(s32 id, MtxPtr mtx, u8 effect_type,
78+
const void* identity);
79+
80+
JPABaseEmitter* emitParticleCallBack(
81+
s32 id, const JGeometry::TVec3<f32>* pos, u8 effect_type,
82+
JPACallBackBase2<JPABaseEmitter*, JPABaseParticle*>* callback,
83+
const void* identity);
84+
void emitTry(s32 id, TMarioParticleManager::TInfo* info, u8 effect_type);
85+
int getAvailableIdx(s32 table_idx, u8 effect_type, const void* identity);
6186

6287
public:
63-
/* 0x10 */ TInfo* unk10[214];
64-
/* 0x368 */ TInfo* unk368[19];
65-
/* 0x3B4 */ int unk3B4;
66-
/* 0x3B8 */ JPAEmitterManager* unk3B8;
88+
/* 0x10 */ TInfo* mLoopNormalInfo[LOOP_NORMAL_COUNT];
89+
/* 0x368 */ TInfo* mLoopIndirectInfo[LOOP_INDIRECT_COUNT];
90+
/* 0x3B4 */ int mMaxSimultaneousLoopEmitters;
91+
/* 0x3B8 */ JPAEmitterManager* mEmitterManager;
6792
};
6893

6994
class TEmitterViewObj : public JDrama::TViewObj {
7095
public:
71-
TEmitterViewObj(JPAEmitterManager*, const char* = "<EmitterViewObj>");
96+
TEmitterViewObj(JPAEmitterManager* emitter_manager,
97+
const char* name = "<EmitterViewObj>");
7298
virtual void perform(u32 cue, JDrama::TGraphics* graphics);
7399

74100
protected:

‎include/System/Particles.hpp‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,8 @@ enum E_SMS_EFFECT_LOOP_NORMAL /* 1 */ {
427427
PARTICLE_MS_MPK_FIRE_B = 0x1D2,
428428
};
429429

430-
// TODO: what is "type 2"?
431-
enum /* 2 */
432-
{
430+
// NOTE: name fabricated, the map has no instantiation for this type.
431+
enum E_SMS_EFFECT_ONETIME_INDIRECT /* 2 */ {
433432
PARTICLE_MS_M_TOBIKOMI_C = 0x1D4,
434433
PARTICLE_MS_M_TOBIKOMI_S_C = 0x1D5,
435434
PARTICLE_MS_MARI_RAKUBALL = 0x1D8,
@@ -467,38 +466,37 @@ enum E_SMS_EFFECT_LOOP_INDIRECT /* 3 */ {
467466
// NOTE: doing this makes inlining work out, specializations DON'T.
468467
template <class T> struct FabricatedParticleTypeToFlag;
469468
template <> struct FabricatedParticleTypeToFlag<E_SMS_EFFECT_ONETIME_NORMAL> {
470-
enum { value = 0 };
469+
enum { value = TMarioParticleManager::EFFECT_ONETIME_NORMAL };
471470
};
472471
template <> struct FabricatedParticleTypeToFlag<E_SMS_EFFECT_LOOP_NORMAL> {
473-
enum { value = 1 };
472+
enum { value = TMarioParticleManager::EFFECT_LOOP_NORMAL };
474473
};
475474
template <> struct FabricatedParticleTypeToFlag<E_SMS_EFFECT_LOOP_INDIRECT> {
476-
enum { value = 3 };
475+
enum { value = TMarioParticleManager::EFFECT_LOOP_INDIRECT };
477476
};
478477

479478
// TODO: the fabricated setScale inline is most likely incorrect.
480479

481480
template <class T>
482-
JPABaseEmitter*
483-
SMS_EasyEmitParticle(T param_1, const JGeometry::TVec3<f32>* param_2,
484-
const void* param_3, const JGeometry::TVec3<f32>& param_4)
481+
JPABaseEmitter* SMS_EasyEmitParticle(T id, const JGeometry::TVec3<f32>* pos_ptr,
482+
const void* identity,
483+
const JGeometry::TVec3<f32>& scale)
485484
{
486485
JPABaseEmitter* emitter = gpMarioParticleManager->emitAndBindToPosPtr(
487-
param_1, param_2, FabricatedParticleTypeToFlag<T>::value, param_3);
486+
id, pos_ptr, FabricatedParticleTypeToFlag<T>::value, identity);
488487
if (emitter)
489-
emitter->setGlobalScale(param_4);
488+
emitter->setGlobalScale(scale);
490489
return emitter;
491490
}
492491

493492
template <class T>
494-
JPABaseEmitter* SMS_EasyEmitParticle(T param_1, MtxPtr param_2,
495-
const void* param_3,
496-
const JGeometry::TVec3<f32>& param_4)
493+
JPABaseEmitter* SMS_EasyEmitParticle(T id, MtxPtr mtx_ptr, const void* identity,
494+
const JGeometry::TVec3<f32>& scale)
497495
{
498496
JPABaseEmitter* emitter = gpMarioParticleManager->emitAndBindToMtxPtr(
499-
param_1, param_2, FabricatedParticleTypeToFlag<T>::value, param_3);
497+
id, mtx_ptr, FabricatedParticleTypeToFlag<T>::value, identity);
500498
if (emitter)
501-
emitter->setGlobalScale(param_4);
499+
emitter->setGlobalScale(scale);
502500
return emitter;
503501
}
504502

0 commit comments

Comments
 (0)