mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-09 13:45:23 -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:
@@ -38,7 +38,7 @@
|
||||
* Throughout this file, `mode` indicates whether to multiply the matrix on top of the stack by the new construction
|
||||
* (APPLY), or to just overwrite it (NEW).
|
||||
*/
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/* data */
|
||||
|
||||
+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) {
|
||||
|
||||
@@ -36,7 +36,7 @@ ActorOverlay gActorOverlayTable[] = {
|
||||
#undef DEFINE_ACTOR_INTERNAL
|
||||
#undef DEFINE_ACTOR_UNSET
|
||||
|
||||
s32 gMaxActorId = 0;
|
||||
ActorId gMaxActorId = 0;
|
||||
|
||||
FaultClient D_801ED930;
|
||||
FaultAddrConvClient D_801ED940;
|
||||
@@ -44,7 +44,7 @@ FaultAddrConvClient D_801ED940;
|
||||
void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) {
|
||||
ActorOverlay* overlayEntry;
|
||||
u32 overlaySize;
|
||||
s32 i;
|
||||
ActorId i;
|
||||
|
||||
FaultDrawer_SetCharPad(-2, 0);
|
||||
|
||||
@@ -63,7 +63,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) {
|
||||
void* ActorOverlayTable_FaultAddrConv(void* arg0, void* arg1) {
|
||||
u8* ptr = arg0;
|
||||
ActorOverlay* overlayEntry = &gActorOverlayTable[0];
|
||||
s32 i;
|
||||
ActorId i;
|
||||
u8* ramStart;
|
||||
u8* ramEnd;
|
||||
size_t size;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
//#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "z64quake.h"
|
||||
#include "z64shrink_window.h"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 arg4,
|
||||
CollisionPoly* colPoly, s32 arg6) {
|
||||
void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 angle,
|
||||
CollisionPoly* colPoly, s32 bgId) {
|
||||
Vec3s spB8;
|
||||
Vec3s spB0;
|
||||
EffectTireMarkElement* spAC;
|
||||
@@ -11,17 +11,17 @@ void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f
|
||||
u32 spA0;
|
||||
Vec3s* vtxList = colCtx->colHeader->vtxList;
|
||||
|
||||
if ((arg6 != 50) || (this->numElements >= (ARRAY_COUNT(this->elements) - 1)) || (colPoly == NULL)) {
|
||||
if ((bgId != 50) || (this->numElements >= (ARRAY_COUNT(this->elements) - 1)) || (colPoly == NULL)) {
|
||||
func_800AEF44(this);
|
||||
return;
|
||||
}
|
||||
|
||||
spB8.x = (Math_SinS(arg4 - 0x4000) * arg3) + pos->x;
|
||||
spB8.z = (Math_CosS(arg4 - 0x4000) * arg3) + pos->z;
|
||||
spB8.x = (Math_SinS(angle - 0x4000) * arg3) + pos->x;
|
||||
spB8.z = (Math_CosS(angle - 0x4000) * arg3) + pos->z;
|
||||
spB8.y = func_800BFD84(colPoly, spB8.x, spB8.z) + 2.0f;
|
||||
|
||||
spB0.x = (Math_SinS(arg4 + 0x4000) * arg3) + pos->x;
|
||||
spB0.z = (Math_CosS(arg4 + 0x4000) * arg3) + pos->z;
|
||||
spB0.x = (Math_SinS(angle + 0x4000) * arg3) + pos->x;
|
||||
spB0.z = (Math_CosS(angle + 0x4000) * arg3) + pos->z;
|
||||
spB0.y = func_800BFD84(colPoly, spB0.x, spB0.z) + 2.0f;
|
||||
|
||||
spAC = &this->elements[this->numElements - 1];
|
||||
|
||||
+39
-44
@@ -77,7 +77,7 @@ void func_80127B64(struct_801F58B0 arg0[], s32 count, Vec3f* arg2);
|
||||
|
||||
s32 func_801226E0(PlayState* play, s32 arg1) {
|
||||
if (arg1 == 0) {
|
||||
Play_SetupRespawnPoint(&play->state, RESPAWN_MODE_DOWN, 0xBFF);
|
||||
Play_SetupRespawnPoint(&play->state, RESPAWN_MODE_DOWN, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B));
|
||||
if (play->sceneId == SCENE_KAKUSIANA) {
|
||||
return 1;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void func_801229A0(PlayState* play, Player* player) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void func_801229EC(UNK_TYPE arg0, UNK_TYPE arg1) {
|
||||
void func_801229EC(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
s16 sMaskObjectIds[PLAYER_MASK_MAX - 1] = {
|
||||
@@ -185,7 +185,8 @@ void func_801229FC(Player* player) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_801F58B0); i++) {
|
||||
func_80127B64(D_801F58B0[i], ARRAY_COUNT(D_801F58B0[i]), &player->bodyPartsPos[7]);
|
||||
func_80127B64(D_801F58B0[i], ARRAY_COUNT(D_801F58B0[i]),
|
||||
&player->bodyPartsPos[PLAYER_BODYPART_HEAD]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +329,7 @@ void func_80122F28(Player* player) {
|
||||
(!(player->stateFlags1 & (PLAYER_STATE1_400 | PLAYER_STATE1_800 | PLAYER_STATE1_200000 | PLAYER_STATE1_800000 |
|
||||
PLAYER_STATE1_20000000))) &&
|
||||
(!(player->stateFlags2 & PLAYER_STATE2_1))) {
|
||||
if (player->doorType < 0) {
|
||||
if (player->doorType <= PLAYER_DOORTYPE_TALKING) {
|
||||
ActorCutscene_SetIntentToPlay(0x7C);
|
||||
} else {
|
||||
ActorCutscene_SetIntentToPlay(0x7D);
|
||||
@@ -354,27 +355,27 @@ void func_8012300C(PlayState* play, s32 arg1) {
|
||||
player->unk_B2B = arg1;
|
||||
}
|
||||
|
||||
void func_8012301C(Player* player, PlayState* play2) {
|
||||
void func_8012301C(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
s32 pad;
|
||||
Player* this = (Player*)thisx;
|
||||
|
||||
player->unk_AE7++;
|
||||
this->unk_AE7++;
|
||||
|
||||
if (player->unk_AE7 == 2) {
|
||||
s16 objectId = gPlayerFormObjectIndices[((void)0, gSaveContext.save.playerForm)];
|
||||
if (this->unk_AE7 == 2) {
|
||||
s16 objectId = gPlayerFormObjectIndices[GET_PLAYER_FORM];
|
||||
|
||||
gActorOverlayTable[ACTOR_PLAYER].initInfo->objectId = objectId;
|
||||
func_8012F73C(&play->objectCtx, player->actor.objBankIndex, objectId);
|
||||
player->actor.objBankIndex = Object_GetIndex(&play->objectCtx, GAMEPLAY_KEEP);
|
||||
} else if (player->unk_AE7 >= 3) {
|
||||
func_8012F73C(&play->objectCtx, this->actor.objBankIndex, objectId);
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, GAMEPLAY_KEEP);
|
||||
} else if (this->unk_AE7 >= 3) {
|
||||
s32 objBankIndex = Object_GetIndex(&play->objectCtx, gActorOverlayTable[ACTOR_PLAYER].initInfo->objectId);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, objBankIndex)) {
|
||||
player->actor.objBankIndex = objBankIndex;
|
||||
player->actor.shape.rot.z = gSaveContext.save.playerForm + 1;
|
||||
player->actor.init = PlayerCall_Init;
|
||||
player->actor.update = PlayerCall_Update;
|
||||
player->actor.draw = PlayerCall_Draw;
|
||||
this->actor.objBankIndex = objBankIndex;
|
||||
this->actor.shape.rot.z = GET_PLAYER_FORM + 1;
|
||||
this->actor.init = PlayerCall_Init;
|
||||
this->actor.update = PlayerCall_Update;
|
||||
this->actor.draw = PlayerCall_Draw;
|
||||
gSaveContext.save.equippedMask = PLAYER_MASK_NONE;
|
||||
}
|
||||
}
|
||||
@@ -456,7 +457,7 @@ void func_80123140(PlayState* play, Player* player) {
|
||||
|
||||
s32 Player_InBlockingCsMode(PlayState* play, Player* player) {
|
||||
return (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_20000000)) ||
|
||||
(player->csMode != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) ||
|
||||
(player->csMode != PLAYER_CSMODE_0) || (play->transitionTrigger == TRANS_TRIGGER_START) ||
|
||||
(play->transitionMode != TRANS_MODE_OFF) || (player->stateFlags1 & PLAYER_STATE1_1) ||
|
||||
(player->stateFlags3 & PLAYER_STATE3_80) || (play->actorCtx.unk268 != 0);
|
||||
}
|
||||
@@ -480,7 +481,7 @@ s32 func_80123448(PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
return (player->stateFlags1 & PLAYER_STATE1_400000) &&
|
||||
(player->transformation != PLAYER_FORM_HUMAN || (!func_80123434(player) && player->unk_730 == NULL));
|
||||
(player->transformation != PLAYER_FORM_HUMAN || (!func_80123434(player) && player->targetedActor == NULL));
|
||||
}
|
||||
|
||||
// TODO: Player_IsGoronOrDeku is a temporary name until we have more info on this function.
|
||||
@@ -536,7 +537,7 @@ ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
|
||||
}
|
||||
|
||||
if (arg2 == 0) {
|
||||
s32 item = Inventory_GetBtnBItem(play);
|
||||
ItemId item = Inventory_GetBtnBItem(play);
|
||||
|
||||
if (item >= ITEM_FD) {
|
||||
return item;
|
||||
@@ -558,27 +559,21 @@ ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
|
||||
}
|
||||
|
||||
if (arg2 == 1) {
|
||||
return (gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] != BTN_DISABLED) ? BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)
|
||||
: (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) ? BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)
|
||||
: ITEM_NONE;
|
||||
return C_BTN_ITEM(EQUIP_SLOT_C_LEFT);
|
||||
}
|
||||
|
||||
if (arg2 == 2) {
|
||||
return (gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] != BTN_DISABLED) ? BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)
|
||||
: (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) ? BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)
|
||||
: ITEM_NONE;
|
||||
return C_BTN_ITEM(EQUIP_SLOT_C_DOWN);
|
||||
}
|
||||
|
||||
return (gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] != BTN_DISABLED) ? BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)
|
||||
: (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) ? BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)
|
||||
: ITEM_NONE;
|
||||
return C_BTN_ITEM(EQUIP_SLOT_C_RIGHT);
|
||||
}
|
||||
|
||||
u16 sCItemButtons[] = { BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT };
|
||||
|
||||
s32 func_80123810(PlayState* play) {
|
||||
PlayerActionParam func_80123810(PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
s32 temp_v0;
|
||||
s32 actionParam;
|
||||
ItemId itemId;
|
||||
s32 i;
|
||||
|
||||
@@ -602,19 +597,19 @@ s32 func_80123810(PlayState* play) {
|
||||
play->interfaceCtx.unk_224 = 0;
|
||||
Interface_SetHudVisibility(play->msgCtx.unk_120BC);
|
||||
|
||||
if ((itemId >= ITEM_FD) || (temp_v0 = play->unk_18794(play, player, itemId, i), (temp_v0 < 0))) {
|
||||
if ((itemId >= ITEM_FD) || ((actionParam = play->unk_18794(play, player, itemId)) <= PLAYER_AP_MINUS1)) {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return -1;
|
||||
return PLAYER_AP_MINUS1;
|
||||
} else {
|
||||
s32 pad;
|
||||
|
||||
player->heldItemButton = i;
|
||||
return temp_v0;
|
||||
return actionParam;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return PLAYER_AP_NONE;
|
||||
}
|
||||
|
||||
// Used to map action params to model groups
|
||||
@@ -1249,7 +1244,7 @@ void func_80123C58(Player* player) {
|
||||
}
|
||||
|
||||
void Player_SetEquipmentData(PlayState* play, Player* player) {
|
||||
if (player->csMode != 0x86) {
|
||||
if (player->csMode != PLAYER_CSMODE_134) {
|
||||
player->currentShield = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD);
|
||||
if ((player->transformation != PLAYER_FORM_ZORA) || (((player->currentBoots != PLAYER_BOOTS_ZORA_LAND)) &&
|
||||
(player->currentBoots != PLAYER_BOOTS_ZORA_UNDERWATER))) {
|
||||
@@ -1263,7 +1258,7 @@ void Player_SetEquipmentData(PlayState* play, Player* player) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80123D50(PlayState* play, Player* player, ItemId itemId, PlayerActionParam actionParam) {
|
||||
void Player_UpdateBottleHeld(PlayState* play, Player* player, ItemId itemId, PlayerActionParam actionParam) {
|
||||
Inventory_UpdateBottleItem(play, itemId, player->heldItemButton);
|
||||
|
||||
if (itemId != ITEM_BOTTLE) {
|
||||
@@ -1275,7 +1270,7 @@ void func_80123D50(PlayState* play, Player* player, ItemId itemId, PlayerActionP
|
||||
}
|
||||
|
||||
void func_80123DA4(Player* player) {
|
||||
player->unk_730 = NULL;
|
||||
player->targetedActor = NULL;
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_2000;
|
||||
}
|
||||
|
||||
@@ -1300,7 +1295,7 @@ void func_80123E90(PlayState* play, Actor* actor) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
func_80123DC0(player);
|
||||
player->unk_730 = actor;
|
||||
player->targetedActor = actor;
|
||||
player->unk_A78 = actor;
|
||||
player->stateFlags1 |= PLAYER_STATE1_10000;
|
||||
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor);
|
||||
@@ -1333,7 +1328,7 @@ s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y
|
||||
}
|
||||
|
||||
u8 Player_GetStrength(void) {
|
||||
return sPlayerStrengths[(void)0, gSaveContext.save.playerForm];
|
||||
return sPlayerStrengths[GET_PLAYER_FORM];
|
||||
}
|
||||
|
||||
u8 Player_GetMask(PlayState* play) {
|
||||
@@ -2034,9 +2029,9 @@ void Player_DrawGetItem(PlayState* play, Player* player) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_400) {
|
||||
refPos.y = player->actor.world.pos.y + 30.0f;
|
||||
} else {
|
||||
refPos.x = player->bodyPartsPos[0xC].x;
|
||||
refPos.y = player->bodyPartsPos[0xC].y - 6.0f;
|
||||
refPos.z = player->bodyPartsPos[0xC].z;
|
||||
refPos.x = player->bodyPartsPos[PLAYER_BODYPART_LEFT_HAND].x;
|
||||
refPos.y = player->bodyPartsPos[PLAYER_BODYPART_LEFT_HAND].y - 6.0f;
|
||||
refPos.z = player->bodyPartsPos[PLAYER_BODYPART_LEFT_HAND].z;
|
||||
}
|
||||
} else {
|
||||
refPos.y = player->actor.world.pos.y + 28.0f;
|
||||
@@ -2045,7 +2040,7 @@ void Player_DrawGetItem(PlayState* play, Player* player) {
|
||||
Math_Vec3f_Copy(&refPos, &D_801F59E8);
|
||||
}
|
||||
|
||||
drawIdPlusOne = ABS_ALT(player->unk_B2A);
|
||||
drawIdPlusOne = ABS_ALT(player->getItemDrawId);
|
||||
Player_DrawGetItemImpl(play, player, &refPos, drawIdPlusOne);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -738,10 +738,10 @@ void Distortion_Update(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (player->unk_B88 < 0) {
|
||||
xyScaleFactor = (player->unk_B88 - (f32)0x4000) / (f32)0xC000;
|
||||
if (player->unk_B86[1] < 0) {
|
||||
xyScaleFactor = (player->unk_B86[1] - (f32)0x4000) / (f32)0xC000;
|
||||
} else {
|
||||
xyScaleFactor = (player->unk_B88 + (f32)0x4000) / (f32)0xC000;
|
||||
xyScaleFactor = (player->unk_B86[1] + (f32)0x4000) / (f32)0xC000;
|
||||
}
|
||||
zScaleFactor = -xyScaleFactor;
|
||||
speedScaleFactor = 1.0f;
|
||||
|
||||
+5
-4
@@ -148,8 +148,9 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
|
||||
play->linkActorEntry =
|
||||
(ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn;
|
||||
if ((play->linkActorEntry->params & 0x0F00) >> 8 == 0x0C ||
|
||||
(gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == 0x0CFF)) {
|
||||
if ((PLAYER_GET_INITMODE(play->linkActorEntry) == PLAYER_INITMODE_TELESCOPE) ||
|
||||
((gSaveContext.respawnFlag == 0x02) &&
|
||||
(gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)))) {
|
||||
// Skull Kid Object
|
||||
Object_Spawn(&play->objectCtx, OBJECT_STK);
|
||||
return;
|
||||
@@ -159,7 +160,7 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
nextObject = play->objectCtx.status[play->objectCtx.num].segment;
|
||||
play->objectCtx.num = loadedCount;
|
||||
play->objectCtx.spawnedObjectCount = loadedCount;
|
||||
playerObjectId = gPlayerFormObjectIndices[(void)0, gSaveContext.save.playerForm];
|
||||
playerObjectId = gPlayerFormObjectIndices[GET_PLAYER_FORM];
|
||||
gActorOverlayTable[0].initInfo->objectId = playerObjectId;
|
||||
Object_Spawn(&play->objectCtx, playerObjectId);
|
||||
|
||||
@@ -591,7 +592,7 @@ s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an entrance from the scene, spawn, and lyaer.
|
||||
* Creates an entrance from the scene, spawn, and layer.
|
||||
*/
|
||||
u16 Entrance_Create(s32 scene, s32 spawn, s32 layer) {
|
||||
return (scene << 9) | (spawn << 4) | layer;
|
||||
|
||||
+11
-11
@@ -996,7 +996,7 @@ void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animati
|
||||
|
||||
if (entry != NULL) {
|
||||
LinkAnimationHeader* linkAnimHeader = Lib_SegmentedToVirtual(animation);
|
||||
u32 ram = frameTable;
|
||||
uintptr_t ram = frameTable;
|
||||
|
||||
osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1);
|
||||
DmaMgr_SendRequestImpl(&entry->data.load.req, ram,
|
||||
@@ -1187,7 +1187,7 @@ void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) {
|
||||
* tables if not given.
|
||||
*/
|
||||
void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
|
||||
LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable,
|
||||
LinkAnimationHeader* animation, s32 flags, void* jointTableBuffer, void* morphTableBuffer,
|
||||
s32 limbBufCount) {
|
||||
FlexSkeletonHeader* skeletonHeader;
|
||||
s32 headerJointCount;
|
||||
@@ -1216,12 +1216,12 @@ void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeade
|
||||
allocSize += 2;
|
||||
}
|
||||
|
||||
if (jointTable == NULL) {
|
||||
if (jointTableBuffer == NULL) {
|
||||
skelAnime->jointTable = ZeldaArena_Malloc(allocSize);
|
||||
skelAnime->morphTable = ZeldaArena_Malloc(allocSize);
|
||||
} else {
|
||||
skelAnime->jointTable = (Vec3s*)ALIGN16((u32)jointTable);
|
||||
skelAnime->morphTable = (Vec3s*)ALIGN16((u32)morphTable);
|
||||
skelAnime->jointTable = (void*)ALIGN16((uintptr_t)jointTableBuffer);
|
||||
skelAnime->morphTable = (void*)ALIGN16((uintptr_t)morphTableBuffer);
|
||||
}
|
||||
|
||||
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
|
||||
@@ -1443,12 +1443,12 @@ void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 w
|
||||
* Requests loading frame data from the Link animations and blending them, placing the result in jointTable
|
||||
*/
|
||||
void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1,
|
||||
LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable) {
|
||||
Vec3s* alignedBlendTable;
|
||||
LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer) {
|
||||
void* alignedBlendTable;
|
||||
|
||||
AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable);
|
||||
|
||||
alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable);
|
||||
alignedBlendTable = (void*)ALIGN16((uintptr_t)blendTableBuffer);
|
||||
|
||||
AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
|
||||
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight);
|
||||
@@ -1458,12 +1458,12 @@ void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnima
|
||||
* Requests loading frame data from the Link animations and blending them, placing the result in morphTable
|
||||
*/
|
||||
void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1,
|
||||
LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable) {
|
||||
Vec3s* alignedBlendTable;
|
||||
LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer) {
|
||||
void* alignedBlendTable;
|
||||
|
||||
AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable);
|
||||
|
||||
alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable);
|
||||
alignedBlendTable = (void*)ALIGN16((uintptr_t)blendTableBuffer);
|
||||
|
||||
AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
|
||||
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight);
|
||||
|
||||
@@ -918,9 +918,9 @@ void Sram_InitDebugSave(void) {
|
||||
Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDebugInventory, sizeof(Inventory));
|
||||
Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum));
|
||||
|
||||
if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm)];
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm)];
|
||||
if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[GET_PLAYER_FORM];
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[GET_PLAYER_FORM];
|
||||
}
|
||||
|
||||
gSaveContext.save.hasTatl = true;
|
||||
|
||||
Reference in New Issue
Block a user