mirror of
https://github.com/zeldaret/ss
synced 2026-09-02 01:43:04 -04:00
Refactoring
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "toBeSorted/time_area_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(BOMBF, dAcBombf_c, fProfile::BOMBF, 0x129, 0, 4099);
|
||||
@@ -166,7 +167,6 @@ void dAcBombf_c::regrowBomb() {
|
||||
|
||||
void dAcBombf_c::initializeState_Wait() {}
|
||||
|
||||
extern "C" void fn_800298B0(u16, mVec3_c *, mVec3_c *, u32, u32, u32, u32, u32);
|
||||
extern "C" u16 lbl_8057A750;
|
||||
|
||||
void dAcBombf_c::executeState_Wait() {
|
||||
@@ -191,11 +191,11 @@ void dAcBombf_c::executeState_Wait() {
|
||||
|
||||
if (mTimeAreaStruct.check(roomid, m3, 0, 30.0f, 0.1f) && field_0x3D4 != 1) {
|
||||
if (mTimeAreaStruct.field_0x04 == 1) {
|
||||
playSound(0xC0A);
|
||||
playSound(SE_TIMESLIP_TIMESLIP);
|
||||
} else {
|
||||
playSound(0xC0B);
|
||||
playSound(SE_TIMESLIP_TIMESLIP_REV);
|
||||
}
|
||||
fn_800298B0(lbl_8057A750, &position, nullptr, 0, 0, 0, 0, 0);
|
||||
dJEffManager_c::spawnEffect(lbl_8057A750, position, nullptr, nullptr, nullptr, nullptr, 0, 0);
|
||||
}
|
||||
|
||||
scaleFactor *= mTimeAreaStruct.field_0x00;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "d/a/d_a_t_wood_area.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
|
||||
const f32 dAcTWoodArea_c::scaleX = 100.0f;
|
||||
const f32 dAcTWoodArea_c::scaleY = 100.0f;
|
||||
@@ -48,8 +50,7 @@ void dAcTWoodArea_c::executeState_Init() {
|
||||
}
|
||||
void dAcTWoodArea_c::finalizeState_Init() {}
|
||||
|
||||
extern "C" void fn_800298B0(u16, mVec3_c *, mAng3_c *, u32, u32, u32, u32, u32);
|
||||
extern u16 PARTICLE_RESOURCE_ID_MAPPING[];
|
||||
extern const u16 PARTICLE_RESOURCE_ID_MAPPING_8_;
|
||||
|
||||
void dAcTWoodArea_c::initializeState_Wait() {}
|
||||
|
||||
@@ -63,7 +64,9 @@ void dAcTWoodArea_c::executeState_Wait() {
|
||||
bool someEffectThing = subtype != 1 ? (params & 0xF) != 0 ? false : true : true;
|
||||
if (someEffectThing) {
|
||||
mVec3_c tmp(position.x, position.y + getAttachHeight(), position.z);
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING[8], &tmp, nullptr, 0, 0, 0, 0, 0);
|
||||
dJEffManager_c::spawnEffect(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_8_, tmp, nullptr, nullptr, nullptr, nullptr, 0, 0
|
||||
);
|
||||
}
|
||||
dropItems();
|
||||
}
|
||||
|
||||
@@ -449,7 +449,6 @@ void dAcOtubo_c::finalizeState_Rebirth() {
|
||||
setActorProperty(0x1);
|
||||
}
|
||||
|
||||
extern "C" dEmitterBase_c *fn_800298B0(u16, mVec3_c *, mVec3_c *, u32, u32, u32, u32, u32);
|
||||
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_109_, PARTICLE_RESOURCE_ID_MAPPING_209_;
|
||||
extern "C" void fn_80022BE0(void *, const mVec3_c &);
|
||||
|
||||
@@ -465,11 +464,11 @@ void dAcOtubo_c::destroy() {
|
||||
fn_80022BE0(BlurAndPaletteManager::GetPInstance(), position);
|
||||
mActorCarryInfo.fn_80050EA0(this);
|
||||
|
||||
dEmitterBase_c *fx_thing = fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_209_, &poscopy2, nullptr, 0, 0, 0, 0, 0);
|
||||
dEmitterBase_c *fx_thing = dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_209_, poscopy2, nullptr, nullptr, nullptr, nullptr, 0, 0);
|
||||
if (fx_thing) {
|
||||
fx_thing->attachEmitterCallbackId(mSubtype != 0 ? dJEffManager_c::TsuboB : dJEffManager_c::TsuboA);
|
||||
}
|
||||
fx_thing = fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_109_, &position, nullptr, 0, 0, 0, 0, 0);
|
||||
fx_thing = dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_109_, position, nullptr, nullptr, nullptr, nullptr, 0, 0);
|
||||
if (fx_thing) {
|
||||
fx_thing->bindShpEmitter(mSubtype != 0 ? dJEffManager_c::TsuboB : dJEffManager_c::TsuboA, false);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "s/s_Math.h"
|
||||
#include "toBeSorted/blur_and_palette_manager.h"
|
||||
#include "toBeSorted/dowsing_target.h"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
void float_ordering() {
|
||||
const f32 arr[] = {5.f, 15.f, 7.f, 0.5f, 0.1f};
|
||||
@@ -260,12 +262,11 @@ bool dAcOTumbleWeed_c::checkInvalidGround() const {
|
||||
}
|
||||
|
||||
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_743_;
|
||||
extern "C" void fn_800298B0(u16, mVec3_c *, mAng3_c *, u32, u32, u32, u32, u32);
|
||||
|
||||
void dAcOTumbleWeed_c::doBreak() {
|
||||
playSound(0xC2D); // TODO(Sound Id)
|
||||
playSound(SE_TWeed_CUT);
|
||||
mVec3_c pos = getPosition();
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_743_, &pos, nullptr, 0, 0, 0, 0, 0);
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_743_, pos, nullptr, nullptr, nullptr, nullptr, 0, 0);
|
||||
deleteRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/attention.h"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
extern "C" void fn_800298B0(u16, mVec3_c *, mVec3_c *, u32, u32, u32, u32, u32);
|
||||
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_394_;
|
||||
|
||||
void dAcOInsect_c::kill() {
|
||||
// Small Ordering issue between loading particle id and position
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_394_, &position, nullptr, 0, 0, 0, 0, 0);
|
||||
playSound(0x1236); // TODO (Sound ID)
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_394_, position, nullptr, nullptr, nullptr, nullptr, 0, 0);
|
||||
playSound(SE_Insect_DISAPPEAR); // TODO (Sound ID)
|
||||
deleteRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "s/s_Math.h"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_SW, dAcOsw_c, fProfile::OBJ_SW, 0x12B, 0, 0x1002);
|
||||
|
||||
@@ -144,7 +146,6 @@ int dAcOsw_c::doDelete() {
|
||||
}
|
||||
|
||||
extern "C" u16 PARTICLE_RESOURCE_ID_MAPPING_754_;
|
||||
extern "C" void fn_800298B0(u16, mVec3_c *, mAng3_c *, u32, u32, u32, u32, u32);
|
||||
|
||||
int dAcOsw_c::actorExecute() {
|
||||
mStateMgr.executeState();
|
||||
@@ -153,8 +154,8 @@ int dAcOsw_c::actorExecute() {
|
||||
if (field_0x5A0.field_0x00 <= 0.0f) {
|
||||
if (mScale.x >= 1.0f) {
|
||||
if (!mHidden) {
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_754_, &position, &rotation, 0, 0, 0, 0, 0);
|
||||
playSound(0xC0B);
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_754_, position, &rotation, nullptr, nullptr, nullptr, 0, 0);
|
||||
playSound(SE_TIMESLIP_TIMESLIP_REV);
|
||||
mHidden = true;
|
||||
}
|
||||
} else {
|
||||
@@ -166,8 +167,8 @@ int dAcOsw_c::actorExecute() {
|
||||
} else {
|
||||
if (mScale.x <= 0.0f) {
|
||||
if (!mShown) {
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_754_, &position, &rotation, 0, 0, 0, 0, 0);
|
||||
playSound(0xC0A);
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_754_, position, &rotation, nullptr, nullptr, nullptr, 0, 0);
|
||||
playSound(SE_TIMESLIP_TIMESLIP);
|
||||
mShown = true;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1933,14 +1933,13 @@ void dAcTbox_c::executeState_LoadArchive() {
|
||||
}
|
||||
void dAcTbox_c::finalizeState_LoadArchive() {}
|
||||
|
||||
extern "C" void fn_800298B0(u16 effectIndex, mVec3_c *, mAng3_c *, mVec3_c *, void *, void *, void *, void *);
|
||||
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_209_;
|
||||
extern "C" const bool isPouchItem(u16);
|
||||
extern "C" dAcItem_c *giveItem3(u16 item, s32);
|
||||
|
||||
void dAcTbox_c::initializeState_Open() {
|
||||
mScale.set(1.0f, 1.0f, 1.0f);
|
||||
playSound(0xA36);
|
||||
playSound(SE_TBox_OPEN_A);
|
||||
clearActorProperty(0x100);
|
||||
if (mVariant == NORMAL) {
|
||||
mAnmMatClr1.setFrame(mAnmMatClr1.getFrameMax(0), 0);
|
||||
@@ -1957,7 +1956,7 @@ void dAcTbox_c::initializeState_Open() {
|
||||
mVec3_c pos;
|
||||
fn_8026B380(pos);
|
||||
mVec3_c p2 = fn_8026B3C0();
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_209_, &pos, &rotation, &p2, nullptr, nullptr, nullptr, nullptr);
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_209_, pos, &rotation, &p2, nullptr, nullptr, 0, 0);
|
||||
}
|
||||
fn_8026D140();
|
||||
ITEM_ID itemId = mItemId != 0 ? (ITEM_ID)mItemId : ITEM_GODDESS_HARP;
|
||||
@@ -2377,7 +2376,7 @@ void dAcTbox_c::unregisterDowsing() {
|
||||
extern "C" u16 PARTICLE_RESOURCE_ID_MAPPING_208_;
|
||||
|
||||
void dAcTbox_c::spawnAppearEffect() {
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_208_, &position, &rotation, nullptr, nullptr, nullptr, nullptr, nullptr);
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_208_, position, &rotation, nullptr, nullptr, nullptr, 0, 0);
|
||||
}
|
||||
|
||||
bool dAcTbox_c::checkIsClear() const {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_WATER_SPOUT, dAcOwaterSpout_c, fProfile::OBJ_WATER_SPOUT, 0x1DA, 0, 6);
|
||||
|
||||
@@ -59,14 +60,13 @@ int dAcOwaterSpout_c::draw() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
extern "C" void fn_800298B0(u16, mVec3_c *, mVec3_c *, mVec3_c *, u32, u32, u32, u32);
|
||||
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_213_;
|
||||
|
||||
void dAcOwaterSpout_c::initializeState_Wait() {
|
||||
if (params == 1) {
|
||||
return;
|
||||
}
|
||||
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_213_, &position, nullptr, &mScale, 0, 0, 0, 0);
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_213_, position, nullptr, &mScale, nullptr, nullptr, 0, 0);
|
||||
}
|
||||
void dAcOwaterSpout_c::executeState_Wait() {
|
||||
if (mMdl.getAnm().isStop()) {
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ int dBase_c::preExecute() {
|
||||
if (fBase_c::preExecute() == 0) {
|
||||
return NOT_READY;
|
||||
}
|
||||
if (s_ExecuteControlFlags && !isProcControlFlag(s_ExecuteControlFlags)) {
|
||||
if (s_ExecuteControlFlags && !isBasePropertyFlag(s_ExecuteControlFlags)) {
|
||||
return NOT_READY;
|
||||
}
|
||||
return SUCCEEDED;
|
||||
@@ -41,7 +41,7 @@ int dBase_c::preDraw() {
|
||||
if (fBase_c::preDraw() == NOT_READY) {
|
||||
return NOT_READY;
|
||||
}
|
||||
if (s_DrawControlFlags && !isProcControlFlag(s_DrawControlFlags)) {
|
||||
if (s_DrawControlFlags && !isBasePropertyFlag(s_DrawControlFlags)) {
|
||||
return NOT_READY;
|
||||
}
|
||||
return SUCCEEDED;
|
||||
|
||||
@@ -722,7 +722,7 @@ void dLytMeterDowsing_c::executeState_DemoMove() {
|
||||
idx = i + DOWSING_PANE_ITEM_OFFSET;
|
||||
nw4r::math::MTX34 mtx = mpPanes[idx]->GetGlobalMtx();
|
||||
mVec3_c pos(mtx._03, mtx._13, 0.0f);
|
||||
EffectsStruct::fn_800298C0(PARTICLE_RESOURCE_ID_MAPPING_970_, &pos, nullptr, nullptr, nullptr, nullptr);
|
||||
dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_970_, pos, nullptr, nullptr, nullptr, nullptr);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_DOWSING_ADD);
|
||||
}
|
||||
} else if (mDemoFrame == 16) {
|
||||
|
||||
@@ -287,7 +287,7 @@ void dLytMeterHeart_c::executeInternal() {
|
||||
if (mEffectHeartIdx >= 0) {
|
||||
nw4r::math::MTX34 mtx = mpHeartPanes[mEffectHeartIdx]->GetGlobalMtx();
|
||||
mVec3_c pos(mtx._03, mtx._13, 0.0f);
|
||||
EffectsStruct::fn_800298C0(PARTICLE_RESOURCE_ID_MAPPING_972_, &pos, nullptr, nullptr, nullptr, nullptr);
|
||||
dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_972_, pos, nullptr, nullptr, nullptr, nullptr);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_HEART_ADD);
|
||||
mEffectHeartIdx = -1;
|
||||
}
|
||||
|
||||
@@ -1410,7 +1410,7 @@ void dLytMeterItemSelect_c::executeState_DemoMove() {
|
||||
|
||||
nw4r::math::MTX34 mtx = mpPanes[i + ITEM_SELECT_PANE_ICON_OFFSET]->GetGlobalMtx();
|
||||
mVec3_c pos(mtx._03, mtx._13, 0.0f);
|
||||
EffectsStruct::fn_800298C0(PARTICLE_RESOURCE_ID_MAPPING_740_, &pos, nullptr, nullptr, nullptr, nullptr);
|
||||
dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_740_, pos, nullptr, nullptr, nullptr, nullptr);
|
||||
|
||||
if (mIsBocoburinLocked[i]) {
|
||||
mIsBocoburinLocked[i] = false;
|
||||
|
||||
@@ -391,16 +391,16 @@ void LytMeterTimerPart1_c::createEffect(s32 fruitIndex) {
|
||||
pos.x = mtx._03;
|
||||
pos.y = mtx._13;
|
||||
pos.z = 0.0f;
|
||||
EffectsStruct::fn_800298C0(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_135_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_CIRCLE],
|
||||
dJEffManager_c::spawnUIEffect(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_135_, pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_CIRCLE],
|
||||
&mColors2[TIMER_01_COLOR_01_CIRCLE]
|
||||
);
|
||||
EffectsStruct::fn_800298C0(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_136_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_SHADOW],
|
||||
dJEffManager_c::spawnUIEffect(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_136_, pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_SHADOW],
|
||||
&mColors2[TIMER_01_COLOR_01_SHADOW]
|
||||
);
|
||||
EffectsStruct::fn_800298C0(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_137_, &pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE],
|
||||
dJEffManager_c::spawnUIEffect(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_137_, pos, nullptr, nullptr, &mColors1[TIMER_01_COLOR_00_RAINBOW_CIRCLE],
|
||||
&mColors2[TIMER_01_COLOR_01_RAINBOW_CIRCLE]
|
||||
);
|
||||
}
|
||||
@@ -1000,8 +1000,8 @@ void LytMeterTimerPart2_c::createSingleFruitEffect() {
|
||||
pos.x = mtx._03;
|
||||
pos.y = mtx._13;
|
||||
pos.z = 0.0f;
|
||||
EffectsStruct::fn_800298C0(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_174_, &pos, nullptr, nullptr, &mColors1[TIMER_02_COLOR_00_00],
|
||||
dJEffManager_c::spawnUIEffect(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_174_, pos, nullptr, nullptr, &mColors1[TIMER_02_COLOR_00_00],
|
||||
&mColors2[TIMER_02_COLOR_01_00]
|
||||
);
|
||||
}
|
||||
@@ -1012,8 +1012,8 @@ void LytMeterTimerPart2_c::createFruitCompleteEffect() {
|
||||
pos.x = mtx._03;
|
||||
pos.y = mtx._13;
|
||||
pos.z = 0.0f;
|
||||
EffectsStruct::fn_800298C0(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_206_, &pos, nullptr, nullptr, &mColors1[TIMER_02_COLOR_00_01],
|
||||
dJEffManager_c::spawnUIEffect(
|
||||
PARTICLE_RESOURCE_ID_MAPPING_206_, pos, nullptr, nullptr, &mColors1[TIMER_02_COLOR_00_01],
|
||||
&mColors2[TIMER_02_COLOR_01_01]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ void EggTextureProc::doDraw() {}
|
||||
|
||||
void EggTextureProc::doRemove() {}
|
||||
|
||||
bool EggTextureProc::create(int prioOpa, int prioXlu, mAllocator_c *alloc) {
|
||||
bool UnkProc::create(int prioOpa, int prioXlu, mAllocator_c *alloc) {
|
||||
if (!m3d::proc_c::create(alloc, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
@@ -390,7 +390,7 @@ bool EggTextureProc::create(int prioOpa, int prioXlu, mAllocator_c *alloc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EggTextureProc::createXlu(int prioXlu, mAllocator_c *alloc) {
|
||||
bool UnkProc::createXlu(int prioXlu, mAllocator_c *alloc) {
|
||||
if (!m3d::proc_c::create(alloc, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+250
-12
@@ -2,10 +2,13 @@
|
||||
#include "JSystem/JParticle/JPAEmitter.h"
|
||||
#include "c/c_math.h"
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_base.h"
|
||||
#include "d/d_base.h"
|
||||
#include "d/d_heap.h"
|
||||
#include "d/d_stage.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_allocator.h"
|
||||
#include "m/m_color.h"
|
||||
#include "m/m_mtx.h"
|
||||
@@ -21,11 +24,28 @@
|
||||
#include "toBeSorted/blur_and_palette_manager.h"
|
||||
#include "toBeSorted/d_particle.h"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
#include "rvl/GX.h"
|
||||
#include "rvl/MTX.h"
|
||||
|
||||
void float_ordering_1(s32 a) {
|
||||
(f32) a;
|
||||
}
|
||||
|
||||
void float_ordering_2() {
|
||||
255.0f;
|
||||
}
|
||||
|
||||
void float_ordering_3(u32 a) {
|
||||
(f32) a;
|
||||
}
|
||||
|
||||
void float_ordering_4() {
|
||||
0.0f;
|
||||
}
|
||||
|
||||
typedef TList<EffectsStruct, offsetof(EffectsStruct, mNode)> EffectsList;
|
||||
EffectsList sPlayingEffectsList;
|
||||
CommonEmitterCallback sCommonEmitterCallbacks[2];
|
||||
@@ -86,13 +106,14 @@ JPABaseEmitter *dEmitterBase_c::GetNextEmitter(JPABaseEmitter *head) {
|
||||
}
|
||||
|
||||
bool dEmitterBase_c::createEmitters(
|
||||
u16 effectResourceId, const mVec3_c &position, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1, const GXColor *c2, s32 idx1, s32 idx2
|
||||
u16 effectResourceId, const mVec3_c &position, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1,
|
||||
const GXColor *c2, s32 idx1, s32 idx2
|
||||
) {
|
||||
u16 iter = effectResourceId;
|
||||
JPABaseEmitter *head = nullptr;
|
||||
JPABaseEmitter *last;
|
||||
for (; iter != 0xFFFF; iter = dParticle::mgr_c::GetInstance()->getJpnData(iter)) {
|
||||
last = dParticle::mgr_c::GetInstance()->createEmitter(iter, fn_80028900(iter), position, rot, scale);
|
||||
last = dParticle::mgr_c::GetInstance()->createEmitter(iter, getGroupId(iter), position, rot, scale);
|
||||
if (last != nullptr) {
|
||||
if (head != nullptr) {
|
||||
head->setUserWork(reinterpret_cast<u32>(last));
|
||||
@@ -290,7 +311,7 @@ EffectsStruct::~EffectsStruct() {
|
||||
}
|
||||
|
||||
void EffectsStruct::remove(bool bForceDeleteEmitters) {
|
||||
mFlags &= ~0x1;
|
||||
offFlag(EMITTER_0x1);
|
||||
JPABaseEmitter *emitter = bForceDeleteEmitters ? mpEmitterHead : nullptr;
|
||||
deactivateEmitters();
|
||||
for (; emitter != nullptr; emitter = GetNextEmitter(emitter)) {
|
||||
@@ -304,12 +325,12 @@ void EffectsStruct::addToActiveEmittersList(u16 resourceId, bool bFlags) {
|
||||
mFlags = 0;
|
||||
setImmortal();
|
||||
sPlayingEffectsList.append(this);
|
||||
mFlags |= 1;
|
||||
onFlag(EMITTER_0x1);
|
||||
if (bFlags) {
|
||||
mFlags |= 4;
|
||||
onFlag(EMITTER_0x4);
|
||||
}
|
||||
if (dParticle::mgr_c::GetInstance()->getResUserWork(resourceId) & 0x4000) {
|
||||
mFlags |= 0x10;
|
||||
onFlag(EMITTER_0x10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +338,7 @@ bool EffectsStruct::areAllEmittersDone() {
|
||||
bool allDone = true;
|
||||
|
||||
if (mpEmitterHead != nullptr) {
|
||||
if ((mFlags & 0x8) != 0 && field_0x2C != 0) {
|
||||
if (checkFlag(EMITTER_Fading) && mFadeTimer != 0) {
|
||||
return false;
|
||||
}
|
||||
for (JPABaseEmitter *emitter = mpEmitterHead; emitter != nullptr; emitter = GetNextEmitter(emitter)) {
|
||||
@@ -334,6 +355,63 @@ bool EffectsStruct::areAllEmittersDone() {
|
||||
return allDone;
|
||||
}
|
||||
|
||||
void EffectsStruct::execute() {
|
||||
if (mpOwner != nullptr && (mpOwner->delete_request || mpOwner->lifecycle_state == fBase_c::TO_BE_DELETED)) {
|
||||
mpOwner = nullptr;
|
||||
}
|
||||
if (shouldBePaused(mpOwner)) {
|
||||
if (!checkFlag(EMITTER_0x10)) {
|
||||
stopCalcEmitters();
|
||||
if (mpOwner != nullptr && !mpOwner->isBasePropertyFlag(0x100)) {
|
||||
if (!mpEmitterHead->checkStatus(JPAEmtrStts_StopDraw)) {
|
||||
onFlag(EMITTER_0x20);
|
||||
stopDrawParticles();
|
||||
}
|
||||
} else {
|
||||
if (checkFlag(EMITTER_0x20)) {
|
||||
offFlag(EMITTER_0x20);
|
||||
playDrawParticles();
|
||||
}
|
||||
}
|
||||
}
|
||||
onFlag(EMITTER_0x1);
|
||||
} else {
|
||||
playCalcEmitters();
|
||||
if (checkFlag(EMITTER_0x20)) {
|
||||
offFlag(EMITTER_0x20);
|
||||
playDrawParticles();
|
||||
}
|
||||
if (checkFlag(EMITTER_Fading) && mFadeTimer != 0) {
|
||||
mFadeTimer--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectsStruct::getOwnerPolyAttrs(s32 *pOut1, s32 *pOut2) {
|
||||
if (mpOwner != nullptr && mpOwner->group_type == fBase_c::ACTOR) {
|
||||
dAcBase_c *actor = static_cast<dAcBase_c *>(mpOwner);
|
||||
*pOut1 = actor->polyAttr0;
|
||||
*pOut2 = actor->polyAttr1;
|
||||
return true;
|
||||
} else {
|
||||
*pOut1 = 0;
|
||||
*pOut2 = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void EffectsStruct::realizeAlpha() {
|
||||
setGlobalAlpha(mFadeTimer * (255.0f / mFadeDuration));
|
||||
}
|
||||
|
||||
void EffectsStruct::setFading(u8 lifetime) {
|
||||
if (!checkFlag(EMITTER_Fading)) {
|
||||
mFadeTimer = lifetime;
|
||||
onFlag(EMITTER_Fading);
|
||||
mFadeDuration = lifetime;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" bool fn_80054AD0();
|
||||
void dEffect2D_c::draw() {
|
||||
f32 proj[GX_PROJECTION_SZ];
|
||||
@@ -360,7 +438,7 @@ void dEffect2D_c::create(u32 groupId, u8 prio) {
|
||||
setPriority(prio);
|
||||
}
|
||||
|
||||
void dJEffEmitterCallback_c::executeAfter(JPABaseParticle *) {}
|
||||
void dMassObjEmitterCallback_c::executeAfter(JPABaseParticle *) {}
|
||||
|
||||
void dShpEmitterProc::doDraw() {
|
||||
mMtx_c viewMtx;
|
||||
@@ -478,14 +556,14 @@ void dShpEmitter_c::draw(JPABaseEmitter *emitter, JPABaseParticle *particle) {
|
||||
particle->setInvisibleParticleFlag();
|
||||
}
|
||||
|
||||
void dJEffManager_c::remove() {
|
||||
void dMassObjEmitter_c::remove() {
|
||||
setEmitterCallback(nullptr);
|
||||
mpEmitterHead = nullptr;
|
||||
}
|
||||
|
||||
extern "C" u32 sNumberOfMgrs; // should be const?
|
||||
extern "C" const u16 PARTICLE_RESOURCE_ID_MAPPING_119_;
|
||||
extern "C" dJEffManager_c *CURRENT_EFFECT_MANAGER_INIT;
|
||||
extern "C" dMassObjEmitter_c *CURRENT_EFFECT_MANAGER_INIT;
|
||||
|
||||
// various grasses being cut
|
||||
extern const u16 sEffectResourceIds[];
|
||||
@@ -568,10 +646,103 @@ void dJEffManager_c::removeEffManagers() {
|
||||
static u32 sInts[] = {0x28, 0x29, 0x87, 0x88, 0x89, 0x8A, 0x8C, 0x8D, 0x91, 0x86, 0x1, 0x2};
|
||||
static u32 sInts2[] = {0x2, 0x87, 0x8B};
|
||||
|
||||
s32 dEmitterBase_c::getGroupId(u16 resourceId) {
|
||||
u32 mask = dParticle::mgr_c::GetInstance()->getResUserWork(resourceId);
|
||||
s32 bit = 1;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if ((mask & (1 << i)) != 0) {
|
||||
bit = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int i = sInts[bit];
|
||||
// TODO explain this
|
||||
if ((mask & 0x8000) != 0) {
|
||||
if (i == 3) {
|
||||
i = 2;
|
||||
} else if (i == 5) {
|
||||
i = 4;
|
||||
} else if (i == 7) {
|
||||
i = 6;
|
||||
} else if (i == 1) {
|
||||
i = 0;
|
||||
} else if (i == 11) {
|
||||
i = 10;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void dJEffManager_c::execute() {
|
||||
for (EffectsList::Iterator it = sPlayingEffectsList.GetBeginIter(); it != sPlayingEffectsList.GetEndIter();) {
|
||||
EffectsList::Iterator itNext = it;
|
||||
++itNext;
|
||||
it->execute();
|
||||
if (it->checkFlag(EffectsStruct::EMITTER_Fading)) {
|
||||
it->realizeAlpha();
|
||||
}
|
||||
if (it->checkFlag(EffectsStruct::EMITTER_0x1)) {
|
||||
it->offFlag(EffectsStruct::EMITTER_0x1);
|
||||
} else {
|
||||
if (it->areAllEmittersDone()) {
|
||||
it->remove(false);
|
||||
} else {
|
||||
it->onFlag(EffectsStruct::EMITTER_0x2);
|
||||
}
|
||||
}
|
||||
it = itNext;
|
||||
}
|
||||
|
||||
if (dStageMgr_c::GetInstance() != nullptr) {
|
||||
CURRENT_EFFECT_MANAGER_INIT->setGlobalAlpha(dStageMgr_c::GetInstance()->getGlobalAlpha());
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < sNumberOfMgrs; i++) {
|
||||
mColor c = sManagers[i].getField_0x67C();
|
||||
sManagers[i].loadColors(&c, nullptr, 0, 0);
|
||||
sManagers[i].execute();
|
||||
}
|
||||
|
||||
if ((dBase_c::s_ExecuteControlFlags & 0x6F9) == 0) {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
dParticle::mgr_c::GetInstance()->calc(i);
|
||||
}
|
||||
} else {
|
||||
dParticle::mgr_c::GetInstance()->calc(9);
|
||||
}
|
||||
|
||||
dParticle::mgr_c::GetInstance()->calc(12);
|
||||
dParticle::mgr_c::GetInstance()->calc(13);
|
||||
dParticle::mgr_c::GetInstance()->calc(14);
|
||||
}
|
||||
|
||||
void dJEffManager_c::draw() {
|
||||
for (s32 i = 0; i < 12; i++) {
|
||||
sFogProcs[i].entry();
|
||||
}
|
||||
|
||||
s2DEffects[0].addToDrawList();
|
||||
s2DEffects[1].addToDrawList();
|
||||
s2DEffects[2].addToDrawList();
|
||||
|
||||
for (s32 i = 0; i < 47; i++) {
|
||||
sShpEmitters[i].draw();
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectsStruct::shouldBePaused(dBase_c *owner) {
|
||||
return owner != nullptr && !owner->isBasePropertyFlag(dBase_c::BASE_PROP_0x4) &&
|
||||
(EventManager::isInEvent() || owner->isProcControlFlag(fBase_c::DISABLE_EXECUTE) ||
|
||||
// TODO execute control flags
|
||||
(owner->s_ExecuteControlFlags & 0x6fb));
|
||||
}
|
||||
|
||||
bool dJEffManager_c::createEffManagers() {
|
||||
EGG::Heap *heap = dHeap::work1Heap.heap;
|
||||
ms_allocator = new (heap, 4) mHeapAllocator_c();
|
||||
sManagers = new (heap, 4) dJEffManager_c[sNumberOfMgrs];
|
||||
sManagers = new (heap, 4) dMassObjEmitter_c[sNumberOfMgrs];
|
||||
|
||||
for (s32 idx = 0; idx < sNumberOfMgrs; idx++) {
|
||||
// TODO explain this
|
||||
@@ -604,7 +775,50 @@ bool dJEffManager_c::createEffManagers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void dEmitterBase_c::loadColors(JPABaseEmitter *emitter, const GXColor *color1, const GXColor *color2, s32 plltIdx1, s32 plltIdx2) {
|
||||
dEmitterBase_c *dJEffManager_c::spawnEffectInternal(
|
||||
u16 effectResourceId, const mVec3_c &position, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1,
|
||||
const GXColor *c2, s32 idx1, s32 idx2
|
||||
) {
|
||||
if (!sEmitter.createEmitters(effectResourceId, position, rot, scale, c1, c2, idx1, idx2)) {
|
||||
return nullptr;
|
||||
}
|
||||
return &sEmitter;
|
||||
}
|
||||
|
||||
dEmitterBase_c *dJEffManager_c::spawnEffectInternal(
|
||||
u16 effectResourceId, const mMtx_c &transform, const GXColor *c1, const GXColor *c2, s32 idx1, s32 idx2
|
||||
) {
|
||||
dEmitterBase_c *e = spawnEffectInternal(effectResourceId, mVec3_c::Zero, nullptr, nullptr, c1, c2, idx1, idx2);
|
||||
if (e != nullptr) {
|
||||
e->setTransform(transform);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
dEmitterBase_c *dJEffManager_c::spawnEffect(
|
||||
u16 effectResourceId, const mVec3_c &position, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1,
|
||||
const GXColor *c2, s32 idx1, s32 idx2
|
||||
) {
|
||||
return spawnEffectInternal(effectResourceId, position, rot, scale, c1, c2, idx1, idx2);
|
||||
}
|
||||
|
||||
dEmitterBase_c *dJEffManager_c::spawnUIEffect(
|
||||
u16 effectResourceId, const mVec3_c &position, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1,
|
||||
const GXColor *c2
|
||||
) {
|
||||
mVec3_c adjustedPosition(position.x * getlbl_80571C50(), position.y, position.z);
|
||||
return spawnEffectInternal(effectResourceId, adjustedPosition, rot, scale, c1, c2, 0, 0);
|
||||
}
|
||||
|
||||
dEmitterBase_c *dJEffManager_c::spawnEffect(
|
||||
u16 effectResourceId, const mMtx_c &transform, const GXColor *c1, const GXColor *c2, s32 idx1, s32 idx2
|
||||
) {
|
||||
return spawnEffectInternal(effectResourceId, transform, c1, c2, idx1, idx2);
|
||||
}
|
||||
|
||||
void dEmitterBase_c::loadColors(
|
||||
JPABaseEmitter *emitter, const GXColor *color1, const GXColor *color2, s32 plltIdx1, s32 plltIdx2
|
||||
) {
|
||||
BlurAndPaletteManager &mgr = BlurAndPaletteManager::GetInstance();
|
||||
u8 r1 = 0xFF;
|
||||
u8 g1 = 0xFF;
|
||||
@@ -711,3 +925,27 @@ void EffectsStruct::removeFromActiveEmittersList() {
|
||||
sPlayingEffectsList.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectsStruct::createEffect(
|
||||
bool bFlags, u16 resourceId, const mVec3_c &pos, const mAng3_c *rot, const mVec3_c *scale, const GXColor *c1,
|
||||
const GXColor *c2
|
||||
) {
|
||||
if (!bFlags && canReuse(resourceId)) {
|
||||
setPosRotScale(pos, rot, scale);
|
||||
s32 idx1 = 0;
|
||||
s32 idx2 = 0;
|
||||
getOwnerPolyAttrs(&idx1, &idx2);
|
||||
loadColors(c1, c2, idx1, idx2);
|
||||
onFlag(EMITTER_0x1);
|
||||
} else {
|
||||
remove(false);
|
||||
s32 idx1 = 0;
|
||||
s32 idx2 = 0;
|
||||
getOwnerPolyAttrs(&idx1, &idx2);
|
||||
if (createEmitters(resourceId, pos, rot, scale, c1, c2, idx1, idx2)) {
|
||||
addToActiveEmittersList(resourceId, bFlags);
|
||||
}
|
||||
}
|
||||
|
||||
return hasEmitters();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user