mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-10 03:52:00 -04:00
Player preparation 1 (#1058)
* Bring over new stuff from player.h * door type * PlayerModelGroup * CSMODE * PLAYER_PARAMS * functions.h * item.h * a * format * ED * stuff * Magic_Reset * bodyPartsPos * format * review Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * format * params and fixes * GetItemId * yes * 2 * warnning * closestSecretDistSq Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> * Name the other PLAYER_DOORTYPE * review Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: fig02 <fig02srl@gmail.com> * remove pyelftools * PlayerActionParam Player_GetExchangeItemId * Update include/z64animation.h Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * bss * bss * fix linkanimation warning * bss * bss * format * fix * namefixer * format * fix * fixes * namefixer * bss * fixes Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
+43
-38
@@ -520,7 +520,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) {
|
||||
|
||||
Target_SetPos(targetCtx, targetCtx->unk4C, projectedPos.x, projectedPos.y, projectedPos.z);
|
||||
|
||||
if ((!(player->stateFlags1 & PLAYER_STATE1_40)) || (actor != player->unk_730)) {
|
||||
if ((!(player->stateFlags1 & PLAYER_STATE1_40)) || (actor != player->targetedActor)) {
|
||||
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39);
|
||||
|
||||
for (spB0 = 0, spAC = targetCtx->unk4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) {
|
||||
@@ -589,7 +589,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS
|
||||
Vec3f projectedPos;
|
||||
f32 invW;
|
||||
|
||||
if ((player->unk_730 != 0) && (player->unk_AE3[player->unk_ADE] == 2)) {
|
||||
if ((player->targetedActor != NULL) && (player->unk_AE3[player->unk_ADE] == 2)) {
|
||||
targetCtx->unk_94 = NULL;
|
||||
} else {
|
||||
func_800BB8EC(gameState, &play->actorCtx, &sp68, &D_801ED920, player);
|
||||
@@ -1328,7 +1328,7 @@ s32 func_800B7118(Player* player) {
|
||||
}
|
||||
|
||||
s32 func_800B7128(Player* player) {
|
||||
return func_800B7118(player) && player->unk_ACC;
|
||||
return func_800B7118(player) && (player->unk_ACC != 0);
|
||||
}
|
||||
|
||||
s32 func_800B715C(PlayState* play) {
|
||||
@@ -1354,7 +1354,7 @@ void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) {
|
||||
}
|
||||
|
||||
s32 func_800B7200(Player* player) {
|
||||
return (player->stateFlags1 & (PLAYER_STATE1_20000000 | PLAYER_STATE1_80)) || (player->csMode != 0);
|
||||
return (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) || (player->csMode != PLAYER_CSMODE_0);
|
||||
}
|
||||
|
||||
void func_800B722C(GameState* gameState, Player* player) {
|
||||
@@ -1364,7 +1364,7 @@ void func_800B722C(GameState* gameState, Player* player) {
|
||||
s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if ((player->csMode == 5) || ((csMode == 6) && (player->csMode == 0))) {
|
||||
if ((player->csMode == PLAYER_CSMODE_5) || ((csMode == PLAYER_CSMODE_6) && (player->csMode == PLAYER_CSMODE_0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1374,7 +1374,7 @@ s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 func_800B7298(PlayState* play, Actor* actor, u8 csMode) {
|
||||
s32 func_800B7298(PlayState* play, Actor* actor, u8 csMode) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (func_800B724C(play, actor, csMode)) {
|
||||
@@ -1489,11 +1489,12 @@ s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s
|
||||
|
||||
/* Start of BgCheck related section */
|
||||
|
||||
void func_800B75A0(CollisionPoly* poly, Vec3f* normal, s16* azimuth) {
|
||||
normal->x = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
normal->y = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||
normal->z = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
*azimuth = Math_FAtan2F(normal->z, normal->x);
|
||||
void Actor_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* downwardSlopeYaw) {
|
||||
slopeNormal->x = COLPOLY_GET_NORMAL(floorPoly->normal.x);
|
||||
slopeNormal->y = COLPOLY_GET_NORMAL(floorPoly->normal.y);
|
||||
slopeNormal->z = COLPOLY_GET_NORMAL(floorPoly->normal.z);
|
||||
|
||||
*downwardSlopeYaw = Math_FAtan2F(slopeNormal->z, slopeNormal->x);
|
||||
}
|
||||
|
||||
s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) {
|
||||
@@ -1783,7 +1784,7 @@ f32 func_800B82EC(Actor* actor, Player* player, s16 angle) {
|
||||
s16 temp_v0 = BINANG_SUB(BINANG_SUB(actor->yawTowardsPlayer, 0x8000), angle);
|
||||
s16 yaw = ABS_ALT(temp_v0);
|
||||
|
||||
if (player->unk_730 != NULL) {
|
||||
if (player->targetedActor != NULL) {
|
||||
if ((yaw > 0x4000) || ((actor->flags & ACTOR_FLAG_8000000))) {
|
||||
return FLT_MAX;
|
||||
}
|
||||
@@ -1821,7 +1822,7 @@ s32 func_800B83F8(Actor* actor, Player* player, s32 flag) {
|
||||
s16 phi_v1 = ABS_ALT(yaw);
|
||||
f32 dist;
|
||||
|
||||
if ((player->unk_730 == NULL) && (phi_v1 >= 0x2AAB)) {
|
||||
if ((player->targetedActor == NULL) && (phi_v1 >= 0x2AAB)) {
|
||||
dist = FLT_MAX;
|
||||
} else {
|
||||
dist = actor->xyzDistToPlayerSq;
|
||||
@@ -1853,13 +1854,13 @@ s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, Player
|
||||
|
||||
if ((player->actor.flags & ACTOR_FLAG_100) || ((exchangeItemId > PLAYER_AP_NONE) && Player_InCsMode(play)) ||
|
||||
(!actor->isTargeted &&
|
||||
((fabsf(actor->playerHeightRel) > fabsf(yRange)) || ((actor->xzDistToPlayer > player->targetActorDistance)) ||
|
||||
((fabsf(actor->playerHeightRel) > fabsf(yRange)) || (actor->xzDistToPlayer > player->talkActorDistance) ||
|
||||
(xzRange < actor->xzDistToPlayer)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
player->targetActor = actor;
|
||||
player->targetActorDistance = actor->xzDistToPlayer;
|
||||
player->talkActor = actor;
|
||||
player->talkActorDistance = actor->xzDistToPlayer;
|
||||
player->exchangeItemId = exchangeItemId;
|
||||
|
||||
ActorCutscene_SetIntentToPlay(0x7C);
|
||||
@@ -1894,21 +1895,21 @@ s32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) {
|
||||
* Fails if Player is not already focussing on an actor or in a talking state
|
||||
*/
|
||||
s32 Actor_ChangeFocus(Actor* actor1, PlayState* play, Actor* actor2) {
|
||||
Actor* targetActor;
|
||||
Actor* talkActor;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
targetActor = player->targetActor;
|
||||
talkActor = player->talkActor;
|
||||
|
||||
if ((player->actor.flags & ACTOR_FLAG_100) && (targetActor != NULL)) {
|
||||
player->targetActor = actor2;
|
||||
player->unk_730 = actor2;
|
||||
if ((player->actor.flags & ACTOR_FLAG_100) && (talkActor != NULL)) {
|
||||
player->talkActor = actor2;
|
||||
player->targetedActor = actor2;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Player_GetExchangeItemId(PlayState* play) {
|
||||
PlayerActionParam Player_GetExchangeItemId(PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
return player->exchangeItemId;
|
||||
@@ -1992,7 +1993,7 @@ s32 Actor_HasParent(Actor* actor, PlayState* play) {
|
||||
* GI_NONE is usually used as a special case to lift an actor
|
||||
* GI_MAX is usually used to catch an actor in a bottle
|
||||
*/
|
||||
s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) {
|
||||
s32 Actor_PickUp(Actor* actor, PlayState* play, GetItemId getItemId, f32 xzRange, f32 yRange) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (!(player->stateFlags1 &
|
||||
@@ -2002,7 +2003,7 @@ s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32
|
||||
if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) {
|
||||
if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES ||
|
||||
getItemId == GI_DEED_LAND ||
|
||||
((player->heldActor != NULL || actor == player->targetActor) &&
|
||||
((player->heldActor != NULL || actor == player->talkActor) &&
|
||||
(getItemId > GI_NONE && getItemId < GI_MAX))) ||
|
||||
!(player->stateFlags1 & (PLAYER_STATE1_800 | PLAYER_STATE1_20000000))) {
|
||||
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
|
||||
@@ -2026,7 +2027,7 @@ s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Actor_PickUpNearby(Actor* actor, PlayState* play, s32 getItemId) {
|
||||
s32 Actor_PickUpNearby(Actor* actor, PlayState* play, GetItemId getItemId) {
|
||||
return Actor_PickUp(actor, play, getItemId, 50.0f, 10.0f);
|
||||
}
|
||||
|
||||
@@ -2034,7 +2035,7 @@ s32 Actor_LiftActor(Actor* actor, PlayState* play) {
|
||||
return Actor_PickUpNearby(actor, play, GI_NONE);
|
||||
}
|
||||
|
||||
s32 Actor_PickUpFar(Actor* actor, PlayState* play, s32 getItemId) {
|
||||
s32 Actor_PickUpFar(Actor* actor, PlayState* play, GetItemId getItemId) {
|
||||
return Actor_PickUp(actor, play, getItemId, 9999.9f, 9999.9f);
|
||||
}
|
||||
|
||||
@@ -2061,11 +2062,15 @@ void func_800B8C20(Actor* actorA, Actor* actorB, PlayState* play) {
|
||||
actorA->parent = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets closest secret distance to the distance to the actor. Calling this function on `actor` is the way to make it a
|
||||
* 'secret' for that update cycle, i.e. something that the controller will rumble for.
|
||||
*/
|
||||
void func_800B8C50(Actor* actor, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (actor->xyzDistToPlayerSq < player->unk_AA0) {
|
||||
player->unk_AA0 = actor->xyzDistToPlayerSq;
|
||||
if (actor->xyzDistToPlayerSq < player->closestSecretDistSq) {
|
||||
player->closestSecretDistSq = actor->xyzDistToPlayerSq;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2207,7 +2212,7 @@ void func_800B9098(Actor* actor) {
|
||||
actor->audioFlags |= 0x40;
|
||||
}
|
||||
|
||||
s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgId, s32 arg4) {
|
||||
s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgId, Vec3f* arg4) {
|
||||
if (func_800C99D4(&play->colCtx, polygon, bgId) == 8) {
|
||||
return true;
|
||||
}
|
||||
@@ -2368,13 +2373,13 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) {
|
||||
actor->flags &= ~ACTOR_FLAG_1000000;
|
||||
|
||||
if ((DECR(actor->freezeTimer) == 0) && (actor->flags & params->unk_18)) {
|
||||
if (actor == params->player->unk_730) {
|
||||
if (actor == params->player->targetedActor) {
|
||||
actor->isTargeted = true;
|
||||
} else {
|
||||
actor->isTargeted = false;
|
||||
}
|
||||
|
||||
if ((actor->targetPriority != 0) && (params->player->unk_730 == 0)) {
|
||||
if ((actor->targetPriority != 0) && (params->player->targetedActor == NULL)) {
|
||||
actor->targetPriority = 0;
|
||||
}
|
||||
|
||||
@@ -2461,7 +2466,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
||||
}
|
||||
|
||||
if ((player->stateFlags1 & PLAYER_STATE1_40) && ((player->actor.textId & 0xFF00) != 0x1900)) {
|
||||
params.unk10 = player->targetActor;
|
||||
params.unk10 = player->talkActor;
|
||||
} else {
|
||||
params.unk10 = NULL;
|
||||
}
|
||||
@@ -2499,7 +2504,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
actor = player->unk_730;
|
||||
actor = player->targetedActor;
|
||||
if ((actor != NULL) && (actor->update == NULL)) {
|
||||
actor = NULL;
|
||||
func_80123DA4(player);
|
||||
@@ -3280,9 +3285,9 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
|
||||
Actor* newHead;
|
||||
ActorOverlay* overlayEntry = actor->overlayEntry;
|
||||
|
||||
if ((player != NULL) && (actor == player->unk_730)) {
|
||||
if ((player != NULL) && (actor == player->targetedActor)) {
|
||||
func_80123DA4(player);
|
||||
Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0);
|
||||
Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), CAM_MODE_NORMAL);
|
||||
}
|
||||
|
||||
if (actor == actorCtx->targetContext.arrowPointedActor) {
|
||||
@@ -3323,7 +3328,7 @@ s32 func_800BB59C(PlayState* play, Actor* actor) {
|
||||
void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player, s32 actorCategory) {
|
||||
PlayState* play = (PlayState*)gameState;
|
||||
f32 temp_f0_2;
|
||||
Actor* sp8C;
|
||||
Actor* targetedActor;
|
||||
Actor* actor;
|
||||
s32 phi_s2;
|
||||
CollisionPoly* sp80;
|
||||
@@ -3332,7 +3337,7 @@ void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player,
|
||||
s32 phi_s2_2;
|
||||
|
||||
actor = actorCtx->actorLists[actorCategory].first;
|
||||
sp8C = player->unk_730;
|
||||
targetedActor = player->targetedActor;
|
||||
while (actor != NULL) {
|
||||
if ((actor->update != NULL) && ((Player*)actor != player)) {
|
||||
if (actor->flags & (ACTOR_FLAG_40000000 | ACTOR_FLAG_1)) {
|
||||
@@ -3343,7 +3348,7 @@ void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player,
|
||||
}
|
||||
}
|
||||
|
||||
if ((actor != sp8C) || (actor->flags & ACTOR_FLAG_80000)) {
|
||||
if ((actor != targetedActor) || (actor->flags & ACTOR_FLAG_80000)) {
|
||||
temp_f0_2 = func_800B82EC(actor, player, D_801ED8DC);
|
||||
phi_s2_2 = (actor->flags & 1) != 0;
|
||||
if (phi_s2_2) {
|
||||
|
||||
Reference in New Issue
Block a user