1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

[ntsc-1.0/1.1] Match z_player.c (#2232)

* [ntsc-1.0/1.1] Match z_player.c

* Move braces around

* Use #if around only part of complicated conditions
This commit is contained in:
cadmic 2024-09-27 01:56:58 -07:00 committed by GitHub
parent ca70ba14a2
commit 2e6637ae43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -234,7 +234,9 @@ void func_808521F4(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_80852234(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_8085225C(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue);
#if OOT_VERSION >= PAL_1_0
void func_80852358(PlayState* play, Player* this, CsCmdActorCue* cue);
#endif
void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_80852298(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_80852328(PlayState* play, Player* this, CsCmdActorCue* cue);
@ -1725,12 +1727,20 @@ void Player_DetachHeldActor(PlayState* play, Player* this) {
this->interactRangeActor = NULL;
heldActor->parent = NULL;
this->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR;
}
#if OOT_VERSION < NTSC_1_1
if (Player_GetExplosiveHeld(this) >= 0) {
Player_InitItemAction(play, this, PLAYER_IA_NONE);
this->heldItemId = ITEM_NONE_FE;
}
#endif
}
#if OOT_VERSION >= NTSC_1_1
if (Player_GetExplosiveHeld(this) >= 0) {
Player_InitItemAction(play, this, PLAYER_IA_NONE);
this->heldItemId = ITEM_NONE_FE;
}
#endif
}
void func_80832440(PlayState* play, Player* this) {
@ -1915,10 +1925,13 @@ void Player_ProcessAnimSfxList(Player* this, AnimSfxEntry* entry) {
Player_PlayJumpingSfx(this);
} else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_WALKING)) {
Player_PlaySteppingSfx(this, 0.0f);
} else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_UNKNOWN)) {
}
#if OOT_VERSION >= PAL_1_0
else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_UNKNOWN)) {
func_800F4010(&this->actor.projectedPos,
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD + this->ageProperties->unk_94, 0.0f);
}
#endif
}
cont = (entry->data >= 0); // stop processing if `data` is negative
@ -2204,6 +2217,14 @@ void Player_SetUpperActionFunc(Player* this, UpperActionFunc upperActionFunc) {
func_808326F0(this);
}
#if OOT_VERSION < NTSC_1_1
s32 Player_GetMeleeWeaponHeld2(Player* this) {
return Player_GetMeleeWeaponHeld(this);
}
#else
#define Player_GetMeleeWeaponHeld2 Player_GetMeleeWeaponHeld
#endif
void Player_InitItemActionWithAnim(PlayState* play, Player* this, s8 itemAction) {
LinkAnimationHeader* current = this->skelAnime.animation;
LinkAnimationHeader** iter = D_80853914 + this->modelAnimType;
@ -2242,6 +2263,14 @@ s8 Player_ItemToItemAction(s32 item) {
void Player_InitDefaultIA(PlayState* play, Player* this) {
}
#if OOT_VERSION < NTSC_1_1
s32 Player_HoldsTwoHandedWeapon2(Player* this) {
return Player_HoldsTwoHandedWeapon(this);
}
#else
#define Player_HoldsTwoHandedWeapon2 Player_HoldsTwoHandedWeapon
#endif
void Player_InitDekuStickIA(PlayState* play, Player* this) {
this->unk_85C = 1.0f;
}
@ -2314,7 +2343,9 @@ void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) {
this->heldItemAction = this->itemAction = itemAction;
this->modelGroup = this->nextModelGroup;
#if OOT_VERSION >= NTSC_1_1
this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_USING_BOOMERANG);
#endif
sItemActionInitFuncs[itemAction](play, this);
@ -2583,7 +2614,10 @@ void Player_StartChangingHeldItem(Player* this, PlayState* play) {
}
void Player_UpdateItems(Player* this, PlayState* play) {
if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) &&
if ((this->actor.category == ACTORCAT_PLAYER) &&
#if OOT_VERSION >= NTSC_1_1
!(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) &&
#endif
((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) &&
(gSaveContext.save.info.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE) &&
(this->csAction == PLAYER_CSACTION_NONE) && (play->shootingGalleryStatus == 0) &&
@ -3102,21 +3136,35 @@ void func_80835688(Player* this, PlayState* play) {
}
s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) {
#if OOT_VERSION >= NTSC_1_1
Actor* heldActor = this->heldActor;
if (heldActor == NULL) {
func_80834644(play, this);
}
#endif
if (func_80834758(play, this)) {
return true;
}
if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) {
#if OOT_VERSION < NTSC_1_1
Actor* heldActor;
#endif
if (LinkAnimation_Update(play, &this->upperSkelAnime)) {
LinkAnimation_PlayLoop(play, &this->upperSkelAnime, &gPlayerAnim_link_normal_carryB_wait);
}
#if OOT_VERSION < NTSC_1_1
heldActor = this->heldActor;
if (heldActor == NULL) {
func_80834644(play, this);
return true;
}
#endif
if ((heldActor->id == ACTOR_EN_NIW) && (this->actor.velocity.y <= 0.0f)) {
this->actor.minVelocityY = -2.0f;
this->actor.gravity = -0.5f;
@ -6336,8 +6384,8 @@ void func_8083C50C(Player* this) {
s32 Player_ActionHandler_8(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) {
if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) &&
(this->heldItemAction != PLAYER_IA_DEKU_STICK)) {
if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld2(this) != 0) &&
(this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) {
if ((this->heldItemAction != PLAYER_IA_SWORD_BIGGORON) ||
(gSaveContext.save.info.playerData.swordHealth > 0.0f)) {
func_808377DC(play, this);
@ -6389,15 +6437,26 @@ s32 func_8083C6B8(PlayState* play, Player* this) {
rodCheckPos.y += 50.0f;
#if OOT_VERSION < NTSC_1_1
if (BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f))
#else
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) ||
BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)) {
BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f))
#endif
{
Sfx_PlaySfxCentered(NA_SE_SY_ERROR);
return 0;
}
#if OOT_VERSION < NTSC_1_1
this->unk_860 = 1;
Player_SetupAction(play, this, Player_Action_80850C68, 0);
#else
Player_SetupAction(play, this, Player_Action_80850C68, 0);
this->unk_860 = 1;
Player_ZeroSpeedXZ(this);
#endif
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_fishing_throw);
return 1;
} else {
@ -6571,7 +6630,12 @@ s32 func_8083CFA8(PlayState* play, Player* this, f32 arg2, s32 splashScale) {
splashPos.z = this->bodyPartsPos[PLAYER_BODYPART_WAIST].z;
sp34 = this->actor.world.pos.y;
if (WaterBox_GetSurface1(play, &play->colCtx, splashPos.x, splashPos.z, &sp34, &sp38)) {
if ((sp34 - this->actor.world.pos.y) < 100.0f) {
#if OOT_VERSION < PAL_1_0
if ((sp34 - this->actor.world.pos.y) < 80.0f)
#else
if ((sp34 - this->actor.world.pos.y) < 100.0f)
#endif
{
splashType = (sp3C <= 10.0f) ? 0 : 1;
splashPos.y = sp34;
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, splashType, splashScale);
@ -7957,7 +8021,7 @@ void func_808409CC(PlayState* play, Player* this) {
sp34 = Rand_ZeroOne() * 5.0f;
if (sp34 < 4) {
if (((sp34 != 0) && (sp34 != 3)) || ((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) &&
((sp34 == 3) || (Player_GetMeleeWeaponHeld(this) != 0)))) {
((sp34 == 3) || (Player_GetMeleeWeaponHeld2(this) != 0)))) {
if ((sp34 == 0) && Player_HoldsTwoHandedWeapon(this)) {
sp34 = 4;
}
@ -8348,7 +8412,7 @@ void Player_Action_80841BA8(Player* this, PlayState* play) {
LinkAnimation_Update(play, &this->skelAnime);
if (Player_HoldsTwoHandedWeapon(this)) {
if (Player_HoldsTwoHandedWeapon2(this)) {
AnimTaskQueue_AddLoadPlayerFrame(play, Player_GetIdleAnimationForCurrentModelAnimType(this), 0,
this->skelAnime.limbCount, this->skelAnime.morphTable);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
@ -8633,7 +8697,7 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) {
}
s32 func_808428D8(Player* this, PlayState* play) {
if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && sUseHeldItem) {
if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld2(this) != 0) && sUseHeldItem) {
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru);
this->av1.actionVar1 = 1;
this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H;
@ -9037,10 +9101,12 @@ void Player_Action_80843954(Player* this, PlayState* play) {
}
}
#if OOT_VERSION >= PAL_1_0
static AnimSfxEntry D_808545DC[] = {
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 20) },
{ 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 30) },
};
#endif
void Player_Action_80843A38(Player* this, PlayState* play) {
s32 interruptResult;
@ -9059,7 +9125,9 @@ void Player_Action_80843A38(Player* this, PlayState* play) {
}
}
#if OOT_VERSION >= PAL_1_0
Player_ProcessAnimSfxList(this, D_808545DC);
#endif
}
static Vec3f D_808545E4 = { 0.0f, 0.0f, 5.0f };
@ -9128,11 +9196,14 @@ void Player_Action_80843CEC(Player* this, PlayState* play) {
if (this->skelAnime.animation == &gPlayerAnim_link_derth_rebirth) {
Player_ProcessAnimSfxList(this, D_808545F0);
} else if (this->skelAnime.animation == &gPlayerAnim_link_normal_electric_shock_end) {
}
#if OOT_VERSION >= PAL_1_0
else if (this->skelAnime.animation == &gPlayerAnim_link_normal_electric_shock_end) {
if (LinkAnimation_OnFrame(&this->skelAnime, 88.0f)) {
Player_PlayFloorSfx(this, NA_SE_PL_BOUND);
}
}
#endif
}
void func_80843E14(Player* this, u16 sfxId) {
@ -9761,7 +9832,11 @@ void Player_Action_80845668(Player* this, PlayState* play) {
if (LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) {
func_8083D0A8(play, this, 10.0f);
}
#if OOT_VERSION < PAL_1_0
temp3 = 68.0f;
#else
temp3 = 50.0f;
#endif
} else if (this->skelAnime.animation == &gPlayerAnim_link_normal_150step_up) {
temp3 = 30.0f;
} else if (this->skelAnime.animation == &gPlayerAnim_link_normal_100step_up) {
@ -10404,7 +10479,12 @@ void Player_Init(Actor* thisx, PlayState* play2) {
(gEntranceTable[((void)0, gSaveContext.save.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].field &
ENTRANCE_INFO_DISPLAY_TITLE_CARD_FLAG) &&
((play->sceneId != SCENE_DODONGOS_CAVERN) || GET_EVENTCHKINF(EVENTCHKINF_B0)) &&
((play->sceneId != SCENE_BOMBCHU_SHOP) || GET_EVENTCHKINF(EVENTCHKINF_25))) {
#if OOT_VERSION < PAL_1_0
((play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY) || GET_EVENTCHKINF(EVENTCHKINF_25))
#else
((play->sceneId != SCENE_BOMBCHU_SHOP) || GET_EVENTCHKINF(EVENTCHKINF_25))
#endif
) {
TitleCard_InitPlaceName(play, &play->actorCtx.titleCtx, this->giObjectSegment, 160, 120, 144, 24, 20);
}
}
@ -13558,10 +13638,12 @@ void func_8084E988(Player* this) {
Player_ProcessAnimSfxList(this, D_808549F0);
}
#if OOT_VERSION >= PAL_1_0
static AnimSfxEntry D_808549F4[] = {
{ NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 5) },
{ 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 15) },
};
#endif
void Player_Action_8084E9AC(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
@ -13579,11 +13661,19 @@ void Player_Action_8084E9AC(Player* this, PlayState* play) {
return;
}
#if OOT_VERSION < PAL_1_0
if (!LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 5.0f)) {
Player_PlayVoiceSfx(this, NA_SE_VO_LI_AUTO_JUMP);
} else if (LINK_IS_ADULT) {
func_8084E988(this);
}
#else
if (!LINK_IS_ADULT) {
Player_ProcessAnimSfxList(this, D_808549F4);
} else {
func_8084E988(this);
}
#endif
}
}
@ -14731,7 +14821,11 @@ static struct_80854B18 D_80854E50[PLAYER_CSACTION_MAX] = {
{ 11, NULL }, // PLAYER_CSACTION_55
{ 11, NULL }, // PLAYER_CSACTION_56
{ 12, &gPlayerAnim_clink_demo_mimawasi_wait }, // PLAYER_CSACTION_57
#if OOT_VERSION < PAL_1_0
{ 12, &gPlayerAnim_link_demo_nozokikomi_wait }, // PLAYER_CSACTION_58
#else
{ -1, func_80852358 }, // PLAYER_CSACTION_58
#endif
{ 11, NULL }, // PLAYER_CSACTION_59
{ 18, D_80854B14 }, // PLAYER_CSACTION_60
{ 11, NULL }, // PLAYER_CSACTION_61
@ -15092,10 +15186,12 @@ static struct_808551A4 D_808551A4[] = {
{ NA_SE_IT_SWORD_STICK_STN, NA_SE_VO_LI_SWORD_N },
};
#if OOT_VERSION >= PAL_1_0
static AnimSfxEntry D_808551AC[] = {
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 29) },
{ 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 39) },
};
#endif
void func_80851A50(PlayState* play, Player* this, CsCmdActorCue* cue) {
struct_808551A4* sp2C;
@ -15124,7 +15220,9 @@ void func_80851A50(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_L);
}
} else {
#if OOT_VERSION >= PAL_1_0
Player_ProcessAnimSfxList(this, D_808551AC);
#endif
}
}
@ -15249,10 +15347,17 @@ void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) {
}
static AnimSfxEntry D_808551C8[] = {
#if OOT_VERSION < PAL_1_0
{ NA_SE_PL_LAND, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 67) },
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 84) },
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 90) },
{ 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 96) },
#else
{ NA_SE_PL_LAND + SURFACE_SFX_OFFSET_WOOD, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 67) },
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_UNKNOWN, 84) },
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_UNKNOWN, 90) },
{ 0, -ANIMSFX_DATA(ANIMSFX_TYPE_UNKNOWN, 96) },
#endif
};
void func_80852048(PlayState* play, Player* this, CsCmdActorCue* cue) {
@ -15340,6 +15445,7 @@ void func_80852328(PlayState* play, Player* this, CsCmdActorCue* cue) {
func_80851F14(play, this, &gPlayerAnim_link_demo_furimuki2_wait, D_808551E0);
}
#if OOT_VERSION >= PAL_1_0
static AnimSfxEntry D_808551E8[] = {
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 15) },
{ 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 35) },
@ -15348,6 +15454,7 @@ static AnimSfxEntry D_808551E8[] = {
void func_80852358(PlayState* play, Player* this, CsCmdActorCue* cue) {
func_80851F14(play, this, &gPlayerAnim_link_demo_nozokikomi_wait, D_808551E8);
}
#endif
void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue) {
if (LinkAnimation_Update(play, &this->skelAnime)) {