From efc9df3f56046bf11097715204aee96d433a952e Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sun, 28 May 2023 17:41:37 -0400 Subject: `ovl_player_actor`: Dawn of a new PR (#1227) * Rename Player_UpdateBottleHeld * Match func_808497A0 * func_80852290 NON_MATCHING * Match func_8083B3B4 * Params cleanup * Match func_8083FBC4 * sfxId cleanups and others * Fix declaration of functions from D_8085D990 * Change D_8085BE84 to be a 2D array * ARRAY_COUNT_2D * Match func_8085ADA0 * func_808426F0 nonmatching * Match func_80852290 * Match func_808426F0 Co-authored-by: engineer124 * Add notes to Player_SetDoAction * Name putAwayCountdown * rebase * Match func_80856918 * format * func_8084933C nonmatching small amount of boomerang documentation * Progress on moving data near where it is used * finish moving data * format * cleanup up remaining data * more match * Some minor cleanups * PlayerCsMode enum * func_80851F18 nonmatching * Fix unk_B10 * Purge ExchangeItemID enum * Rename `targetActor` to `talkActor` * Name `targetedActor` * PLAYER_LIMB_BUF_SIZE Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com> * Change SkelAnime Player functions to take a void pointer for the corresponding buffers * Use PlayerAnimationFrame on Player_DrawImpl * Match func_8082F1AC * Match func_8083D23C * cleanup * Match and clean up func_808373F8 * Match and document func_8083A98C * PLAYER_PARAMS macro and PlayerInitMode enum * Preliminary names for InitMode functions * Match func_8083C8E8 * remove redundant externs * Match func_8084933C * cleanup func_8084933C * Access D_8085BE84 directly instead of using a macro * Match func_8084AC84 * Fix boomearng typo * OK boomerang * cleanup func_8083D168 * untargetedRotY * this->unk_14E = ABS_ALT(var_v1); * GIFIELD macros * sort of a match * Match func_8084C16C Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com> * Use the same trick to match func_808573A4 * Add note on Deku spinning * Match func_8084D18C * Match func_80850D68 * Improve func_80832660 * Match func_80854EFC Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com> * Rename unk_B2A to getItemDrawId * Some cleanup * fix merge issues * format * minor anim docs * Match func_808553F4 * Cleanup func_808553F4 * func_8083D860 nonmatching * Match func_8083D860 * Defake func_80859BA8 * () * Add notes to PlayerAnimGroup enum * underwaterTimer Co-authored-by: engineer124 * some stateFlags cleaning * more stateFlags cleaning * some notes and minor cleanups * more general cleanups * Slightly less fake func_80832CAC * Document some melee weapon damage stuff * Mark lunge storage * Note PCS patch * match * add notes to bss * yeet extra indentation * add reloc as nonmatching to spec * floorSfxOffset * Player_GetFloorSfx * Player_GetFloorSfxByAge * Comments for AnimSfx dunctions * Name some AnimSfx functions * Name AnimSfx stuff * Some PlayerAgeProperties notes * use animflag defines * Player_SpawnExplosive * fix enum and some other minor fixes * Bit more misc. cleanup * Use OoT's version of func_808333CC * Note on quickspin buffer * Final nonmatching, func_80851F18 Co-authored-by: Synray <31429825+Synray@users.noreply.github.com> * RIP player.c * Name Player_StopHorizontalMovement * misc fixes * Actor_DeactivateLens * fixes * typos and tweaks * minor stuff * add names as comments on the animgoup array * Correct some function names and data type * add anim commets to ageproperties * some notes * De-fake func_80840F90 * Defake & clean up func_8085ADA0 * Improve func_80859BA8 * Enums in func_80852B28 * Name some secret-related things * 3 small things * stuff * Player_TalkWithPlayer * SurfaceType_GetFloorType * SurfaceType_GetWallFlags * and more bgcheck stuff * more bss naming * sPlayerControlInput * clean up func_80836F10 a bit * name the parameters of func_80835BF8 * door stuff * remove NON_MATCHING * remove D_8085D2B0 padding * Name some Player_Cutscene_ functions * various cleanups * format * remainingHopsCounter * some cleanups on the struct * Actor_RequestRumble * this->exchangeItemId = PLAYER_AP_NONE; * fix merge stuff * format * PlayerUnkAA5 * Name two cylinder-related functions * BSS * Add MagicConsume's enum, treat lensActive as bool * Update func_808332A0 based on better info * fix merge * fix merge issues * remove redundant comments * Name Player_AddQuake * ANIM_FLAG_UPDATE*_*Y * Format * AT_TYPE_ENEMY * fix merge issues * format * fix uintptr_ts * Rename * Name leftHandMf * fix merge issues * format * exchangeItemId <= PLAYER_IA_MINUS1 * getItemDrawIdPlusOne * currentActorCsIndex * <= PLAYER_IA_MINUS1 * fix merge issues * format * namefixer and bss * fix build * bombs parameters cleanup * bss * Fix building * fix building * Fix building * Fix building and cleanups * Pre-PR cleanup * really... * format * review * stateFlag Mistakes * 268 * 0.1f * z64door.h * fix cutscene stuff * bss * Update include/z64player.h Co-authored-by: EllipticEllipsis * Update include/z64player.h Co-authored-by: EllipticEllipsis * reiew * PR Review * collision * review * format and a few stuff i missed * EnBomExplosiveType * weekeventregconvert and eventinfconvert * more review * review * bss * review * re format sGetItemTable * Entangle PlayerMask and PlayerItemAction * a few extra cases i missed * bss * review * EnArrow stuff * ARROW_MAGIC_DEKU_BUBBLE * minor format * merge * fix bss * review * !ARROW_IS_ARROW * review * bool cleanup * fix merge * review * Player_StopCutscene * Player_RequestQuake * quakeIndex * Player_RequestQuakeAndRumble * knobDoor and slidingDoor * bss * fix * review * dog and float --------- Co-authored-by: Elliptic Ellipsis Co-authored-by: engineer124 Co-authored-by: petrie911 Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com> Co-authored-by: Synray <31429825+Synray@users.noreply.github.com> --- src/code/z_player_lib.c | 58 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'src/code/z_player_lib.c') diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index f8b33b853..5509fd4a1 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -472,7 +472,7 @@ void func_80123140(PlayState* play, Player* player) { REG(39) = bootRegs[8]; REG(43) = bootRegs[9]; R_RUN_SPEED_LIMIT = bootRegs[10]; - REG(68) = bootRegs[11]; + REG(68) = bootRegs[11]; // gravity REG(69) = bootRegs[12]; IREG(66) = bootRegs[13]; IREG(67) = bootRegs[14]; @@ -503,7 +503,7 @@ s32 Player_InBlockingCsMode(PlayState* play, Player* player) { s32 Player_InCsMode(PlayState* play) { Player* player = GET_PLAYER(play); - return Player_InBlockingCsMode(play, player) || player->unk_AA5 == 5; + return Player_InBlockingCsMode(play, player) || (player->unk_AA5 == PLAYER_UNKAA5_5); } s32 func_80123420(Player* player) { @@ -556,8 +556,8 @@ s32 func_801235DC(PlayState* play, f32 arg1, s16 arg2) { Player* player = GET_PLAYER(play); if (player->stateFlags3 & PLAYER_STATE3_1000) { - player->unk_B08[0] = arg1; - player->unk_B08[1] += arg1 * 0.05f; + player->unk_B08 = arg1; + player->unk_B0C += arg1 * 0.05f; player->currentYaw = arg2; player->actor.home.rot.y = arg2; player->actor.shape.rot.y = arg2; @@ -659,7 +659,7 @@ u8 sActionModelGroups[PLAYER_IA_MAX] = { PLAYER_MODELGROUP_ONE_HAND_SWORD, // PLAYER_IA_SWORD_KOKIRI PLAYER_MODELGROUP_ONE_HAND_SWORD, // PLAYER_IA_SWORD_RAZOR PLAYER_MODELGROUP_ONE_HAND_SWORD, // PLAYER_IA_SWORD_GILDED - PLAYER_MODELGROUP_TWO_HAND_SWORD, // PLAYER_IA_SWORD_GREAT_FAIRY + PLAYER_MODELGROUP_TWO_HAND_SWORD, // PLAYER_IA_SWORD_TWO_HANDED PLAYER_MODELGROUP_STICK, // PLAYER_IA_STICK PLAYER_MODELGROUP_ZORA_FINS, // PLAYER_IA_ZORA_FINS PLAYER_MODELGROUP_BOW, // PLAYER_IA_BOW @@ -1316,6 +1316,7 @@ void Player_UpdateBottleHeld(PlayState* play, Player* player, ItemId itemId, Pla player->itemAction = itemAction; } +// Player_Untarget / Player_StopTargeting? void func_80123DA4(Player* player) { player->targetedActor = NULL; player->stateFlags2 &= ~PLAYER_STATE2_2000; @@ -1445,7 +1446,7 @@ PlayerMeleeWeapon Player_GetMeleeWeaponHeld(Player* player) { s32 Player_IsHoldingTwoHandedWeapon(Player* player) { // Relies on the itemActions for two-handed weapons being contiguous. - if ((player->heldItemAction >= PLAYER_IA_SWORD_GREAT_FAIRY) && (player->heldItemAction <= PLAYER_IA_STICK)) { + if ((player->heldItemAction >= PLAYER_IA_SWORD_TWO_HANDED) && (player->heldItemAction <= PLAYER_IA_STICK)) { return true; } @@ -2038,7 +2039,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** pos->x *= player->ageProperties->unk_08; pos->z *= player->ageProperties->unk_08; } - if (!(player->skelAnime.moveFlags & ANIM_FLAG_4) || (player->skelAnime.moveFlags & ANIM_FLAG_UPDATEY)) { + if (!(player->skelAnime.moveFlags & ANIM_FLAG_4) || (player->skelAnime.moveFlags & ANIM_FLAG_UPDATE_Y)) { pos->y *= player->ageProperties->unk_08; } } @@ -2552,14 +2553,16 @@ void func_8012669C(PlayState* play, Player* player, Vec3f* arg2, Vec3f* arg3) { Matrix_MultVec3f(arg2, &sp3C); Matrix_MultVec3f(arg3, &sp30); - if (player->meleeWeaponState != 0) { + if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if (func_80126440(play, NULL, &player->meleeWeaponInfo[0], &sp3C, &sp30) && (player->transformation != PLAYER_FORM_GORON) && (!(player->stateFlags1 & PLAYER_STATE1_400000))) { EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[0]), &player->meleeWeaponInfo[0].tip, &player->meleeWeaponInfo[0].base); } - if ((player->meleeWeaponState > 0) && ((player->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || - (player->stateFlags2 & PLAYER_STATE2_20000))) { + + if ((player->meleeWeaponState >= PLAYER_MELEE_WEAPON_STATE_1) && + ((player->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || + (player->stateFlags2 & PLAYER_STATE2_20000))) { Matrix_MultVec3f(&arg2[1], &sp3C); Matrix_MultVec3f(&arg3[1], &sp30); func_80126440(play, &player->meleeWeaponQuads[0], &player->meleeWeaponInfo[1], &sp3C, &sp30); @@ -2714,7 +2717,7 @@ void func_80126BD0(PlayState* play, Player* player, s32 arg2) { gSPDisplayList(POLY_OPA_DISP++, D_801C0AB4[arg2]); - if (player->meleeWeaponState != 0) { + if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if ((((player->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_LEFT)) && (arg2 == 0)) || ((player->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_COMBO) && (arg2 != 0))) { func_8012669C(play, player, D_801C0A00, D_801C09DC); @@ -3296,7 +3299,7 @@ s32 func_80128640(PlayState* play, Player* player, Gfx* dlist) { Matrix_Push(); Matrix_Translate(-428.26f, 267.2f, -33.82f, MTXMODE_APPLY); Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY); - Matrix_Scale(1.0f, player->unk_B08[1], 1.0f, MTXMODE_APPLY); + Matrix_Scale(1.0f, player->unk_B0C, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuStickDL); @@ -3413,7 +3416,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G 3000.0f, // PLAYER_MELEEWEAPON_SWORD_KOKIRI 3000.0f, // PLAYER_MELEEWEAPON_SWORD_RAZOR 4000.0f, // PLAYER_MELEEWEAPON_SWORD_GILDED - 5500.0f, // PLAYER_MELEEWEAPON_SWORD_GREAT_FAIRY + 5500.0f, // PLAYER_MELEEWEAPON_SWORD_TWO_HANDED -1.0f, // PLAYER_MELEEWEAPON_STICK 2500.0f, // PLAYER_MELEEWEAPON_ZORA_FINS }; @@ -3421,19 +3424,19 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G if ((player->transformation == PLAYER_FORM_FIERCE_DEITY) || ((player->transformation != PLAYER_FORM_ZORA) && ((player->itemAction == PLAYER_IA_STICK) || - ((player->meleeWeaponState != 0) && + ((player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && (player->meleeWeaponAnimation != PLAYER_MWA_GORON_PUNCH_RIGHT) && (player->meleeWeaponAnimation != PLAYER_MWA_GORON_PUNCH_BUTT))))) { if (player->itemAction == PLAYER_IA_STICK) { - D_801C0994->x = player->unk_B08[1] * 5000.0f; + D_801C0994->x = player->unk_B0C * 5000.0f; } else { D_801C0994->x = sMeleeWeaponLengths[Player_GetMeleeWeaponHeld(player)]; } func_80126B8C(play, player); } - Matrix_Get(&player->mf_CC4); - Matrix_MtxFToYXZRot(&player->mf_CC4, &player->leftHandWorld.rot, false); + Matrix_Get(&player->leftHandMf); + Matrix_MtxFToYXZRot(&player->leftHandMf, &player->leftHandWorld.rot, false); } } } else if (limbIndex == PLAYER_LIMB_RIGHT_HAND) { @@ -3458,18 +3461,18 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G Matrix_MultZero(&sp20C); temp_fv0 = Math_Vec3f_DistXYZ(sPlayerCurBodyPartPos, &sp20C); - player->unk_B08[0] = temp_fv0 - 3.0f; + player->unk_B08 = temp_fv0 - 3.0f; if (temp_fv0 < 3.0f) { - player->unk_B08[0] = 0.0f; + player->unk_B08 = 0.0f; } else { - player->unk_B08[0] *= 1.6f; - if (player->unk_B08[0] > 1.0f) { - player->unk_B08[0] = 1.0f; + player->unk_B08 *= 1.6f; + if (player->unk_B08 > 1.0f) { + player->unk_B08 = 1.0f; } } - player->unk_B08[1] = -0.5f; + player->unk_B0C = -0.5f; } - Matrix_Scale(1.0f, player->unk_B08[0], 1.0f, MTXMODE_APPLY); + Matrix_Scale(1.0f, player->unk_B08, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -3518,7 +3521,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G Player_DrawHookshotReticle(play, player, 77600.0f); } } - } else if (player->meleeWeaponState != 0) { + } else if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if (player->meleeWeaponAnimation == PLAYER_MWA_GORON_PUNCH_RIGHT) { func_80126B8C(play, player); } @@ -3590,6 +3593,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G for (i = 0; i < ARRAY_COUNT(sp178); i++) { Matrix_Push(); Matrix_Scale(sp178[i].x, sp178[i].y, sp178[i].z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -3811,7 +3815,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G &player->meleeWeaponInfo[0].base); } } else if (limbIndex == PLAYER_LIMB_RIGHT_SHIN) { - if (player->meleeWeaponState != 0) { + if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if ((player->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_KICK) || (player->meleeWeaponAnimation == PLAYER_MWA_ZORA_JUMPKICK_START) || (player->meleeWeaponAnimation == PLAYER_MWA_ZORA_JUMPKICK_FINISH)) { @@ -3819,7 +3823,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G } } } else if (limbIndex == PLAYER_LIMB_WAIST) { - if (player->meleeWeaponState != 0) { + if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if (player->meleeWeaponAnimation == PLAYER_MWA_GORON_PUNCH_BUTT) { Math_Vec3f_Copy(&player->unk_AF0[1], &player->meleeWeaponInfo[0].base); func_8012669C(play, player, D_801C0A90, D_801C0A6C); -- cgit v1.2.3