mirror of
https://github.com/zeldaret/ss
synced 2026-06-08 12:17:23 -04:00
document d_t_insect
This commit is contained in:
@@ -30,12 +30,16 @@ public:
|
||||
SPAWN_BUG_MINIGAME,
|
||||
SPAWN_TRIAL_GATE,
|
||||
SPAWN_GOSSIP_STONE,
|
||||
SPAWN_GODDESS_WALL, // doesn't seem to be used?
|
||||
SPAWN_GODDESS_WALL,
|
||||
SPAWN_DEFAULT = 0xF,
|
||||
};
|
||||
dTgInsect_c() : mStateMgr(*this, sStateID::null) {}
|
||||
virtual ~dTgInsect_c() {}
|
||||
|
||||
void setKillSignal() {
|
||||
mKillSignal = 1;
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dTgInsect_c, Wait);
|
||||
STATE_FUNC_DECLARE(dTgInsect_c, WaitCreate);
|
||||
STATE_FUNC_DECLARE(dTgInsect_c, WaitForceEscape);
|
||||
@@ -44,16 +48,16 @@ public:
|
||||
private:
|
||||
/* 0x0FC */ STATE_MGR_DECLARE(dTgInsect_c);
|
||||
/* 0x138 */ dAcRef_c<dAcBase_c> mLinks[16];
|
||||
/* 0x1F8 */ u8 unk1F8[0x208 - 0x1F8];
|
||||
/* 0x208 */ s32 unk208[16];
|
||||
/* 0x1F8 */ u8 unk1F8[16];
|
||||
/* 0x208 */ s32 mInsectRespanwTimers[16];
|
||||
/* 0x248 */ s32 mInsectCount;
|
||||
/* 0x24C */ u8 unk24C;
|
||||
/* 0x24D */ u8 unk24D;
|
||||
/* 0x24C */ u8 mRevealed; // used by OBJ_SOIL and OBJ_VSD to signal that the insect should be spawned now
|
||||
/* 0x24D */ u8 mKillSignal; // used by goddess walls to signal that the insects should despawn
|
||||
/* 0x24E */ u8 unk24E;
|
||||
/* 0x24F */ u8 unk24F;
|
||||
/* 0x250 */ u8 unk250[16];
|
||||
/* 0x260 */ mVec3_c unk260;
|
||||
/* 0x26C */ dAcRef_c<dAcBase_c> unk26C;
|
||||
/* 0x250 */ u8 mShouldSpawn[16];
|
||||
/* 0x260 */ mVec3_c mRevealedSpawnPos;
|
||||
/* 0x26C */ dAcRef_c<dAcBase_c> mWarpRef;
|
||||
|
||||
s32 getSpawnSubtype() const {
|
||||
return (mParams >> 8 & 0xF);
|
||||
|
||||
+18
-18
@@ -65,8 +65,8 @@ int dTgInsect_c::actorCreate() {
|
||||
}
|
||||
}
|
||||
mScale *= 0.01f;
|
||||
unk24C = 0;
|
||||
unk260 = mPosition;
|
||||
mRevealed = 0;
|
||||
mRevealedSpawnPos = mPosition;
|
||||
// non matching: load of 0 in r0
|
||||
// that is already 0
|
||||
if (isTrialGateType() || isGossipStoneType() || isGoddessWallType() || isSpawnSubtype(SPAWN_BUG_MINIGAME)) {
|
||||
@@ -131,7 +131,7 @@ int dTgInsect_c::actorPostCreate() {
|
||||
}
|
||||
// inline vec 2
|
||||
if ((warp->checkInRadius(mPosition, 1000000))) {
|
||||
unk26C.link(warp);
|
||||
mWarpRef.link(warp);
|
||||
} else {
|
||||
return FAILED;
|
||||
}
|
||||
@@ -170,9 +170,9 @@ void dTgInsect_c::executeState_Wait() {
|
||||
s32 i = 0;
|
||||
for (; i < mInsectCount; i++) {
|
||||
if (!mLinks[i].isLinked()) {
|
||||
if (unk208[i] > 0) {
|
||||
unk208[i]--;
|
||||
} else if (unk208[i] == 0) {
|
||||
if (mInsectRespanwTimers[i] > 0) {
|
||||
mInsectRespanwTimers[i]--;
|
||||
} else if (mInsectRespanwTimers[i] == 0) {
|
||||
nw4r::math::MTX34 mtx;
|
||||
PSMTXTrans(mtx, mPosition.x, mPosition.y, mPosition.z);
|
||||
nw4r::math::MTX34 scale;
|
||||
@@ -184,7 +184,7 @@ void dTgInsect_c::executeState_Wait() {
|
||||
spawnInsect(i);
|
||||
}
|
||||
} else {
|
||||
unk208[i] = 900;
|
||||
mInsectRespanwTimers[i] = 900;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void dTgInsect_c::initializeState_WaitCreate() {
|
||||
if (!isSpawnSubtype(SPAWN_BUG_MINIGAME)) {
|
||||
unk24F = 1;
|
||||
for (s32 i = 0; i < mInsectCount; i++) {
|
||||
unk250[i] = shouldSpawn();
|
||||
mShouldSpawn[i] = shouldSpawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ void dTgInsect_c::executeState_WaitCreate() {
|
||||
if (mActorNode.isLinked()) {
|
||||
if (mActorNode.get()->mProfileName == fProfile::OBJ_VSD ||
|
||||
mActorNode.get()->mProfileName == fProfile::OBJ_SOIL) {
|
||||
if (unk24C == 0) {
|
||||
if (mRevealed == 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -216,16 +216,16 @@ void dTgInsect_c::executeState_WaitCreate() {
|
||||
mActorNode.unlink();
|
||||
for (s32 i = 0; i < mInsectCount; i++) {
|
||||
if (!isSpawnSubtype(SPAWN_BUG_MINIGAME)) {
|
||||
if (unk250[i] != 0) {
|
||||
unk250[i] = 0;
|
||||
if (mShouldSpawn[i] != 0) {
|
||||
mShouldSpawn[i] = 0;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dAcBase_c *insect = nullptr;
|
||||
mVec3_c tmp1 = mPosition;
|
||||
if (unk24C) {
|
||||
tmp1 = unk260;
|
||||
if (mRevealed) {
|
||||
tmp1 = mRevealedSpawnPos;
|
||||
}
|
||||
mAng3_c rot(0, cM::rndFX(65536), 0);
|
||||
switch (getSubtype()) {
|
||||
@@ -249,7 +249,7 @@ void dTgInsect_c::executeState_WaitCreate() {
|
||||
}
|
||||
if (insect != nullptr) {
|
||||
mLinks[i].link(insect);
|
||||
unk208[i] = -1;
|
||||
mInsectRespanwTimers[i] = -1;
|
||||
}
|
||||
}
|
||||
if (isSpawnSubtype(SPAWN_BUG_MINIGAME)) {
|
||||
@@ -271,8 +271,8 @@ void dTgInsect_c::initializeState_WaitForceEscape() {
|
||||
|
||||
void dTgInsect_c::executeState_WaitForceEscape() {
|
||||
if (isTrialGateType()) {
|
||||
if (unk26C.isLinked()) {
|
||||
dAcOWarp_c *warp = static_cast<dAcOWarp_c *>(unk26C.get());
|
||||
if (mWarpRef.isLinked()) {
|
||||
dAcOWarp_c *warp = static_cast<dAcOWarp_c *>(mWarpRef.get());
|
||||
if (warp->fn_0x90()) {
|
||||
for (s32 i = 0; i < mInsectCount; i++) {
|
||||
if (mLinks[i].isLinked()) {
|
||||
@@ -282,7 +282,7 @@ void dTgInsect_c::executeState_WaitForceEscape() {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (isGoddessWallType() && unk24D) {
|
||||
} else if (isGoddessWallType() && mKillSignal) {
|
||||
for (s32 i = 0; i < mInsectCount; i++) {
|
||||
if (mLinks[i].isLinked()) {
|
||||
static_cast<dAcInsectButterfly_c *>(mLinks[i].get())->setKillSignal();
|
||||
@@ -408,7 +408,7 @@ void dTgInsect_c::spawnInsect(s32 index) {
|
||||
}
|
||||
if (ref != nullptr) {
|
||||
mLinks[index].link(ref);
|
||||
unk208[index] = -1;
|
||||
mInsectRespanwTimers[index] = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user