1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

Player Docs: Propose Named Unions For Shared Variables (#1560)

* make unions

* format

* adjust comment on halt thing
This commit is contained in:
fig02 2023-10-07 19:25:45 -04:00 committed by GitHub
parent ebc6ebf232
commit 181b438393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 343 additions and 332 deletions

View file

@ -731,7 +731,10 @@ typedef struct Player {
/* 0x0450 */ Vec3f unk_450;
/* 0x045C */ Vec3f unk_45C;
/* 0x0468 */ char unk_468[0x002];
/* 0x046A */ s16 doorBgCamIndex;
/* 0x046A */ union {
s16 haltActorsDuringCsAction; // If true, halt actors belonging to certain categories during a `csAction`
s16 slidingDoorBgCamIndex; // `BgCamIndex` used during a sliding door cutscene
} cv; // "Cutscene Variable": context dependent variable that has different meanings depending on what function is called
/* 0x046C */ s16 subCamId;
/* 0x046E */ char unk_46E[0x02A];
/* 0x0498 */ ColliderCylinder cylinder;
@ -789,8 +792,15 @@ typedef struct Player {
/* 0x0846 */ u8 unk_846;
/* 0x0847 */ s8 unk_847[4];
/* 0x084B */ s8 unk_84B[4];
/* 0x084F */ s8 actionVar1; // context dependent variable that has different meanings depending on what action is currently running
/* 0x0850 */ s16 actionVar2; // context dependent variable that has different meanings depending on what action is currently running
/* 0x084F */ union {
s8 actionVar1;
} av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running
/* 0x0850 */ union {
s16 actionVar2;
} av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running
/* 0x0854 */ f32 unk_854;
/* 0x0858 */ f32 unk_858;
/* 0x085C */ f32 unk_85C; // stick length among other things

View file

@ -1062,7 +1062,7 @@ s32 func_8002DF38(PlayState* play, Actor* actor, u8 csAction) {
player->csAction = csAction;
player->unk_448 = actor;
player->doorBgCamIndex = 0;
player->cv.haltActorsDuringCsAction = false;
return true;
}
@ -1071,7 +1071,7 @@ s32 func_8002DF54(PlayState* play, Actor* actor, u8 csAction) {
Player* player = GET_PLAYER(play);
func_8002DF38(play, actor, csAction);
player->doorBgCamIndex = 1;
player->cv.haltActorsDuringCsAction = true;
return true;
}

View file

@ -756,7 +756,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
}
}
if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_GRAB) {
player->actionVar2 = 0xA;
player->av2.actionVar2 = 0xA;
player->actor.speed = player->actor.velocity.y = 0;
Math_ApproachF(&player->actor.world.pos.x, this->grabPosRot.pos.x, 0.5f, 20.0f);
Math_ApproachF(&player->actor.world.pos.y, this->grabPosRot.pos.y, 0.5f, 20.0f);
@ -814,7 +814,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
Math_ApproachS(&this->tentRot[indS1].z, tempf2, 1.0f / this->tentMaxAngle, this->tentSpeed);
}
}
player->actionVar2 = 0xA;
player->av2.actionVar2 = 0xA;
player->actor.world.pos.x = this->grabPosRot.pos.x;
player->actor.world.pos.y = this->grabPosRot.pos.y;
player->actor.world.pos.z = this->grabPosRot.pos.z;
@ -833,7 +833,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT;
this->work[MO_TENT_INVINC_TIMER] = 50;
if (&this->actor == player->actor.parent) {
player->actionVar2 = 0x65;
player->av2.actionVar2 = 0x65;
player->actor.parent = NULL;
player->csAction = PLAYER_CSACTION_NONE;
if (this->timers[0] == 0) {
@ -863,7 +863,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
case MO_TENT_CUT:
Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EV_WATER_WALL - SFX_FLAG);
if (&this->actor == player->actor.parent) {
player->actionVar2 = 0x65;
player->av2.actionVar2 = 0x65;
player->actor.parent = NULL;
player->csAction = PLAYER_CSACTION_NONE;
}
@ -1784,7 +1784,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
sMorphaTent2->tent2KillTimer = 1;
}
if (player->actor.parent != NULL) {
player->actionVar2 = 0x65;
player->av2.actionVar2 = 0x65;
player->actor.parent = NULL;
player->csAction = PLAYER_CSACTION_NONE;
}
@ -1803,7 +1803,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
sMorphaTent1->timers[0] = 40;
sMorphaTent1->actor.flags &= ~ACTOR_FLAG_0;
if (player->actor.parent == &sMorphaTent1->actor) {
player->actionVar2 = 0x65;
player->av2.actionVar2 = 0x65;
player->actor.parent = NULL;
player->csAction = PLAYER_CSACTION_NONE;
}

View file

@ -1749,7 +1749,7 @@ void BossSst_HandClap(BossSst* this, PlayState* play) {
}
if (player->actor.parent == &this->actor) {
player->actionVar2 = 0;
player->av2.actionVar2 = 0;
player->actor.world.pos = this->actor.world.pos;
}
}
@ -1844,7 +1844,7 @@ void BossSst_HandGrab(BossSst* this, PlayState* play) {
this->actor.world.pos.x += this->actor.speed * Math_SinS(this->actor.world.rot.y);
this->actor.world.pos.z += this->actor.speed * Math_CosS(this->actor.world.rot.y);
if (player->stateFlags2 & PLAYER_STATE2_7) {
player->actionVar2 = 0;
player->av2.actionVar2 = 0;
player->actor.world.pos = this->actor.world.pos;
player->actor.shape.rot.y = this->actor.shape.rot.y;
}
@ -1938,7 +1938,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) {
}
if (player->stateFlags2 & PLAYER_STATE2_7) {
player->actionVar2 = 0;
player->av2.actionVar2 = 0;
Math_Vec3f_Copy(&player->actor.world.pos, &this->actor.world.pos);
player->actor.shape.rot.x = this->actor.shape.rot.x;
player->actor.shape.rot.z = (this->vParity * -0x4000) + this->actor.shape.rot.z;
@ -2422,7 +2422,7 @@ void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) {
if (player->actor.parent == &this->actor) {
player->actor.parent = NULL;
player->actionVar2 = 100;
player->av2.actionVar2 = 100;
this->colliderJntSph.base.ocFlags1 |= OC1_ON;
OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON;
if (dropPlayer) {

View file

@ -129,7 +129,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) {
player = GET_PLAYER(play);
if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) {
if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(player->stateFlags1 & PLAYER_STATE1_31) && (player->actionVar1 == 0)) {
(player->stateFlags1 & PLAYER_STATE1_31) && (player->av1.actionVar1 == 0)) {
destinationIdx = ((this->actor.params >> 0xC) & 7) - 1;
Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF);
gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y;

View file

@ -637,8 +637,8 @@ void DoorShutter_InitOpeningDoorCam(DoorShutter* this, PlayState* play) {
this->gfxType = savedGfxType;
this->barsClosedAmount = 0.0f;
Camera_ChangeDoorCam(play->cameraPtrs[CAM_ID_MAIN], &this->dyna.actor, player->doorBgCamIndex, 0.0f, 12,
doorCamTimer2, 10);
Camera_ChangeDoorCam(play->cameraPtrs[CAM_ID_MAIN], &this->dyna.actor, player->cv.slidingDoorBgCamIndex, 0.0f,
12, doorCamTimer2, 10);
}
}

View file

@ -245,7 +245,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
}
if (this->actor.home.rot.z != 0) {
@ -285,7 +285,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
}
this->actor.home.rot.z = 1;
@ -306,7 +306,7 @@ void EnDha_TakeDamage(EnDha* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
}
Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 2000, 0);
@ -344,7 +344,7 @@ void EnDha_Die(EnDha* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
}
Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 0x7D0, 0);

View file

@ -604,7 +604,7 @@ void EnMb_Stunned(EnMb* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f);
this->attack = ENMB_ATTACK_NONE;
}
@ -721,7 +721,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f);
}
@ -936,7 +936,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) {
hasHitPlayer = true;
player->actor.world.pos.z = this->actor.world.pos.z + Math_SinS(this->actor.shape.rot.y) * 10.0f +
Math_CosS(this->actor.shape.rot.y) * 89.0f;
player->actionVar2 = 0;
player->av2.actionVar2 = 0;
player->actor.speed = 0.0f;
player->actor.velocity.y = 0.0f;
}
@ -947,7 +947,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) {
if (player->stateFlags2 & PLAYER_STATE2_7) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f);
}
}
@ -1005,7 +1005,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) {
hasHitPlayer = true;
player->actor.world.pos.z = this->actor.world.pos.z + Math_SinS(this->actor.shape.rot.y) * 10.0f +
Math_CosS(this->actor.shape.rot.y) * 89.0f;
player->actionVar2 = 0;
player->av2.actionVar2 = 0;
player->actor.speed = 0.0f;
player->actor.velocity.y = 0.0f;
}
@ -1016,7 +1016,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) {
if (player->stateFlags2 & PLAYER_STATE2_7) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f);
}
this->attack = ENMB_ATTACK_NONE;
@ -1298,7 +1298,7 @@ void EnMb_SpearDead(EnMb* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f);
this->attack = ENMB_ATTACK_NONE;
}
@ -1381,7 +1381,7 @@ void EnMb_CheckColliding(EnMb* this, PlayState* play) {
if ((player->stateFlags2 & PLAYER_STATE2_7) && player->actor.parent == &this->actor) {
player->stateFlags2 &= ~PLAYER_STATE2_7;
player->actor.parent = NULL;
player->actionVar2 = 200;
player->av2.actionVar2 = 200;
func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f);
}
this->damageEffect = this->actor.colChkInfo.damageEffect;

View file

@ -564,7 +564,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) {
if ((this->actor.colChkInfo.health == 0) && sDeathFlag) {
this->csAction = PLAYER_CSACTION_24;
this->unk_448 = &player->actor;
this->doorBgCamIndex = 1;
this->cv.haltActorsDuringCsAction = true;
sDeathFlag = false;
}
if ((this->invincibilityTimer == 0) && (this->actor.colChkInfo.health != 0) &&

File diff suppressed because it is too large Load diff