mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-10 17:00:19 +00:00
Actor Struct Changes (and a few related things) (#617)
* reformat header * type -> category * done for now i think * some more stuff * first -> head * focus * flag comment * ground -> floor * remove asm, name wrapper funcs * name func, format * review * targetPriority, format * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0305ec2c2" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0305ec2c2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * comment * review * feet flags * horse shadow
This commit is contained in:
parent
20206fba0d
commit
00a5edea71
697 changed files with 8157 additions and 7942 deletions
|
@ -50,7 +50,7 @@ static ColliderJntSphInit sColliderInit = {
|
|||
|
||||
const ActorInit En_Butte_InitVars = {
|
||||
ACTOR_EN_BUTTE,
|
||||
ACTORTYPE_ITEMACTION,
|
||||
ACTORCAT_ITEMACTION,
|
||||
FLAGS,
|
||||
OBJECT_GAMEPLAY_FIELD_KEEP,
|
||||
sizeof(EnButte),
|
||||
|
@ -128,8 +128,8 @@ void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) {
|
|||
Matrix_RotateX(camDir.x * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(camDir.z * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_MultVec3f(&D_809CE3C4, &sp5C);
|
||||
func_800D1694(this->actor.posRot2.pos.x + sp5C.x, this->actor.posRot2.pos.y + sp5C.y,
|
||||
this->actor.posRot2.pos.z + sp5C.z, &camDir);
|
||||
func_800D1694(this->actor.focus.pos.x + sp5C.x, this->actor.focus.pos.y + sp5C.y, this->actor.focus.pos.z + sp5C.z,
|
||||
&camDir);
|
||||
Matrix_Scale(sTransformationEffectScale, sTransformationEffectScale, sTransformationEffectScale, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_choo.c", 317),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
@ -186,22 +186,22 @@ void func_809CD56C(EnButte* this) {
|
|||
static f32 D_809CE3E0[] = { 50.0f, 80.0f, 100.0f };
|
||||
static f32 D_809CE3EC[] = { 30.0f, 40.0f, 50.0f };
|
||||
|
||||
this->actor.shape.unk_08 += Math_SinS(this->unk_25C) * D_809CE3E0[this->flightParamsIdx] +
|
||||
Math_SinS(this->unk_25E) * D_809CE3EC[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 = CLAMP(this->actor.shape.unk_08, -2000.0f, 2000.0f);
|
||||
this->actor.shape.yOffset += Math_SinS(this->unk_25C) * D_809CE3E0[this->flightParamsIdx] +
|
||||
Math_SinS(this->unk_25E) * D_809CE3EC[this->flightParamsIdx];
|
||||
this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -2000.0f, 2000.0f);
|
||||
}
|
||||
|
||||
void func_809CD634(EnButte* this) {
|
||||
static f32 D_809CE3F8[] = { 15.0f, 20.0f, 25.0f };
|
||||
static f32 D_809CE404[] = { 7.5f, 10.0f, 12.5f };
|
||||
|
||||
this->actor.shape.unk_08 += Math_SinS(this->unk_25C) * D_809CE3F8[this->flightParamsIdx] +
|
||||
Math_SinS(this->unk_25E) * D_809CE404[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 = CLAMP(this->actor.shape.unk_08, -500.0f, 500.0f);
|
||||
this->actor.shape.yOffset += Math_SinS(this->unk_25C) * D_809CE3F8[this->flightParamsIdx] +
|
||||
Math_SinS(this->unk_25E) * D_809CE404[this->flightParamsIdx];
|
||||
this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -500.0f, 500.0f);
|
||||
}
|
||||
|
||||
void EnButte_Turn(EnButte* this) {
|
||||
s16 target = this->actor.posRot.rot.y + 0x8000;
|
||||
s16 target = this->actor.world.rot.y + 0x8000;
|
||||
s16 diff = target - this->actor.shape.rot.y;
|
||||
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, target, ABS(diff) >> 3);
|
||||
|
@ -223,8 +223,8 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
f32 animSpeed;
|
||||
s16 rotStep;
|
||||
|
||||
distSqFromHome = Math3D_Dist2DSq(this->actor.posRot.pos.x, this->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z);
|
||||
distSqFromHome = Math3D_Dist2DSq(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x,
|
||||
this->actor.home.pos.z);
|
||||
func_809CD56C(this);
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
|
@ -238,25 +238,25 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
minAnimSpeed = 0.0f;
|
||||
this->posYTarget = this->actor.initPosRot.pos.y;
|
||||
this->posYTarget = this->actor.home.pos.y;
|
||||
|
||||
if ((this->flightParamsIdx != 0) && ((distSqFromHome > maxDistSqFromHome) || (this->timer < 4))) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, flightParams->rotYStep) == 0) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos);
|
||||
if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, flightParams->rotYStep) == 0) {
|
||||
minAnimSpeed = 0.5f;
|
||||
}
|
||||
} else if ((this->unk_257 == 0) && (this->actor.child != NULL) && (this->actor.child != &this->actor)) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.child->posRot.pos);
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos);
|
||||
if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, rotStep) == 0) {
|
||||
minAnimSpeed = 0.3f;
|
||||
}
|
||||
} else if (this->unk_257 == 1) {
|
||||
yaw = this->actor.yawTowardsLink + 0x8000 + (s16)((Rand_ZeroOne() - 0.5f) * 0x6000);
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
yaw = this->actor.yawTowardsPlayer + 0x8000 + (s16)((Rand_ZeroOne() - 0.5f) * 0x6000);
|
||||
if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, rotStep) == 0) {
|
||||
minAnimSpeed = 0.4f;
|
||||
}
|
||||
} else {
|
||||
this->actor.posRot.rot.y += (s16)(sinf(this->unk_25C) * 100.0f);
|
||||
this->actor.world.rot.y += (s16)(sinf(this->unk_25C) * 100.0f);
|
||||
}
|
||||
|
||||
EnButte_Turn(this);
|
||||
|
@ -271,12 +271,12 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (((this->actor.params & 1) == 1) && (player->heldItemActionParam == 6) && (this->swordDownTimer <= 0) &&
|
||||
((Math3D_Dist2DSq(player->actor.posRot.pos.x, player->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z) < SQ(120.0f)) ||
|
||||
(this->actor.xzDistToLink < 60.0f))) {
|
||||
((Math3D_Dist2DSq(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x,
|
||||
this->actor.home.pos.z) < SQ(120.0f)) ||
|
||||
(this->actor.xzDistToPlayer < 60.0f))) {
|
||||
EnButte_SetupFollowLink(this);
|
||||
this->unk_257 = 2;
|
||||
} else if (this->actor.xzDistToLink < 120.0) {
|
||||
} else if (this->actor.xzDistToPlayer < 120.0) {
|
||||
this->unk_257 = 1;
|
||||
} else {
|
||||
this->unk_257 = 0;
|
||||
|
@ -309,17 +309,17 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
|
|||
swordTip.y = player->swordInfo[0].tip.y;
|
||||
swordTip.z = player->swordInfo[0].tip.z + Math_CosS(player->actor.shape.rot.y) * 10.0f;
|
||||
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410);
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, 2000) != 0) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410);
|
||||
if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000) != 0) {
|
||||
if (globalCtx->gameplayFrames % 2) {
|
||||
this->actor.posRot.rot.y += (s16)(sinf(this->unk_25C) * 60.0f);
|
||||
this->actor.world.rot.y += (s16)(sinf(this->unk_25C) * 60.0f);
|
||||
}
|
||||
} else {
|
||||
minAnimSpeed = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
this->posYTarget = MAX(player->actor.posRot.pos.y + 30.0f, player->swordInfo[0].tip.y);
|
||||
this->posYTarget = MAX(player->actor.world.pos.y + 30.0f, player->swordInfo[0].tip.y);
|
||||
|
||||
EnButte_Turn(this);
|
||||
|
||||
|
@ -333,14 +333,14 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
|
|||
D_809CE410 = -D_809CE410;
|
||||
}
|
||||
|
||||
distSqFromHome = Math3D_Dist2DSq(this->actor.posRot.pos.x, this->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z);
|
||||
distSqFromHome = Math3D_Dist2DSq(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x,
|
||||
this->actor.home.pos.z);
|
||||
if (!((player->heldItemActionParam == 6) && (fabsf(player->actor.speedXZ) < 1.8f) && (this->swordDownTimer <= 0) &&
|
||||
(distSqFromHome < SQ(320.0f)))) {
|
||||
EnButte_SetupFlyAround(this);
|
||||
} else if (distSqFromHome > SQ(240.0f)) {
|
||||
distSqFromSword = Math3D_Dist2DSq(player->swordInfo[0].tip.x, player->swordInfo[0].tip.z,
|
||||
this->actor.posRot.pos.x, this->actor.posRot.pos.z);
|
||||
this->actor.world.pos.x, this->actor.world.pos.z);
|
||||
if (distSqFromSword < SQ(60.0f)) {
|
||||
EnButte_SetupTransformIntoFairy(this);
|
||||
}
|
||||
|
@ -360,10 +360,10 @@ void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx) {
|
|||
EnButte_UpdateTransformationEffect();
|
||||
|
||||
if (this->timer == 5) {
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY);
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY);
|
||||
} else if (this->timer == 4) {
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.posRot2.pos.x, this->actor.posRot2.pos.y,
|
||||
this->actor.posRot2.pos.z, 0, this->actor.shape.rot.y, 0, FAIRY_HEAL_TIMED);
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y,
|
||||
this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, FAIRY_HEAL_TIMED);
|
||||
this->drawSkelAnime = false;
|
||||
} else if (this->timer <= 0) {
|
||||
EnButte_SetupWaitToDie(this);
|
||||
|
@ -411,11 +411,11 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if (this->actor.update != NULL) {
|
||||
Actor_MoveForward(&this->actor);
|
||||
Math_StepToF(&this->actor.posRot.pos.y, this->posYTarget, 0.6f);
|
||||
if (this->actor.xyzDistToLinkSq < 5000.0f) {
|
||||
Math_StepToF(&this->actor.world.pos.y, this->posYTarget, 0.6f);
|
||||
if (this->actor.xyzDistToPlayerSq < 5000.0f) {
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
Actor_SetHeight(&this->actor, this->actor.shape.unk_08 * this->actor.scale.y);
|
||||
Actor_SetFocus(&this->actor, this->actor.shape.yOffset * this->actor.scale.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue