diff options
| author | robojumper <robojumper@gmail.com> | 2025-04-27 07:13:47 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-04-27 07:13:47 +0200 |
| commit | c1a0264e6ac151f3a884bc32126de192eede19c7 (patch) | |
| tree | 1649757ae5c7b47b87f17ef69760b4a359a8d46d /src/JSystem/JParticle/JPAResource.cpp | |
| parent | 5df26c52fcc06e017f2cf525264d4f7563715e05 (diff) | |
Initial import of JParticle + JSUList from TP
Diffstat (limited to 'src/JSystem/JParticle/JPAResource.cpp')
| -rw-r--r-- | src/JSystem/JParticle/JPAResource.cpp | 1124 |
1 files changed, 1124 insertions, 0 deletions
diff --git a/src/JSystem/JParticle/JPAResource.cpp b/src/JSystem/JParticle/JPAResource.cpp new file mode 100644 index 00000000..01bba7d2 --- /dev/null +++ b/src/JSystem/JParticle/JPAResource.cpp @@ -0,0 +1,1124 @@ +// +// Generated By: dol2asm +// Translation Unit: JPAResource +// + +#include "JSystem/JParticle/JPAResource.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JParticle/JPABaseShape.h" +#include "JSystem/JParticle/JPAChildShape.h" +#include "JSystem/JParticle/JPAEmitter.h" +#include "JSystem/JParticle/JPAExTexShape.h" +#include "JSystem/JParticle/JPAExtraShape.h" +#include "JSystem/JParticle/JPAFieldBlock.h" +#include "JSystem/JParticle/JPAKeyBlock.h" +#include "JSystem/JParticle/JPAParticle.h" +#include "JSystem/JParticle/JPAResourceManager.h" +#include "dolphin/gx.h" +#include "global.h" + +/* 80274010-80274080 26E950 0070+00 0/0 1/1 0/0 .text __ct__11JPAResourceFv */ +JPAResource::JPAResource() { + mpDrawEmitterChildFuncList = NULL; + mpDrawEmitterFuncList = NULL; + mpCalcEmitterFuncList = NULL; + mpDrawParticleChildFuncList = NULL; + mpCalcParticleChildFuncList = NULL; + mpDrawParticleFuncList = NULL; + mpCalcParticleFuncList = NULL; + mpBaseShape = NULL; + mpExtraShape = NULL; + mpChildShape = NULL; + mpExTexShape = NULL; + mpDynamicsBlock = NULL; + mpFieldBlocks = NULL; + mpKeyBlocks = NULL; + mpTDB1 = NULL; + mpDrawParticleChildFuncListNum = 0; + mpCalcParticleChildFuncListNum = 0; + mpDrawParticleFuncListNum = 0; + mpCalcParticleFuncListNum = 0; + mpDrawEmitterChildFuncListNum = 0; + mpDrawEmitterFuncListNum = 0; + mpCalcEmitterFuncListNum = 0; + mTDB1Num = 0; + mKeyBlockNum = 0; + mFieldBlockNum = 0; + mUsrIdx = 0; +} + +/* 803C40C0-803C4220 0211E0 0144+1C 2/2 0/0 0/0 .data jpa_pos */ +static u8 jpa_pos[324] ALIGN_DECL(32) = { + 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x32, 0xCE, 0x00, 0x00, 0xCE, 0x00, 0xE7, 0x00, 0x00, 0x19, + 0x00, 0x00, 0x19, 0xCE, 0x00, 0xE7, 0xCE, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, + 0x00, 0xCE, 0xCE, 0x00, 0x00, 0x19, 0x00, 0x32, 0x19, 0x00, 0x32, 0xE7, 0x00, 0x00, 0xE7, 0x00, + 0xE7, 0x19, 0x00, 0x19, 0x19, 0x00, 0x19, 0xE7, 0x00, 0xE7, 0xE7, 0x00, 0xCE, 0x19, 0x00, 0x00, + 0x19, 0x00, 0x00, 0xE7, 0x00, 0xCE, 0xE7, 0x00, 0x00, 0x32, 0x00, 0x32, 0x32, 0x00, 0x32, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE7, 0x32, 0x00, 0x19, 0x32, 0x00, 0x19, 0x00, 0x00, 0xE7, 0x00, 0x00, + 0xCE, 0x32, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, + 0x00, 0x00, 0x32, 0x00, 0x32, 0x00, 0x00, 0x32, 0xE7, 0x00, 0x00, 0x19, 0x00, 0x00, 0x19, 0x00, + 0x32, 0xE7, 0x00, 0x32, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xCE, 0x00, 0x32, + 0x00, 0x00, 0xE7, 0x32, 0x00, 0xE7, 0x32, 0x00, 0x19, 0x00, 0x00, 0x19, 0xE7, 0x00, 0xE7, 0x19, + 0x00, 0xE7, 0x19, 0x00, 0x19, 0xE7, 0x00, 0x19, 0xCE, 0x00, 0xE7, 0x00, 0x00, 0xE7, 0x00, 0x00, + 0x19, 0xCE, 0x00, 0x19, 0x00, 0x00, 0xCE, 0x32, 0x00, 0xCE, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE7, 0x00, 0xCE, 0x19, 0x00, 0xCE, 0x19, 0x00, 0x00, 0xE7, 0x00, 0x00, 0xCE, 0x00, 0xCE, 0x00, + 0x00, 0xCE, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0xCE, + 0x32, 0x00, 0xCE, 0x00, 0x00, 0x00, 0xE7, 0x00, 0x00, 0x19, 0x00, 0xCE, 0x19, 0x00, 0xCE, 0xE7, + 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0xCE, 0xCE, 0x00, 0x19, 0x00, 0x00, + 0x19, 0x32, 0x00, 0xE7, 0x32, 0x00, 0xE7, 0x00, 0x00, 0x19, 0xE7, 0x00, 0x19, 0x19, 0x00, 0xE7, + 0x19, 0x00, 0xE7, 0xE7, 0x00, 0x19, 0xCE, 0x00, 0x19, 0x00, 0x00, 0xE7, 0x00, 0x00, 0xE7, 0xCE, + 0x00, 0x32, 0x00, 0x00, 0x32, 0x32, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x32, 0xE7, 0x00, + 0x32, 0x19, 0x00, 0x00, 0x19, 0x00, 0x00, 0xE7, 0x00, 0x32, 0xCE, 0x00, 0x32, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xCE, +}; + +/* 803C4220-803C4240 021340 0020+00 2/2 0/0 0/0 .data jpa_crd */ +static u8 jpa_crd[32] ALIGN_DECL(32) = { + 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x02, +}; + +/* 80274080-802755E8 26E9C0 1568+00 2/0 1/1 0/0 .text init__11JPAResourceFP7JKRHeap */ +void JPAResource::init(JKRHeap* heap) { + BOOL is_glbl_clr_anm = mpBaseShape->isGlblClrAnm(); + BOOL is_glbl_tex_anm = mpBaseShape->isGlblTexAnm(); + BOOL is_prm_anm = mpBaseShape->isPrmAnm(); + BOOL is_env_anm = mpBaseShape->isEnvAnm(); + BOOL is_tex_anm = mpBaseShape->isTexAnm(); + BOOL is_tex_crd_anm = mpBaseShape->isTexCrdAnm(); + BOOL is_prj_tex = mpBaseShape->isPrjTex(); + BOOL is_enable_scale_anm = mpExtraShape != NULL && mpExtraShape->isEnableScaleAnm(); + BOOL is_enable_alpha_anm = mpExtraShape != NULL && mpExtraShape->isEnableAlphaAnm(); + BOOL is_enable_alpha_flick = mpExtraShape != NULL && mpExtraShape->isEnableAlphaAnm() + && mpExtraShape->isEnableAlphaFlick(); + BOOL is_enable_rotate_anm = mpExtraShape != NULL && mpExtraShape->isEnableRotateAnm(); + BOOL is_rotate_on = is_enable_rotate_anm + || (mpChildShape != NULL && mpChildShape->isRotateOn()); + BOOL base_type_5_6 = mpBaseShape->getType() == 5 || mpBaseShape->getType() == 6; + BOOL base_type_0 = mpBaseShape->getType() == 0; + BOOL base_type_0_1 = mpBaseShape->getType() == 0 || mpBaseShape->getType() == 1; + BOOL child_type_5_6 = mpChildShape != NULL + && (mpChildShape->getType() == 5 || mpChildShape->getType() == 6); + BOOL child_type_0 = mpChildShape != NULL && mpChildShape->getType() == 0; + BOOL child_type_0_1 = mpChildShape != NULL + && (mpChildShape->getType() == 0 || mpChildShape->getType() == 1); + BOOL is_draw_parent = !mpBaseShape->isNoDrawParent(); + BOOL is_draw_child = !mpBaseShape->isNoDrawChild(); + + if (is_glbl_tex_anm && is_tex_anm) { + mpCalcEmitterFuncListNum++; + } + + if (is_glbl_clr_anm) { + if (is_prm_anm) { + mpCalcEmitterFuncListNum++; + } + if (is_env_anm) { + mpCalcEmitterFuncListNum++; + } + if (is_prm_anm || is_env_anm) { + mpCalcEmitterFuncListNum++; + } + } + + if (mpCalcEmitterFuncListNum != 0) { + mpCalcEmitterFuncList = + (EmitterFunc*)JKRAllocFromHeap(heap, mpCalcEmitterFuncListNum * 4, 4); + } + + int func_no = 0; + + if (is_glbl_tex_anm && is_tex_anm) { + switch (mpBaseShape->getTexAnmType()) { + case 0: + mpCalcEmitterFuncList[func_no] = &JPACalcTexIdxNormal; + break; + case 1: + mpCalcEmitterFuncList[func_no] = &JPACalcTexIdxRepeat; + break; + case 2: + mpCalcEmitterFuncList[func_no] = &JPACalcTexIdxReverse; + break; + case 3: + mpCalcEmitterFuncList[func_no] = &JPACalcTexIdxMerge; + break; + case 4: + mpCalcEmitterFuncList[func_no] = &JPACalcTexIdxRandom; + break; + } + func_no++; + } + + if (is_glbl_clr_anm) { + if (is_prm_anm) { + mpCalcEmitterFuncList[func_no] = &JPACalcPrm; + func_no++; + } + if (is_env_anm) { + mpCalcEmitterFuncList[func_no] = &JPACalcEnv; + func_no++; + } + if (is_prm_anm || is_env_anm) { + switch (mpBaseShape->getClrAnmType()) { + case 0: + mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxNormal; + break; + case 1: + mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxRepeat; + break; + case 2: + mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxReverse; + break; + case 3: + mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxMerge; + break; + case 4: + mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxRandom; + break; + } + } + } + + if (!is_glbl_tex_anm && is_tex_anm) { + mpCalcParticleFuncListNum++; + } + + if (!base_type_5_6 && (is_enable_alpha_anm || is_enable_alpha_flick)) { + mpCalcParticleFuncListNum++; + } + + if (!is_glbl_clr_anm) { + if (is_prm_anm) { + mpCalcParticleFuncListNum++; + } + if (is_env_anm) { + mpCalcParticleFuncListNum++; + } + if (is_prm_anm || is_env_anm) { + mpCalcParticleFuncListNum++; + } + } else { + mpCalcParticleFuncListNum++; + } + + if (is_enable_scale_anm) { + if (mpBaseShape->getType() != 0) { + if (mpExtraShape->isScaleXYDiff()) { + if (mpExtraShape->getScaleAnmTypeX() == 0 && mpExtraShape->getScaleAnmTypeY() == 0) { + mpCalcParticleFuncListNum++; + } else { + mpCalcParticleFuncListNum++; + mpCalcParticleFuncListNum++; + } + } else { + mpCalcParticleFuncListNum++; + } + } + mpCalcParticleFuncListNum++; + mpCalcParticleFuncListNum++; + } + + if (mpCalcParticleFuncListNum != 0) { + mpCalcParticleFuncList = + (ParticleFunc*)JKRAllocFromHeap(heap, mpCalcParticleFuncListNum * 4, 4); + } + + func_no = 0; + + if (!is_glbl_tex_anm && is_tex_anm) { + switch (mpBaseShape->getTexAnmType()) { + case 0: + mpCalcParticleFuncList[func_no] = &JPACalcTexIdxNormal; + break; + case 1: + mpCalcParticleFuncList[func_no] = &JPACalcTexIdxRepeat; + break; + case 2: + mpCalcParticleFuncList[func_no] = &JPACalcTexIdxReverse; + break; + case 3: + mpCalcParticleFuncList[func_no] = &JPACalcTexIdxMerge; + break; + case 4: + mpCalcParticleFuncList[func_no] = &JPACalcTexIdxRandom; + break; + } + func_no++; + } + + if (!base_type_5_6 && (is_enable_alpha_anm || is_enable_alpha_flick)) { + if (is_enable_alpha_flick) { + mpCalcParticleFuncList[func_no] = &JPACalcAlphaFlickAnm; + func_no++; + } else { + mpCalcParticleFuncList[func_no] = &JPACalcAlphaAnm; + func_no++; + } + } + + if (!is_glbl_clr_anm) { + if (is_prm_anm) { + mpCalcParticleFuncList[func_no] = &JPACalcPrm; + func_no++; + } + if (is_env_anm) { + mpCalcParticleFuncList[func_no] = &JPACalcEnv; + func_no++; + } + if (is_prm_anm || is_env_anm) { + switch (mpBaseShape->getClrAnmType()) { + case 0: + mpCalcParticleFuncList[func_no] = &JPACalcClrIdxNormal; + break; + case 1: + mpCalcParticleFuncList[func_no] = &JPACalcClrIdxRepeat; + break; + case 2: + mpCalcParticleFuncList[func_no] = &JPACalcClrIdxReverse; + break; + case 3: + mpCalcParticleFuncList[func_no] = &JPACalcClrIdxMerge; + break; + case 4: + mpCalcParticleFuncList[func_no] = &JPACalcClrIdxRandom; + break; + } + func_no++; + } + } else { + mpCalcParticleFuncList[func_no] = &JPACalcColorCopy; + func_no++; + } + + if (is_enable_scale_anm) { + if (mpBaseShape->getType() != 0) { + if (mpExtraShape->isScaleXYDiff()) { + mpCalcParticleFuncList[func_no] = &JPACalcScaleY; + func_no++; + if (mpExtraShape->getScaleAnmTypeY() != 0 || mpExtraShape->getScaleAnmTypeX() != 0) { + switch (mpExtraShape->getScaleAnmTypeY()) { + case 0: + mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmNormal; + break; + case 1: + mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmRepeatY; + break; + case 2: + mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmReverseY; + break; + } + func_no++; + } + } else { + mpCalcParticleFuncList[func_no] = &JPACalcScaleCopy; + func_no++; + } + } + mpCalcParticleFuncList[func_no] = &JPACalcScaleX; + func_no++; + switch (mpExtraShape->getScaleAnmTypeX()) { + case 0: + mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmNormal; + break; + case 1: + mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmRepeatX; + break; + case 2: + mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmReverseX; + break; + } + } + + if (mpChildShape != NULL && mpChildShape->isScaleOutOn()) { + mpCalcParticleChildFuncListNum++; + } + + if (mpChildShape != NULL && mpChildShape->isAlphaOutOn()) { + mpCalcParticleChildFuncListNum++; + } + + if (mpCalcParticleChildFuncListNum != 0) { + mpCalcParticleChildFuncList = + (ParticleFunc*)JKRAllocFromHeap(heap, mpCalcParticleChildFuncListNum * 4, 4); + } + + func_no = 0; + + if (mpChildShape != NULL && mpChildShape->isScaleOutOn()) { + mpCalcParticleChildFuncList[func_no] = &JPACalcChildScaleOut; + func_no++; + } + + if (mpChildShape != NULL && mpChildShape->isAlphaOutOn()) { + mpCalcParticleChildFuncList[func_no] = &JPACalcChildAlphaOut; + } + + if (is_draw_parent && base_type_5_6) { + mpDrawEmitterFuncListNum++; + } + + mpDrawEmitterFuncListNum++; + + if (mpExTexShape != NULL) { + mpDrawEmitterFuncListNum++; + } + + if (is_glbl_tex_anm || !is_tex_anm) { + mpDrawEmitterFuncListNum++; + } + + mpDrawEmitterFuncListNum++; + + if (base_type_0_1) { + mpDrawEmitterFuncListNum++; + } + + if (base_type_0_1 && !is_enable_scale_anm) { + mpDrawEmitterFuncListNum++; + } + + if (is_glbl_clr_anm || (!is_prm_anm && !is_enable_alpha_anm) || !is_env_anm) { + mpDrawEmitterFuncListNum++; + } + + if (mpDrawEmitterFuncListNum != 0) { + mpDrawEmitterFuncList = + (EmitterFunc*)JKRAllocFromHeap(heap, mpDrawEmitterFuncListNum * 4, 4); + } + + func_no = 0; + + if (is_draw_parent && base_type_5_6) { + if (mpBaseShape->getType() == 5) { + mpDrawEmitterFuncList[func_no] = &JPADrawStripe; + func_no++; + } else { + mpDrawEmitterFuncList[func_no] = &JPADrawStripeX; + func_no++; + } + } + + mpDrawEmitterFuncList[func_no] = &JPADrawEmitterCallBackB; + func_no++; + + if (mpExTexShape != NULL) { + mpDrawEmitterFuncList[func_no] = &JPALoadExTex; + func_no++; + } + + if (!is_tex_anm) { + mpDrawEmitterFuncList[func_no] = &JPALoadTex; + func_no++; + } else if (is_glbl_tex_anm) { + mpDrawEmitterFuncList[func_no] = &JPALoadTexAnm; + func_no++; + } + + if (base_type_0_1) { + mpDrawEmitterFuncList[func_no] = &JPAGenTexCrdMtxIdt; + func_no++; + } else if (is_prj_tex) { + mpDrawEmitterFuncList[func_no] = &JPAGenTexCrdMtxPrj; + func_no++; + } else if (is_tex_crd_anm) { + if (base_type_5_6) { + mpDrawEmitterFuncList[func_no] = &JPAGenCalcTexCrdMtxAnm; + func_no++; + } else { + mpDrawEmitterFuncList[func_no] = &JPAGenTexCrdMtxAnm; + func_no++; + } + } else { + mpDrawEmitterFuncList[func_no] = &JPAGenTexCrdMtxIdt; + func_no++; + } + + if (base_type_0_1) { + mpDrawEmitterFuncList[func_no] = &JPALoadPosMtxCam; + func_no++; + } + + if (base_type_0_1 && !is_enable_scale_anm) { + if (base_type_0) { + mpDrawEmitterFuncList[func_no] = &JPASetPointSize; + func_no++; + } else { + mpDrawEmitterFuncList[func_no] = &JPASetLineWidth; + func_no++; + } + } + + if (is_glbl_clr_anm) { + if (base_type_5_6 || !is_enable_alpha_anm) { + mpDrawEmitterFuncList[func_no] = &JPARegistPrmEnv; + } else if (is_enable_alpha_anm) { + mpDrawEmitterFuncList[func_no] = &JPARegistEnv; + } + } else if (!is_prm_anm && !is_enable_alpha_anm) { + if (!is_env_anm) { + mpDrawEmitterFuncList[func_no] = &JPARegistPrmEnv; + } else { + mpDrawEmitterFuncList[func_no] = &JPARegistPrm; + } + } else if (!is_env_anm) { + mpDrawEmitterFuncList[func_no] = &JPARegistEnv; + } + + if (is_draw_child && child_type_5_6) { + mpDrawEmitterChildFuncListNum++; + } + + mpDrawEmitterChildFuncListNum++; + + if (child_type_0_1) { + mpDrawEmitterChildFuncListNum++; + } + + if (mpChildShape != NULL && !mpChildShape->isAlphaOutOn() && !mpChildShape->isAlphaInherited() + && !mpChildShape->isColorInherited()) { + mpDrawEmitterChildFuncListNum++; + } + + if (mpDrawEmitterChildFuncListNum != 0) { + mpDrawEmitterChildFuncList = + (EmitterFunc*)JKRAllocFromHeap(heap, mpDrawEmitterChildFuncListNum * 4, 4); + } + + func_no = 0; + + if (is_draw_child && child_type_5_6) { + if (mpChildShape->getType() == 5) { + mpDrawEmitterChildFuncList[func_no] = &JPADrawStripe; + func_no++; + } else { + mpDrawEmitterChildFuncList[func_no] = &JPADrawStripeX; + func_no++; + } + } + + mpDrawEmitterChildFuncList[func_no] = &JPADrawEmitterCallBackB; + func_no++; + + if (child_type_0_1) { + mpDrawEmitterChildFuncList[func_no] = &JPALoadPosMtxCam; + func_no++; + } + + if (mpChildShape != NULL && !mpChildShape->isAlphaOutOn() && !mpChildShape->isAlphaInherited() + && !mpChildShape->isColorInherited()) { + mpDrawEmitterChildFuncList[func_no] = &JPARegistChildPrmEnv; + } + + if (is_draw_parent && !base_type_5_6) { + mpDrawParticleFuncListNum++; + } + + mpDrawParticleFuncListNum++; + + if (!is_glbl_tex_anm && is_tex_anm) { + mpDrawParticleFuncListNum++; + } + + if ((base_type_0_1 && is_enable_scale_anm) || (is_tex_crd_anm && !is_prj_tex)) { + mpDrawParticleFuncListNum++; + } + + if ((!is_glbl_clr_anm && (is_prm_anm || is_env_anm || is_enable_alpha_anm)) + || (is_glbl_clr_anm && is_enable_alpha_anm && !base_type_5_6)) { + mpDrawParticleFuncListNum++; + } + + if (mpDrawParticleFuncListNum != 0) { + mpDrawParticleFuncList = + (ParticleFunc*)JKRAllocFromHeap(heap, mpDrawParticleFuncListNum * 4, 4); + } + + func_no = 0; + + if (is_draw_parent && !base_type_5_6) { + switch (mpBaseShape->getType()) { + case 2: + if (is_enable_rotate_anm) { + mpDrawParticleFuncList[func_no] = &JPADrawRotBillboard; + } else { + mpDrawParticleFuncList[func_no] = &JPADrawBillboard; + } + break; + case 10: + if (is_enable_rotate_anm) { + mpDrawParticleFuncList[func_no] = &JPADrawRotYBillboard; + } else { + mpDrawParticleFuncList[func_no] = &JPADrawYBillboard; + } + break; + case 3: + case 4: + if (is_enable_rotate_anm) { + mpDrawParticleFuncList[func_no] = &JPADrawRotDirection; + } else { + mpDrawParticleFuncList[func_no] = &JPADrawDirection; + } + break; + case 9: + mpDrawParticleFuncList[func_no] = &JPADrawDBillboard; + break; + case 7: + case 8: + mpDrawParticleFuncList[func_no] = &JPADrawRotation; + break; + case 0: + mpDrawParticleFuncList[func_no] = &JPADrawPoint; + break; + case 1: + mpDrawParticleFuncList[func_no] = &JPADrawLine; + break; + } + func_no++; + } + + mpDrawParticleFuncList[func_no] = &JPADrawParticleCallBack; + func_no++; + + if (!is_glbl_tex_anm && is_tex_anm) { + mpDrawParticleFuncList[func_no] = &JPALoadTexAnm; + func_no++; + } + + if (base_type_0_1 && is_enable_scale_anm) { + if (base_type_0) { + mpDrawParticleFuncList[func_no] = &JPASetPointSize; + func_no++; + } else { + mpDrawParticleFuncList[func_no] = &JPASetLineWidth; + func_no++; + } + } else if (is_tex_crd_anm && !is_prj_tex) { + mpDrawParticleFuncList[func_no] = &JPALoadCalcTexCrdMtxAnm; + func_no++; + } + + if (!is_glbl_clr_anm) { + if (is_prm_anm) { + if (is_env_anm) { + mpDrawParticleFuncList[func_no] = &JPARegistPrmAlphaEnv; + } else { + mpDrawParticleFuncList[func_no] = &JPARegistPrmAlpha; + } + } else if (is_enable_alpha_anm) { + if (is_env_anm) { + mpDrawParticleFuncList[func_no] = &JPARegistAlphaEnv; + } else { + mpDrawParticleFuncList[func_no] = &JPARegistAlpha; + } + } else if (is_env_anm) { + mpDrawParticleFuncList[func_no] = &JPARegistEnv; + } + } else if (is_enable_alpha_anm && !base_type_5_6) { + mpDrawParticleFuncList[func_no] = &JPARegistAlpha; + } + + if (is_draw_child && mpChildShape != NULL && !child_type_5_6) { + mpDrawParticleChildFuncListNum++; + } + + mpDrawParticleChildFuncListNum++; + + if (child_type_0_1) { + mpDrawParticleChildFuncListNum++; + } + + if (mpChildShape != NULL && (mpChildShape->isAlphaOutOn() || mpChildShape->isAlphaInherited() + || mpChildShape->isColorInherited())) { + mpDrawParticleChildFuncListNum++; + } + + if (mpDrawParticleChildFuncListNum != 0) { + mpDrawParticleChildFuncList = + (ParticleFunc*)JKRAllocFromHeap(heap, mpDrawParticleChildFuncListNum * 4, 4); + } + + func_no = 0; + + if (is_draw_child && mpChildShape != NULL && !child_type_5_6) { + switch (mpChildShape->getType()) { + case 2: + if (is_rotate_on) { + mpDrawParticleChildFuncList[func_no] = &JPADrawRotBillboard; + } else { + mpDrawParticleChildFuncList[func_no] = &JPADrawBillboard; + } + break; + case 10: + if (is_rotate_on) { + mpDrawParticleChildFuncList[func_no] = &JPADrawRotYBillboard; + } else { + mpDrawParticleChildFuncList[func_no] = &JPADrawYBillboard; + } + break; + case 3: + case 4: + if (is_rotate_on) { + mpDrawParticleChildFuncList[func_no] = &JPADrawRotDirection; + } else { + mpDrawParticleChildFuncList[func_no] = &JPADrawDirection; + } + break; + case 9: + mpDrawParticleChildFuncList[func_no] = &JPADrawDBillboard; + break; + case 7: + case 8: + mpDrawParticleChildFuncList[func_no] = &JPADrawRotation; + break; + case 0: + mpDrawParticleChildFuncList[func_no] = &JPADrawPoint; + break; + case 1: + mpDrawParticleChildFuncList[func_no] = &JPADrawLine; + break; + } + func_no++; + } + + mpDrawParticleChildFuncList[func_no] = &JPADrawParticleCallBack; + func_no++; + + if (child_type_0_1) { + if (child_type_0) { + mpDrawParticleChildFuncList[func_no] = &JPASetPointSize; + func_no++; + } else { + mpDrawParticleChildFuncList[func_no] = &JPASetLineWidth; + func_no++; + } + } + + if (mpChildShape != NULL && (mpChildShape->isAlphaOutOn() || mpChildShape->isAlphaInherited() + || mpChildShape->isColorInherited())) { + mpDrawParticleChildFuncList[func_no] = &JPARegistPrmAlphaEnv; + } +} + +/* 802755E8-80275A94 26FF28 04AC+00 0/0 1/1 0/0 .text + * calc__11JPAResourceFP18JPAEmitterWorkDataP14JPABaseEmitter */ +bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) { + work->mpEmtr = emtr; + work->mpRes = this; + work->mEmitCount = 0; + + if (!emtr->processTillStartFrame()) { + return false; + } + + if (emtr->processTermination()) { + return true; + } + + if (emtr->checkStatus(2)) { + if (emtr->mpEmtrCallBack != NULL) { + emtr->mpEmtrCallBack->execute(emtr); + if (emtr->checkStatus(0x100)) { + return true; + } + emtr->mpEmtrCallBack->executeAfter(emtr); + if (emtr->checkStatus(0x100)) { + return true; + } + } + + } else { + calcKey(work); + + for (int i = mFieldBlockNum - 1; i >= 0; i--) { + mpFieldBlocks[i]->initOpParam(); + } + + if (emtr->mpEmtrCallBack != NULL) { + emtr->mpEmtrCallBack->execute(emtr); + if (emtr->checkStatus(0x100)) { + return true; + } + } + + calcWorkData_c(work); + + for (int i = mpCalcEmitterFuncListNum - 1; i >= 0; i--) { + (*mpCalcEmitterFuncList[i])(work); + } + + for (int i = mFieldBlockNum - 1; i >= 0; i--) { + mpFieldBlocks[i]->prepare(work); + } + + if (!emtr->checkStatus(8)) { + mpDynamicsBlock->create(work); + } + + if (emtr->mpEmtrCallBack != NULL) { + emtr->mpEmtrCallBack->executeAfter(emtr); + if (emtr->checkStatus(0x100)) { + return true; + } + } + + JPANode<JPABaseParticle>* node = emtr->mAlivePtclBase.getFirst(); + JPANode<JPABaseParticle>* next; + while (node != emtr->mAlivePtclBase.getEnd()) { + next = node->getNext(); + if (node->getObject()->calc_p(work)) { + emtr->mpPtclPool->push_front(emtr->mAlivePtclBase.erase(node)); + } + node = next; + } + + node = emtr->mAlivePtclChld.getFirst(); + while (node != emtr->mAlivePtclChld.getEnd()) { + next = node->getNext(); + if (node->getObject()->calc_c(work)) { + emtr->mpPtclPool->push_front(emtr->mAlivePtclChld.erase(node)); + } + node = next; + } + + emtr->mTick++; + } + + return false; +} + +/* 80275A94-80275B74 2703D4 00E0+00 0/0 1/1 0/0 .text + * draw__11JPAResourceFP18JPAEmitterWorkDataP14JPABaseEmitter */ +void JPAResource::draw(JPAEmitterWorkData* work, JPABaseEmitter* emtr) { + work->mpEmtr = emtr; + work->mpRes = this; + work->mDrawCount = 0; + calcWorkData_d(work); + mpBaseShape->setGX(work); + for (s32 i = 1; i <= emtr->getDrawTimes(); i++) { + work->mDrawCount++; + if (mpBaseShape->isDrawPrntAhead() && mpChildShape != NULL) + drawC(work); + drawP(work); + if (!mpBaseShape->isDrawPrntAhead() && mpChildShape != NULL) + drawC(work); + } +} + +/* 80275B74-80275EB0 2704B4 033C+00 1/1 0/0 0/0 .text drawP__11JPAResourceFP18JPAEmitterWorkData + */ +void JPAResource::drawP(JPAEmitterWorkData* work) { + work->mpEmtr->clearStatus(0x80); + + work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * mpBaseShape->getBaseSizeX(); + work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * mpBaseShape->getBaseSizeY(); + + if (mpBaseShape->getType() == 0) { + work->mGlobalPtclScl.x *= 1.02f; + } else if (mpBaseShape->getType() == 1) { + work->mGlobalPtclScl.x *= 1.02f; + work->mGlobalPtclScl.y *= 0.4f; + } + + if (mpExtraShape != NULL && mpExtraShape->isEnableScaleAnm()) { + work->mPivot.x = mpExtraShape->getScaleCenterX() - 1.0f; + work->mPivot.y = mpExtraShape->getScaleCenterY() - 1.0f; + } else { + work->mPivot.x = work->mPivot.y = 0.0f; + } + + work->mDirType = mpBaseShape->getDirType(); + work->mRotType = mpBaseShape->getRotType(); + work->mDLType = mpBaseShape->getType() == 4 || mpBaseShape->getType() == 8; + work->mPlaneType = work->mDLType ? 2 : mpBaseShape->getBasePlaneType(); + work->mPrjType = mpBaseShape->isPrjTex() ? (mpBaseShape->isTexCrdAnm() ? 2 : 1) : 0; + + work->mpAlivePtcl = &work->mpEmtr->mAlivePtclBase; + setPTev(); + + for (int i = mpDrawEmitterFuncListNum - 1; i >= 0; i--) { + (*mpDrawEmitterFuncList[i])(work); + } + + if (mpBaseShape->isDrawFwdAhead()) { + JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclBase.getLast(); + for (; node != work->mpEmtr->mAlivePtclBase.getEnd(); node = node->getPrev()) { + work->mpCurNode = node; + if (mpDrawParticleFuncList != NULL) { + for (int i = mpDrawParticleFuncListNum - 1; i >= 0; i--) { + (*mpDrawParticleFuncList[i])(work, node->getObject()); + } + } + } + } else { + JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclBase.getFirst(); + for (; node != work->mpEmtr->mAlivePtclBase.getEnd(); node = node->getNext()) { + work->mpCurNode = node; + if (mpDrawParticleFuncList != NULL) { + for (int i = mpDrawParticleFuncListNum - 1; i >= 0; i--) { + (*mpDrawParticleFuncList[i])(work, node->getObject()); + } + } + } + } + + GXSetMisc(GX_MT_XF_FLUSH, 0); + + if (work->mpEmtr->mpEmtrCallBack != NULL) { + work->mpEmtr->mpEmtrCallBack->drawAfter(work->mpEmtr); + } +} + +/* 80275EB0-802761A8 2707F0 02F8+00 1/1 0/0 0/0 .text drawC__11JPAResourceFP18JPAEmitterWorkData + */ +void JPAResource::drawC(JPAEmitterWorkData* work) { + work->mpEmtr->setStatus(0x80); + + if (mpChildShape->isScaleInherited()) { + work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * mpBaseShape->getBaseSizeX(); + work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * mpBaseShape->getBaseSizeY(); + } else { + work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * mpChildShape->getScaleX(); + work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * mpChildShape->getScaleY(); + } + + if (mpChildShape->getType() == 0) { + work->mGlobalPtclScl.x *= 1.02f; + } else if (mpChildShape->getType() == 1) { + work->mGlobalPtclScl.x *= 1.02f; + work->mGlobalPtclScl.y *= 0.4f; + } + + work->mPivot.x = work->mPivot.y = 0.0f; + + work->mDirType = mpChildShape->getDirType(); + work->mRotType = mpChildShape->getRotType(); + work->mDLType = mpChildShape->getType() == 4 || mpChildShape->getType() == 8; + work->mPlaneType = work->mDLType ? 2 : mpChildShape->getBasePlaneType(); + work->mPrjType = 0; + + work->mpAlivePtcl = &work->mpEmtr->mAlivePtclChld; + setCTev(work); + + for (int i = mpDrawEmitterChildFuncListNum - 1; i >= 0; i--) { + (*mpDrawEmitterChildFuncList[i])(work); + } + + if (mpBaseShape->isDrawFwdAhead()) { + JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclChld.getLast(); + for (; node != work->mpEmtr->mAlivePtclChld.getEnd(); node = node->getPrev()) { + work->mpCurNode = node; + if (mpDrawParticleChildFuncList != NULL) { + for (int i = mpDrawParticleChildFuncListNum - 1; i >= 0; i--) { + (*mpDrawParticleChildFuncList[i])(work, node->getObject()); + } + } + } + } else { + JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclChld.getFirst(); + for (; node != work->mpEmtr->mAlivePtclChld.getEnd(); node = node->getNext()) { + work->mpCurNode = node; + if (mpDrawParticleChildFuncList != NULL) { + for (int i = mpDrawParticleChildFuncListNum - 1; i >= 0; i--) { + (*mpDrawParticleChildFuncList[i])(work, node->getObject()); + } + } + } + } + + GXSetMisc(GX_MT_XF_FLUSH, 0); + + if (work->mpEmtr->mpEmtrCallBack != NULL) { + work->mpEmtr->mpEmtrCallBack->drawAfter(work->mpEmtr); + } +} + +/* 802761A8-8027642C 270AE8 0284+00 1/1 0/0 0/0 .text setPTev__11JPAResourceFv */ +void JPAResource::setPTev() { + GXTexCoordID tex_coord = GX_TEXCOORD1; + u8 tev_stages = 1; + u8 tex_gens = 1; + u8 ind_stages = 0; + + int base_plane_type = (mpBaseShape->getType() == 3 || mpBaseShape->getType() == 7) ? + mpBaseShape->getBasePlaneType() : 0; + int center_offset; + if (mpExtraShape != NULL) { + center_offset = + (mpExtraShape->getScaleCenterX() + 3 * mpExtraShape->getScaleCenterY()) * 0xC; + } else { + center_offset = 0x30; + } + int pos_offset = center_offset + base_plane_type * 0x6C; + int crd_offset = (mpBaseShape->getTilingS() + 2 * mpBaseShape->getTilingT()) * 8; + GXSetArray(GX_VA_POS, jpa_pos + pos_offset, 3); + GXSetArray(GX_VA_TEX0, jpa_crd + crd_offset, 2); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + + if (mpExTexShape != NULL) { + if (mpExTexShape->isUseIndirect()) { + GXSetIndTexOrder(GX_INDTEXSTAGE0, GX_TEXCOORD1, GX_TEXMAP2); + GXSetIndTexCoordScale(GX_INDTEXSTAGE0, GX_ITS_1, GX_ITS_1); + GXSetIndTexMtx(GX_ITM_0, (f32(*)[3])mpExTexShape->getIndTexMtx(), mpExTexShape->getExpScale()); + GXSetTevIndirect(GX_TEVSTAGE0, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_STU, GX_ITM_0, + GX_ITW_OFF, GX_ITW_OFF, 0, 0, GX_ITBA_OFF); + ind_stages++; + tex_gens++; + tex_coord = GX_TEXCOORD2; + } + if (mpExTexShape->isUseSecTex()) { + GXSetTevOrder(GX_TEVSTAGE1, tex_coord, GX_TEXMAP3, GX_COLOR_NULL); + GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_TEXC, GX_CC_CPREV, GX_CC_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO); + GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + tev_stages++; + tex_gens++; + } + } + + GXSetNumTevStages(tev_stages); + GXSetNumIndStages(ind_stages); + if (mpBaseShape->isClipOn()) { + GXSetMisc(GX_MT_XF_FLUSH, 8); + GXSetClipMode(GX_CLIP_ENABLE); + } else { + GXSetClipMode(GX_CLIP_DISABLE); + } + GXSetNumTexGens(tex_gens); +} + +/* 8027642C-8027658C 270D6C 0160+00 1/1 0/0 0/0 .text setCTev__11JPAResourceFP18JPAEmitterWorkData + */ +void JPAResource::setCTev(JPAEmitterWorkData* work) { + int base_plane_type = (mpChildShape->getType() == 3 || mpChildShape->getType() == 7) ? + mpChildShape->getBasePlaneType() : 0; + int pos_offset = 0x30 + base_plane_type * 0x6C; + GXSetArray(GX_VA_POS, jpa_pos + pos_offset, 3); + GXSetArray(GX_VA_TEX0, jpa_crd, 2); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP1, GX_COLOR_NULL); + GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3C); + GXSetTevDirect(GX_TEVSTAGE0); + GXSetNumTevStages(1); + GXSetNumIndStages(0); + if (mpChildShape->isClipOn()) { + GXSetMisc(GX_MT_XF_FLUSH, 8); + GXSetClipMode(GX_CLIP_ENABLE); + } else { + GXSetClipMode(GX_CLIP_DISABLE); + } + GXSetNumTexGens(1); + work->mpResMgr->load(work->mpRes->getTexIdx(mpChildShape->getTexIdx()), GX_TEXMAP1); +} + +/* 8027658C-80276608 270ECC 007C+00 0/0 1/1 0/0 .text + * calc_p__11JPAResourceFP18JPAEmitterWorkDataP15JPABaseParticle */ +void JPAResource::calc_p(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { + if (mpCalcParticleFuncList != NULL) { + for (int i = mpCalcParticleFuncListNum - 1; i >= 0; i--) { + (*mpCalcParticleFuncList[i])(work, ptcl); + } + } +} + +/* 80276608-80276684 270F48 007C+00 0/0 1/1 0/0 .text + * calc_c__11JPAResourceFP18JPAEmitterWorkDataP15JPABaseParticle */ +void JPAResource::calc_c(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { + if (mpCalcParticleChildFuncList != NULL) { + for (int i = mpCalcParticleChildFuncListNum - 1; i >= 0; i--) { + (*mpCalcParticleChildFuncList[i])(work, ptcl); + } + } +} + +/* 80276684-80276700 270FC4 007C+00 0/0 2/2 0/0 .text + * calcField__11JPAResourceFP18JPAEmitterWorkDataP15JPABaseParticle */ +void JPAResource::calcField(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { + for (int i = mFieldBlockNum - 1; i >= 0; i--) { + mpFieldBlocks[i]->calc(work, ptcl); + } +} + +/* 80276700-80276840 271040 0140+00 2/1 0/0 0/0 .text calcKey__11JPAResourceFP18JPAEmitterWorkData + */ +void JPAResource::calcKey(JPAEmitterWorkData* work) { + for (int i = mKeyBlockNum - 1; i >= 0; i--) { + f32 val = mpKeyBlocks[i]->calc(work->mpEmtr->mTick); + switch (mpKeyBlocks[i]->getID()) { + case 0: + work->mpEmtr->mRate = val; + break; + case 1: + work->mpEmtr->mVolumeSize = val; + break; + case 3: + work->mpEmtr->mVolumeMinRad = val; + break; + case 4: + work->mpEmtr->mLifeTime = val; + break; + case 6: + work->mpEmtr->mAwayFromCenterSpeed = val; + break; + case 7: + work->mpEmtr->mAwayFromAxisSpeed = val; + break; + case 8: + work->mpEmtr->mDirSpeed = val; + break; + case 9: + work->mpEmtr->mSpread = val; + break; + case 10: + work->mpEmtr->mScaleOut = val; + break; + } + } +} + +/* 80276840-80276A0C 271180 01CC+00 1/1 0/0 0/0 .text + * calcWorkData_c__11JPAResourceFP18JPAEmitterWorkData */ +void JPAResource::calcWorkData_c(JPAEmitterWorkData* work) { + work->mVolumeSize = work->mpEmtr->mVolumeSize; + work->mVolumeMinRad = work->mpEmtr->mVolumeMinRad; + work->mVolumeSweep = work->mpEmtr->mVolumeSweep; + work->mVolumeX = 0; + work->mVolumeAngleNum = 0; + work->mVolumeAngleMax = 1; + work->mDivNumber = mpDynamicsBlock->getDivNumber() * 2 + 1; + Mtx local_scl_mtx, local_rot_mtx, global_mtx; + MTXScale(local_scl_mtx, work->mpEmtr->mLocalScl.x, work->mpEmtr->mLocalScl.y, + work->mpEmtr->mLocalScl.z); + JPAGetXYZRotateMtx(work->mpEmtr->mLocalRot.x * 182, work->mpEmtr->mLocalRot.y * 182, + work->mpEmtr->mLocalRot.z * 182, local_rot_mtx); + MTXScale(global_mtx, work->mpEmtr->mGlobalScl.x, work->mpEmtr->mGlobalScl.y, + work->mpEmtr->mGlobalScl.z); + MTXConcat(work->mpEmtr->mGlobalRot, global_mtx, global_mtx); + global_mtx[0][3] = work->mpEmtr->mGlobalTrs.x; + global_mtx[1][3] = work->mpEmtr->mGlobalTrs.y; + global_mtx[2][3] = work->mpEmtr->mGlobalTrs.z; + MTXCopy(work->mpEmtr->mGlobalRot, work->mRotationMtx); + MTXConcat(work->mRotationMtx, local_rot_mtx, work->mGlobalRot); + MTXConcat(work->mGlobalRot, local_scl_mtx, work->mGlobalSR); + work->mEmitterPos.set(work->mpEmtr->mLocalTrs); + work->mGlobalScl.mul(work->mpEmtr->mGlobalScl, work->mpEmtr->mLocalScl); + JPAGetDirMtx(work->mpEmtr->mLocalDir, work->mDirectionMtx); + work->mPublicScale.set(work->mpEmtr->mGlobalScl); + MTXMultVec(global_mtx, &work->mpEmtr->mLocalTrs, &work->mGlobalPos); +} + +/* 80276A0C-80276A8C 27134C 0080+00 1/1 0/0 0/0 .text + * calcWorkData_d__11JPAResourceFP18JPAEmitterWorkData */ +void JPAResource::calcWorkData_d(JPAEmitterWorkData* work) { + Mtx mtx; + JPAGetXYZRotateMtx(work->mpEmtr->mLocalRot.x * 0xB6, work->mpEmtr->mLocalRot.y * 0xB6, + work->mpEmtr->mLocalRot.z * 0xB6, mtx); + MTXConcat(work->mpEmtr->mGlobalRot, mtx, work->mGlobalRot); + MTXMultVecSR(work->mGlobalRot, &work->mpEmtr->mLocalDir, &work->mGlobalEmtrDir); +} + +#pragma push +#pragma force_active on +static u8 jpa_resource_padding[28] = {0}; +#pragma pop |
