mirror of https://github.com/zeldaret/oot.git
Add MELEE_WEAPON_INFO_TIP and _BASE
This commit is contained in:
parent
a81acc9711
commit
188e1c4938
|
@ -695,6 +695,9 @@ typedef struct PlayerAgeProperties {
|
||||||
/* 0xCC */ LinkAnimationHeader* unk_CC[2];
|
/* 0xCC */ LinkAnimationHeader* unk_CC[2];
|
||||||
} PlayerAgeProperties; // size = 0xD4
|
} PlayerAgeProperties; // size = 0xD4
|
||||||
|
|
||||||
|
#define MELEE_WEAPON_INFO_TIP(weaponInfo) (&(weaponInfo)->posA)
|
||||||
|
#define MELEE_WEAPON_INFO_BASE(weaponInfo) (&(weaponInfo)->posB)
|
||||||
|
|
||||||
typedef struct WeaponInfo {
|
typedef struct WeaponInfo {
|
||||||
/* 0x00 */ s32 active;
|
/* 0x00 */ s32 active;
|
||||||
/* 0x04 */ Vec3f posA; // For melee weapons, this is the tip (furthest from the player hand)
|
/* 0x04 */ Vec3f posA; // For melee weapons, this is the tip (furthest from the player hand)
|
||||||
|
|
|
@ -803,7 +803,7 @@ int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y
|
||||||
s32 pad;
|
s32 pad;
|
||||||
|
|
||||||
if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_860 != 0)) {
|
if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_860 != 0)) {
|
||||||
Math_Vec3f_Diff(&this->meleeWeaponInfo[0].posA, pos, &diff);
|
Math_Vec3f_Diff(MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]), pos, &diff);
|
||||||
return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange);
|
return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1669,7 +1669,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
||||||
if (this->meleeWeaponState != 0) {
|
if (this->meleeWeaponState != 0) {
|
||||||
Player_UpdateMeleeWeaponInfo(play, this, tipPositions);
|
Player_UpdateMeleeWeaponInfo(play, this, tipPositions);
|
||||||
} else {
|
} else {
|
||||||
Math_Vec3f_Copy(&this->meleeWeaponInfo[0].posA, &tipPositions[0]);
|
Math_Vec3f_Copy(MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]), &tipPositions[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,8 +295,8 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) {
|
||||||
webPos.y = this->dyna.actor.world.pos.y - 50.0f;
|
webPos.y = this->dyna.actor.world.pos.y - 50.0f;
|
||||||
webPos.z = this->dyna.actor.world.pos.z;
|
webPos.z = this->dyna.actor.world.pos.z;
|
||||||
if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f)) {
|
if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f)) {
|
||||||
this->dyna.actor.home.pos.x = player->meleeWeaponInfo[0].posA.x;
|
this->dyna.actor.home.pos.x = MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->x;
|
||||||
this->dyna.actor.home.pos.z = player->meleeWeaponInfo[0].posA.z;
|
this->dyna.actor.home.pos.z = MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->z;
|
||||||
BgYdanSp_BurnWeb(this, play);
|
BgYdanSp_BurnWeb(this, play);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -412,10 +412,10 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) {
|
||||||
this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f;
|
this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f;
|
||||||
BgYdanSp_BurnWeb(this, play);
|
BgYdanSp_BurnWeb(this, play);
|
||||||
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK && player->unk_860 != 0) {
|
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK && player->unk_860 != 0) {
|
||||||
Actor_WorldToActorCoords(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].posA);
|
Actor_WorldToActorCoords(&this->dyna.actor, &sp30, MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0]));
|
||||||
if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) {
|
if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) {
|
||||||
OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, CAM_ID_MAIN);
|
OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, CAM_ID_MAIN);
|
||||||
Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->meleeWeaponInfo[0].posA);
|
Math_Vec3f_Copy(&this->dyna.actor.home.pos, MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0]));
|
||||||
BgYdanSp_BurnWeb(this, play);
|
BgYdanSp_BurnWeb(this, play);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,9 +318,11 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) {
|
||||||
minAnimSpeed = 0.0f;
|
minAnimSpeed = 0.0f;
|
||||||
|
|
||||||
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {
|
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {
|
||||||
swordTip.x = player->meleeWeaponInfo[0].posA.x + Math_SinS(player->actor.shape.rot.y) * 10.0f;
|
swordTip.x =
|
||||||
swordTip.y = player->meleeWeaponInfo[0].posA.y;
|
MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->x + Math_SinS(player->actor.shape.rot.y) * 10.0f;
|
||||||
swordTip.z = player->meleeWeaponInfo[0].posA.z + Math_CosS(player->actor.shape.rot.y) * 10.0f;
|
swordTip.y = MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->y;
|
||||||
|
swordTip.z =
|
||||||
|
MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->z + Math_CosS(player->actor.shape.rot.y) * 10.0f;
|
||||||
|
|
||||||
yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410);
|
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 (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000) != 0) {
|
||||||
|
@ -332,7 +334,7 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->posYTarget = MAX(player->actor.world.pos.y + 30.0f, player->meleeWeaponInfo[0].posA.y);
|
this->posYTarget = MAX(player->actor.world.pos.y + 30.0f, MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->y);
|
||||||
|
|
||||||
EnButte_Turn(this);
|
EnButte_Turn(this);
|
||||||
|
|
||||||
|
@ -352,8 +354,9 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) {
|
||||||
(this->swordDownTimer <= 0) && (distSqFromHome < SQ(320.0f)))) {
|
(this->swordDownTimer <= 0) && (distSqFromHome < SQ(320.0f)))) {
|
||||||
EnButte_SetupFlyAround(this);
|
EnButte_SetupFlyAround(this);
|
||||||
} else if (distSqFromHome > SQ(240.0f)) {
|
} else if (distSqFromHome > SQ(240.0f)) {
|
||||||
distSqFromSword = Math3D_Dist2DSq(player->meleeWeaponInfo[0].posA.x, player->meleeWeaponInfo[0].posA.z,
|
distSqFromSword = Math3D_Dist2DSq(MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->x,
|
||||||
this->actor.world.pos.x, this->actor.world.pos.z);
|
MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->z, this->actor.world.pos.x,
|
||||||
|
this->actor.world.pos.z);
|
||||||
if (distSqFromSword < SQ(60.0f)) {
|
if (distSqFromSword < SQ(60.0f)) {
|
||||||
EnButte_SetupTransformIntoFairy(this);
|
EnButte_SetupTransformIntoFairy(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) {
|
||||||
interactionType = 1;
|
interactionType = 1;
|
||||||
}
|
}
|
||||||
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK) {
|
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK) {
|
||||||
Math_Vec3f_Diff(&player->meleeWeaponInfo[0].posA, &this->actor.world.pos, &tipToFlame);
|
Math_Vec3f_Diff(MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0]), &this->actor.world.pos, &tipToFlame);
|
||||||
tipToFlame.y -= 67.0f;
|
tipToFlame.y -= 67.0f;
|
||||||
if ((SQ(tipToFlame.x) + SQ(tipToFlame.y) + SQ(tipToFlame.z)) < SQ(20.0f)) {
|
if ((SQ(tipToFlame.x) + SQ(tipToFlame.y) + SQ(tipToFlame.z)) < SQ(20.0f)) {
|
||||||
interactionType = -1;
|
interactionType = -1;
|
||||||
|
|
|
@ -9080,18 +9080,19 @@ s32 func_80842DF4(PlayState* play, Player* this) {
|
||||||
!(this->meleeWeaponQuads[1].base.atFlags & AT_BOUNCED)) {
|
!(this->meleeWeaponQuads[1].base.atFlags & AT_BOUNCED)) {
|
||||||
if (this->skelAnime.curFrame >= 2.0f) {
|
if (this->skelAnime.curFrame >= 2.0f) {
|
||||||
|
|
||||||
phi_f2 = Math_Vec3f_DistXYZAndStoreDiff(&this->meleeWeaponInfo[0].posA,
|
phi_f2 =
|
||||||
&this->meleeWeaponInfo[0].posB, &baseToTip);
|
Math_Vec3f_DistXYZAndStoreDiff(MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]),
|
||||||
|
MELEE_WEAPON_INFO_BASE(&this->meleeWeaponInfo[0]), &baseToTip);
|
||||||
if (phi_f2 != 0.0f) {
|
if (phi_f2 != 0.0f) {
|
||||||
phi_f2 = (phi_f2 + 10.0f) / phi_f2;
|
phi_f2 = (phi_f2 + 10.0f) / phi_f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp68.x = this->meleeWeaponInfo[0].posA.x + (baseToTip.x * phi_f2);
|
sp68.x = MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0])->x + (baseToTip.x * phi_f2);
|
||||||
sp68.y = this->meleeWeaponInfo[0].posA.y + (baseToTip.y * phi_f2);
|
sp68.y = MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0])->y + (baseToTip.y * phi_f2);
|
||||||
sp68.z = this->meleeWeaponInfo[0].posA.z + (baseToTip.z * phi_f2);
|
sp68.z = MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0])->z + (baseToTip.z * phi_f2);
|
||||||
|
|
||||||
if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].posA, &sp5C,
|
if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]),
|
||||||
&groundPoly, true, false, false, true, &bgId) &&
|
&sp5C, &groundPoly, true, false, false, true, &bgId) &&
|
||||||
!SurfaceType_IsIgnoredByEntities(&play->colCtx, groundPoly, bgId) &&
|
!SurfaceType_IsIgnoredByEntities(&play->colCtx, groundPoly, bgId) &&
|
||||||
(SurfaceType_GetFloorType(&play->colCtx, groundPoly, bgId) != FLOOR_TYPE_6) &&
|
(SurfaceType_GetFloorType(&play->colCtx, groundPoly, bgId) != FLOOR_TYPE_6) &&
|
||||||
(func_8002F9EC(play, &this->actor, groundPoly, bgId, &sp5C) == 0)) {
|
(func_8002F9EC(play, &this->actor, groundPoly, bgId, &sp5C) == 0)) {
|
||||||
|
@ -11473,8 +11474,8 @@ void Player_UpdateBurningDekuStick(PlayState* play, Player* this) {
|
||||||
this->unk_85C = temp;
|
this->unk_85C = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
func_8002836C(play, &this->meleeWeaponInfo[0].posA, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0,
|
func_8002836C(play, MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]), &D_808547A4, &D_808547B0, &D_808547BC,
|
||||||
temp * 200.0f, 0, 8);
|
&D_808547C0, temp * 200.0f, 0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player_UpdateBodyShock(PlayState* play, Player* this) {
|
void Player_UpdateBodyShock(PlayState* play, Player* this) {
|
||||||
|
|
Loading…
Reference in New Issue