1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-11 09:20:17 +00:00

WeaponInfo docs (#1596)

* WeaponInfo docs

* format

* disasm metadata

* merge fixup

* Add MELEE_WEAPON_INFO_TIP and _BASE

* format

* Offset
This commit is contained in:
Dragorn421 2025-06-08 05:37:13 +02:00 committed by GitHub
parent 45bee14f2f
commit 39de1e0204
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 128 additions and 107 deletions

View file

@ -337,8 +337,8 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
Player* player = GET_PLAYER(play);
Vec3f sp78;
Vec3f hookNewTip;
Vec3f hookNewBase;
Vec3f posA;
Vec3f posB;
f32 sp5C;
f32 sp58;
@ -349,16 +349,16 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
Matrix_MultVec3f(&D_80865B88, &hookNewTip);
Matrix_MultVec3f(&D_80865B94, &hookNewBase);
this->hookInfo.active = 0;
Matrix_MultVec3f(&D_80865B88, &posA);
Matrix_MultVec3f(&D_80865B94, &posB);
this->weaponInfo.active = false;
} else {
Matrix_MultVec3f(&D_80865B7C, &this->unk_1E8);
Matrix_MultVec3f(&D_80865BA0, &hookNewTip);
Matrix_MultVec3f(&D_80865BAC, &hookNewBase);
Matrix_MultVec3f(&D_80865BA0, &posA);
Matrix_MultVec3f(&D_80865BAC, &posB);
}
func_80090480(play, &this->collider, &this->hookInfo, &hookNewTip, &hookNewBase);
Player_UpdateWeaponInfo(play, &this->collider, &this->weaponInfo, &posA, &posB);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_arms_hook.c", 895);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL);

View file

@ -12,7 +12,7 @@ typedef void (*ArmsHookActionFunc)(struct ArmsHook*, struct PlayState*);
typedef struct ArmsHook {
/* 0x0000 */ Actor actor;
/* 0x014C */ ColliderQuad collider;
/* 0x01CC */ WeaponInfo hookInfo;
/* 0x01CC */ WeaponInfo weaponInfo;
/* 0x01E8 */ Vec3f unk_1E8;
/* 0x01F4 */ Vec3f unk_1F4;
/* 0x0200 */ Actor* attachedActor;

View file

@ -294,9 +294,9 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) {
webPos.x = this->dyna.actor.world.pos.x;
webPos.y = this->dyna.actor.world.pos.y - 50.0f;
webPos.z = this->dyna.actor.world.pos.z;
if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f) != 0) {
this->dyna.actor.home.pos.x = player->meleeWeaponInfo[0].tip.x;
this->dyna.actor.home.pos.z = player->meleeWeaponInfo[0].tip.z;
if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f)) {
this->dyna.actor.home.pos.x = MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->x;
this->dyna.actor.home.pos.z = MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->z;
BgYdanSp_BurnWeb(this, play);
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;
BgYdanSp_BurnWeb(this, play);
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK && player->unk_860 != 0) {
Actor_WorldToActorCoords(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].tip);
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) {
OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, CAM_ID_MAIN);
Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->meleeWeaponInfo[0].tip);
Math_Vec3f_Copy(&this->dyna.actor.home.pos, MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0]));
BgYdanSp_BurnWeb(this, play);
}
}

View file

@ -429,36 +429,36 @@ void EnArrow_Update(Actor* thisx, PlayState* play) {
}
void func_809B4800(EnArrow* this, PlayState* play) {
static Vec3f D_809B4E88 = { 0.0f, 400.0f, 1500.0f };
static Vec3f D_809B4E94 = { 0.0f, -400.0f, 1500.0f };
static Vec3f sPosAOffset = { 0.0f, 400.0f, 1500.0f };
static Vec3f sPosBOffset = { 0.0f, -400.0f, 1500.0f };
static Vec3f D_809B4EA0 = { 0.0f, 0.0f, -300.0f };
Vec3f sp44;
Vec3f sp38;
Vec3f posA;
Vec3f posB;
s32 addBlureVertex;
Matrix_MultVec3f(&D_809B4EA0, &this->unk_21C);
if (EnArrow_Fly == this->actionFunc) {
Matrix_MultVec3f(&D_809B4E88, &sp44);
Matrix_MultVec3f(&D_809B4E94, &sp38);
Matrix_MultVec3f(&sPosAOffset, &posA);
Matrix_MultVec3f(&sPosBOffset, &posB);
if (this->actor.params <= ARROW_SEED) {
addBlureVertex = this->actor.params <= ARROW_LIGHT;
if (this->hitActor == NULL) {
addBlureVertex &= func_80090480(play, &this->collider, &this->weaponInfo, &sp44, &sp38);
addBlureVertex &= Player_UpdateWeaponInfo(play, &this->collider, &this->weaponInfo, &posA, &posB);
} else {
if (addBlureVertex) {
if ((sp44.x == this->weaponInfo.tip.x) && (sp44.y == this->weaponInfo.tip.y) &&
(sp44.z == this->weaponInfo.tip.z) && (sp38.x == this->weaponInfo.base.x) &&
(sp38.y == this->weaponInfo.base.y) && (sp38.z == this->weaponInfo.base.z)) {
if ((posA.x == this->weaponInfo.posA.x) && (posA.y == this->weaponInfo.posA.y) &&
(posA.z == this->weaponInfo.posA.z) && (posB.x == this->weaponInfo.posB.x) &&
(posB.y == this->weaponInfo.posB.y) && (posB.z == this->weaponInfo.posB.z)) {
addBlureVertex = false;
}
}
}
if (addBlureVertex) {
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp44, &sp38);
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &posA, &posB);
}
}
}

View file

@ -257,22 +257,22 @@ void EnBoom_Update(Actor* thisx, PlayState* play) {
}
void EnBoom_Draw(Actor* thisx, PlayState* play) {
static Vec3f sMultVec1 = { -960.0f, 0.0f, 0.0f };
static Vec3f sMultVec2 = { 960.0f, 0.0f, 0.0f };
static Vec3f sPosAOffset = { -960.0f, 0.0f, 0.0f };
static Vec3f sPosBOffset = { 960.0f, 0.0f, 0.0f };
EnBoom* this = (EnBoom*)thisx;
Vec3f vec1;
Vec3f vec2;
Vec3f posA;
Vec3f posB;
OPEN_DISPS(play->state.gfxCtx, "../z_en_boom.c", 567);
Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(0x1F40), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD(this->actor.world.rot.x), MTXMODE_APPLY);
Matrix_MultVec3f(&sMultVec1, &vec1);
Matrix_MultVec3f(&sMultVec2, &vec2);
Matrix_MultVec3f(&sPosAOffset, &posA);
Matrix_MultVec3f(&sPosBOffset, &posB);
if (func_80090480(play, &this->collider, &this->boomerangInfo, &vec1, &vec2)) {
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vec1, &vec2);
if (Player_UpdateWeaponInfo(play, &this->collider, &this->weaponInfo, &posA, &posB)) {
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &posA, &posB);
}
Gfx_SetupDL_25Opa(play->state.gfxCtx);

View file

@ -17,7 +17,7 @@ typedef struct EnBoom {
/* 0x01D4 */ u8 returnTimer; // returns to Link when 0
/* 0x01D5 */ u8 activeTimer; // increments once every update
/* 0x01D8 */ s32 effectIndex;
/* 0x01DC */ WeaponInfo boomerangInfo;
/* 0x01DC */ WeaponInfo weaponInfo;
/* 0x01F8 */ EnBoomActionFunc actionFunc;
} EnBoom; // size = 0x01FC

View file

@ -318,9 +318,11 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) {
minAnimSpeed = 0.0f;
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {
swordTip.x = player->meleeWeaponInfo[0].tip.x + Math_SinS(player->actor.shape.rot.y) * 10.0f;
swordTip.y = player->meleeWeaponInfo[0].tip.y;
swordTip.z = player->meleeWeaponInfo[0].tip.z + Math_CosS(player->actor.shape.rot.y) * 10.0f;
swordTip.x =
MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->x + Math_SinS(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);
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].tip.y);
this->posYTarget = MAX(player->actor.world.pos.y + 30.0f, MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->y);
EnButte_Turn(this);
@ -352,7 +354,8 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) {
(this->swordDownTimer <= 0) && (distSqFromHome < SQ(320.0f)))) {
EnButte_SetupFlyAround(this);
} else if (distSqFromHome > SQ(240.0f)) {
distSqFromSword = Math3D_Dist2DSq(player->meleeWeaponInfo[0].tip.x, player->meleeWeaponInfo[0].tip.z,
distSqFromSword = Math3D_Dist2DSq(MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->x,
MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0])->z,
this->actor.world.pos.x, this->actor.world.pos.z);
if (distSqFromSword < SQ(60.0f)) {
EnButte_SetupTransformIntoFairy(this);

View file

@ -1514,7 +1514,7 @@ void EnMb_Update(Actor* thisx, PlayState* play) {
void EnMb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f unused = { 1100.0f, -700.0f, 0.0f };
static Vec3f feetPos = { 0.0f, 0.0f, 0.0f };
static Vec3f effSpawnModelPos = { 0.0f, -8000.0f, 0.0f };
static Vec3f effSpawnOffsetFromLeftHand = { 0.0f, -8000.0f, 0.0f };
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
s32 bodyPart = -1;
EnMb* this = (EnMb*)thisx;
@ -1522,7 +1522,7 @@ void EnMb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
if (this->actor.params == ENMB_TYPE_CLUB) {
if (limbIndex == ENMB_LIMB_LHAND) {
Matrix_MultVec3f(&effSpawnModelPos, &this->effSpawnPos);
Matrix_MultVec3f(&effSpawnOffsetFromLeftHand, &this->effSpawnPos);
if (this->attack > ENMB_ATTACK_NONE) {
EnMb_ClubUpdateAttackCollider(&this->actor, play);
}

View file

@ -188,7 +188,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) {
interactionType = 1;
}
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK) {
Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, &this->actor.world.pos, &tipToFlame);
Math_Vec3f_Diff(MELEE_WEAPON_INFO_TIP(&player->meleeWeaponInfo[0]), &this->actor.world.pos, &tipToFlame);
tipToFlame.y -= 67.0f;
if ((SQ(tipToFlame.x) + SQ(tipToFlame.y) + SQ(tipToFlame.z)) < SQ(20.0f)) {
interactionType = -1;

View file

@ -1766,7 +1766,7 @@ void Player_ApplyYawFromAnim(Player* this) {
void func_80832318(Player* this) {
this->stateFlags2 &= ~PLAYER_STATE2_17;
this->meleeWeaponState = 0;
this->meleeWeaponInfo[0].active = this->meleeWeaponInfo[1].active = this->meleeWeaponInfo[2].active = 0;
this->meleeWeaponInfo[0].active = this->meleeWeaponInfo[1].active = this->meleeWeaponInfo[2].active = false;
}
void func_80832340(PlayState* play, Player* this) {
@ -9070,7 +9070,7 @@ s32 func_80842DF4(PlayState* play, Player* this) {
s32 bgId;
Vec3f sp68;
Vec3f sp5C;
Vec3f sp50;
Vec3f baseToTip;
s32 temp1;
s32 surfaceMaterial;
@ -9080,18 +9080,19 @@ s32 func_80842DF4(PlayState* play, Player* this) {
!(this->meleeWeaponQuads[1].base.atFlags & AT_BOUNCED)) {
if (this->skelAnime.curFrame >= 2.0f) {
phi_f2 = Math_Vec3f_DistXYZAndStoreDiff(&this->meleeWeaponInfo[0].tip,
&this->meleeWeaponInfo[0].base, &sp50);
phi_f2 =
Math_Vec3f_DistXYZAndStoreDiff(MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]),
MELEE_WEAPON_INFO_BASE(&this->meleeWeaponInfo[0]), &baseToTip);
if (phi_f2 != 0.0f) {
phi_f2 = (phi_f2 + 10.0f) / phi_f2;
}
sp68.x = this->meleeWeaponInfo[0].tip.x + (sp50.x * phi_f2);
sp68.y = this->meleeWeaponInfo[0].tip.y + (sp50.y * phi_f2);
sp68.z = this->meleeWeaponInfo[0].tip.z + (sp50.z * phi_f2);
sp68.x = MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0])->x + (baseToTip.x * phi_f2);
sp68.y = MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0])->y + (baseToTip.y * 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].tip, &sp5C, &groundPoly,
true, false, false, true, &bgId) &&
if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]),
&sp5C, &groundPoly, true, false, false, true, &bgId) &&
!SurfaceType_IsIgnoredByEntities(&play->colCtx, groundPoly, bgId) &&
(SurfaceType_GetFloorType(&play->colCtx, groundPoly, bgId) != FLOOR_TYPE_6) &&
(func_8002F9EC(play, &this->actor, groundPoly, bgId, &sp5C) == 0)) {
@ -11474,8 +11475,8 @@ void Player_UpdateBurningDekuStick(PlayState* play, Player* this) {
this->unk_85C = temp;
}
func_8002836C(play, &this->meleeWeaponInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0,
temp * 200.0f, 0, 8);
func_8002836C(play, MELEE_WEAPON_INFO_TIP(&this->meleeWeaponInfo[0]), &D_808547A4, &D_808547B0, &D_808547BC,
&D_808547C0, temp * 200.0f, 0, 8);
}
void Player_UpdateBodyShock(PlayState* play, Player* this) {