mirror of
https://github.com/zeldaret/ss
synced 2026-07-31 08:05:47 -04:00
d_t_gekotag with a single regswap (#76)
This commit is contained in:
@@ -1,9 +1,100 @@
|
||||
#include "d/t/d_t_gekotag.h"
|
||||
|
||||
#include "c/c_math.h"
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "d/a/e/d_a_e_geko.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "m/m_angle.h"
|
||||
|
||||
#pragma explicit_zero_data on
|
||||
static u32 initialRotX = 0;
|
||||
static u32 initialRotY = 0;
|
||||
static u32 initialRotZ = 0;
|
||||
#pragma explicit_zero_data off
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(GEKO_TAG, dTgGekoTag, fProfile::GEKO_TAG, 0xEE, 0, 0);
|
||||
|
||||
STATE_DEFINE(dTgGekoTag, Wait);
|
||||
|
||||
int dTgGekoTag::create() {
|
||||
mNumGeko = getNumGeko() != 0xF ? getNumGeko() : 1;
|
||||
|
||||
for (int i = 0; i < mNumGeko; i++) {
|
||||
mRefs[i].unlink();
|
||||
}
|
||||
|
||||
// Regswaps
|
||||
mNoSpawnRadius = getNoSpawnRadius();
|
||||
if (!mNoSpawnRadius) {
|
||||
mNoSpawnRadius = 100.0f;
|
||||
}
|
||||
|
||||
mGekoParam = getGekoParam() != 3 ? getGekoParam() : 0;
|
||||
field_0x1FD = getParm3();
|
||||
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dTgGekoTag::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dTgGekoTag::actorExecute() {
|
||||
mStateMgr.executeState();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dTgGekoTag::draw() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
void dTgGekoTag::initializeState_Wait() {}
|
||||
void dTgGekoTag::executeState_Wait() {}
|
||||
void dTgGekoTag::executeState_Wait() {
|
||||
doExecute();
|
||||
}
|
||||
void dTgGekoTag::finalizeState_Wait() {}
|
||||
|
||||
void dTgGekoTag::doExecute() {
|
||||
cM::calcTimer(&mTimer2);
|
||||
if (cM::calcTimer(&mTimer1) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dAcPy_c::LINK->getSquareDistanceTo(position) < mNoSpawnRadius * mNoSpawnRadius) {
|
||||
return;
|
||||
}
|
||||
field_0x1FD = 0xFF;
|
||||
|
||||
u32 gekoParmTmp = (params & 0xFF) | 0x3FC00000;
|
||||
gekoParmTmp = (gekoParmTmp & 0xFFFF00FF) | (params & 0xFF00);
|
||||
u32 gekoParm = gekoParmTmp | ((mGekoParam != 0 ? 3 : 1) << 16);
|
||||
|
||||
mAng3_c gekoRot = mAng3_c(initialRotX, initialRotY, initialRotZ);
|
||||
gekoRot.y = cM::rndF(65535.0f);
|
||||
int numFullGekoRefs = 0;
|
||||
for (int i = 0; i < mNumGeko; i++) {
|
||||
if (mRefs[i].get() == nullptr) {
|
||||
if (mTimer2 == 0) {
|
||||
dAcObjBase_c *b =
|
||||
dAcObjBase_c::create(fProfile::E_GEKO, roomid, gekoParm, &position, &gekoRot, nullptr, 0xFFFFFFFF);
|
||||
|
||||
if (b != nullptr) {
|
||||
mRefs[i].link(static_cast<dAcEgeko_c *>(b));
|
||||
mTimer1 = 20;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
numFullGekoRefs++;
|
||||
}
|
||||
}
|
||||
|
||||
if (numFullGekoRefs == mNumGeko) {
|
||||
mTimer2 = 0x96;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user