mirror of
https://github.com/zeldaret/oot
synced 2026-05-23 06:54:24 -04:00
Document spin attack (#2694)
This commit is contained in:
@@ -16,6 +16,17 @@
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
typedef enum EnMThunderSwordType {
|
||||
/* 0 */ M_THUNDER_SWORD_MASTER,
|
||||
/* 1 */ M_THUNDER_SWORD_KOKIRI,
|
||||
/* 2 */ M_THUNDER_SWORD_GIANT
|
||||
} EnMThunderSwordType;
|
||||
|
||||
typedef enum EnMThunderAttackStrength {
|
||||
/* 0 */ M_THUNDER_ATTACK_STRONG,
|
||||
/* 1 */ M_THUNDER_ATTACK_WEAK
|
||||
} EnMThunderAttackStrength;
|
||||
|
||||
void EnMThunder_Init(Actor* thisx, PlayState* play2);
|
||||
void EnMThunder_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnMThunder_Update(Actor* thisx, PlayState* play);
|
||||
@@ -72,14 +83,14 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) {
|
||||
|
||||
Collider_InitCylinder(play, &this->collider);
|
||||
Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AA0420);
|
||||
this->unk_1C7 = PARAMS_GET_S(this->actor.params, 0, 8) - 1;
|
||||
this->swordType = PARAMS_GET_S(this->actor.params, 0, 8) - 1;
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y,
|
||||
this->actor.world.pos.z, 255, 255, 255, 0);
|
||||
this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
|
||||
this->collider.dim.radius = 0;
|
||||
this->collider.dim.height = 40;
|
||||
this->collider.dim.yShift = -20;
|
||||
this->unk_1C4 = 8;
|
||||
this->followPlayerTimer = 8;
|
||||
this->unk_1B4 = 0.0f;
|
||||
this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST];
|
||||
this->unk_1AC = 0.0f;
|
||||
@@ -101,11 +112,11 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) {
|
||||
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_17;
|
||||
this->unk_1CA = 1;
|
||||
this->collider.elem.atDmgInfo.dmgFlags = D_80AA044C[this->unk_1C7];
|
||||
this->unk_1C6 = 1;
|
||||
this->unk_1C9 = ((this->unk_1C7 == 1) ? 2 : 4);
|
||||
this->collider.elem.atDmgInfo.dmgFlags = D_80AA044C[this->swordType];
|
||||
this->attackStrength = M_THUNDER_ATTACK_WEAK;
|
||||
this->targetScale = ((this->swordType == M_THUNDER_SWORD_KOKIRI) ? 2 : 4);
|
||||
func_80A9EFE0(this, func_80A9F9B4);
|
||||
this->unk_1C4 = 8;
|
||||
this->followPlayerTimer = 8;
|
||||
SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_ROLLING_CUT_LV1);
|
||||
this->unk_1AC = 1.0f;
|
||||
} else {
|
||||
@@ -163,7 +174,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
!(Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_WAIT_PREVIEW)))) {
|
||||
func_80A9F350(this, play);
|
||||
func_80A9EFE0(this, func_80A9F350);
|
||||
this->unk_1C8 = 0;
|
||||
this->chargeAlpha = 0;
|
||||
this->unk_1BC = 0.0;
|
||||
this->unk_1AC = 0.0f;
|
||||
return;
|
||||
@@ -195,17 +206,17 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP;
|
||||
}
|
||||
if (player->unk_858 < 0.85f) {
|
||||
this->collider.elem.atDmgInfo.dmgFlags = D_80AA044C[this->unk_1C7];
|
||||
this->unk_1C6 = 1;
|
||||
this->unk_1C9 = ((this->unk_1C7 == 1) ? 2 : 4);
|
||||
this->collider.elem.atDmgInfo.dmgFlags = D_80AA044C[this->swordType];
|
||||
this->attackStrength = M_THUNDER_ATTACK_WEAK;
|
||||
this->targetScale = ((this->swordType == M_THUNDER_SWORD_KOKIRI) ? 2 : 4);
|
||||
} else {
|
||||
this->collider.elem.atDmgInfo.dmgFlags = D_80AA0458[this->unk_1C7];
|
||||
this->unk_1C6 = 0;
|
||||
this->unk_1C9 = ((this->unk_1C7 == 1) ? 4 : 8);
|
||||
this->collider.elem.atDmgInfo.dmgFlags = D_80AA0458[this->swordType];
|
||||
this->attackStrength = M_THUNDER_ATTACK_STRONG;
|
||||
this->targetScale = ((this->swordType == M_THUNDER_SWORD_KOKIRI) ? 4 : 8);
|
||||
}
|
||||
|
||||
func_80A9EFE0(this, func_80A9F9B4);
|
||||
this->unk_1C4 = 8;
|
||||
this->followPlayerTimer = 8;
|
||||
|
||||
{
|
||||
static u16 sSfxIds[] = {
|
||||
@@ -215,7 +226,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
NA_SE_IT_ROLLING_CUT_LV1,
|
||||
};
|
||||
|
||||
SFX_PLAY_AT_POS(&player->actor.projectedPos, sSfxIds[this->unk_1C6]);
|
||||
SFX_PLAY_AT_POS(&player->actor.projectedPos, sSfxIds[this->attackStrength]);
|
||||
}
|
||||
|
||||
this->unk_1AC = 1.0f;
|
||||
@@ -232,19 +243,19 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (player->unk_858 > 0.15f) {
|
||||
this->unk_1C8 = 255;
|
||||
this->chargeAlpha = 255;
|
||||
if (this->actor.child == NULL) {
|
||||
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_DUST, this->actor.world.pos.x,
|
||||
this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0,
|
||||
this->unk_1C7 + 2);
|
||||
this->swordType + 2);
|
||||
}
|
||||
this->unk_1BC += ((((player->unk_858 - 0.15f) * 1.5f) - this->unk_1BC) * 0.5f);
|
||||
|
||||
} else if (player->unk_858 > .1f) {
|
||||
this->unk_1C8 = (s32)((player->unk_858 - .1f) * 255.0f * 20.0f);
|
||||
this->chargeAlpha = (s32)((player->unk_858 - .1f) * 255.0f * 20.0f);
|
||||
this->unk_1AC = (player->unk_858 - .1f) * 10.0f;
|
||||
} else {
|
||||
this->unk_1C8 = 0;
|
||||
this->chargeAlpha = 0;
|
||||
}
|
||||
|
||||
if (player->unk_858 > 0.85f) {
|
||||
@@ -261,11 +272,11 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void func_80A9F938(EnMThunder* this, PlayState* play) {
|
||||
if (this->unk_1C4 < 2) {
|
||||
if (this->unk_1C8 < 40) {
|
||||
this->unk_1C8 = 0;
|
||||
if (this->followPlayerTimer < 2) {
|
||||
if (this->chargeAlpha < 40) {
|
||||
this->chargeAlpha = 0;
|
||||
} else {
|
||||
this->unk_1C8 -= 40;
|
||||
this->chargeAlpha -= 40;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,17 +295,17 @@ void func_80A9F9B4(EnMThunder* this, PlayState* play) {
|
||||
if (Math_StepToF(&this->unk_1AC, 0.0f, 1 / 16.0f)) {
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
Math_SmoothStepToF(&this->actor.scale.x, (s32)this->unk_1C9, 0.6f, 0.8f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.scale.x, (s32)this->targetScale, 0.6f, 0.8f, 0.0f);
|
||||
Actor_SetScale(&this->actor, this->actor.scale.x);
|
||||
this->collider.dim.radius = (this->actor.scale.x * 25.0f);
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
if (this->unk_1C4 > 0) {
|
||||
if (this->followPlayerTimer > 0) {
|
||||
this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x;
|
||||
this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z;
|
||||
this->unk_1C4--;
|
||||
this->followPlayerTimer--;
|
||||
}
|
||||
|
||||
if (this->unk_1AC > 0.6f) {
|
||||
@@ -337,9 +348,9 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) {
|
||||
Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY);
|
||||
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_m_thunder.c", 853);
|
||||
|
||||
switch (this->unk_1C6) {
|
||||
case 0:
|
||||
case 1:
|
||||
switch (this->attackStrength) {
|
||||
case M_THUNDER_ATTACK_STRONG:
|
||||
case M_THUNDER_ATTACK_WEAK:
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE,
|
||||
0xFF - ((u8)(s32)(this->unk_1B4 * 30) & 0xFF), 0, 0x40, 0x20, 1,
|
||||
@@ -347,13 +358,13 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (this->unk_1C6) {
|
||||
case 0:
|
||||
switch (this->attackStrength) {
|
||||
case M_THUNDER_ATTACK_STRONG:
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, (u8)(this->unk_1B0 * 255));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gSpinAttack3DL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gSpinAttack4DL);
|
||||
break;
|
||||
case 1:
|
||||
case M_THUNDER_ATTACK_WEAK:
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, (u8)(this->unk_1B0 * 255));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gSpinAttack1DL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gSpinAttack2DL);
|
||||
@@ -362,18 +373,18 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) {
|
||||
|
||||
Matrix_Mult(&player->mf_9E0, MTXMODE_NEW);
|
||||
|
||||
switch (this->unk_1C7) {
|
||||
case 1:
|
||||
switch (this->swordType) {
|
||||
case M_THUNDER_SWORD_KOKIRI:
|
||||
Matrix_Translate(0.0f, 220.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(-0.7f, -0.6f, -0.4f, MTXMODE_APPLY);
|
||||
Matrix_RotateX(16384.0f, MTXMODE_APPLY);
|
||||
break;
|
||||
case 0:
|
||||
case M_THUNDER_SWORD_MASTER:
|
||||
Matrix_Translate(0.0f, 300.0f, -100.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(-1.2f, -1.0f, -0.7f, MTXMODE_APPLY);
|
||||
Matrix_RotateX(16384.0f, MTXMODE_APPLY);
|
||||
break;
|
||||
case 2:
|
||||
case M_THUNDER_SWORD_GIANT:
|
||||
Matrix_Translate(200.0f, 350.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(-1.8f, -1.4f, -0.7f, MTXMODE_APPLY);
|
||||
Matrix_RotateX(16384.0f, MTXMODE_APPLY);
|
||||
@@ -382,12 +393,12 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) {
|
||||
|
||||
if (this->unk_1B8 >= 0.85f) {
|
||||
phi_f14 = (D_80AA046C[(play->gameplayFrames & 7)] * 6.0f) + 1.0f;
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->unk_1C8);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->chargeAlpha);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128);
|
||||
phi_t1 = 0x28;
|
||||
} else {
|
||||
phi_f14 = (D_80AA046C[play->gameplayFrames & 7] * 2.0f) + 1.0f;
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->unk_1C8);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->chargeAlpha);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128);
|
||||
phi_t1 = 0x14;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ typedef struct EnMThunder {
|
||||
/* 0x01B0 */ f32 unk_1B8;
|
||||
/* 0x01BC */ f32 unk_1BC;
|
||||
/* 0x01C0 */ EnMThunderActionFunc actionFunc;
|
||||
/* 0x01C4 */ u16 unk_1C4;
|
||||
/* 0x01C6 */ u8 unk_1C6;
|
||||
/* 0x01C7 */ u8 unk_1C7;
|
||||
/* 0x01C8 */ u8 unk_1C8;
|
||||
/* 0x01C9 */ u8 unk_1C9;
|
||||
/* 0x01C4 */ u16 followPlayerTimer;
|
||||
/* 0x01C6 */ u8 attackStrength; // see `EnMThunderAttackStrength`
|
||||
/* 0x01C7 */ u8 swordType; // see `EnMThunderSwordType`
|
||||
/* 0x01C8 */ u8 chargeAlpha;
|
||||
/* 0x01C9 */ u8 targetScale;
|
||||
/* 0x01CA */ u8 unk_1CA;
|
||||
} EnMThunder; // size = 0x01CC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user