1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00

Document flag for swinging bottle (#1272)

* Document flag for swinging bottle

* Add bug, minor documentation to func_8084ECA4

* Update comments

* Add newline to z64cutscene_commands.h

* Review
This commit is contained in:
EllipticEllipsis 2022-06-12 23:58:13 +01:00 committed by GitHub
parent 826924afea
commit be57b6bf4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 15 deletions

View file

@ -98,6 +98,7 @@
*/
#define CS_LIGHTING_LIST(entries) CS_CMD_SET_LIGHTING, CMD_W(entries)
/**
* ARGS
* s16 setting (m), s16 startFrame (s), s16 endFrame (e)

View file

@ -384,7 +384,7 @@ typedef struct {
} WeaponInfo; // size = 0x1C
#define PLAYER_STATE1_0 (1 << 0)
#define PLAYER_STATE1_1 (1 << 1)
#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1)
#define PLAYER_STATE1_2 (1 << 2)
#define PLAYER_STATE1_3 (1 << 3)
#define PLAYER_STATE1_4 (1 << 4)

View file

@ -242,8 +242,8 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
adsr->action.s.state = ADSR_STATE_LOOP;
FALLTHROUGH;
retry:;
FALLTHROUGH;
case ADSR_STATE_LOOP:
adsr->delay = adsr->envelope[adsr->envIndex].delay;
switch (adsr->delay) {

View file

@ -3923,7 +3923,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) {
switch (this->unk_1C2) {
case 0:
if ((player->stateFlags1 & PLAYER_STATE1_1) &&
if ((player->stateFlags1 & PLAYER_STATE1_SWINGING_BOTTLE) &&
(ABS((s16)(player->actor.shape.rot.y - (s16)(ganondorf->actor.yawTowardsPlayer + 0x8000))) <
0x2000) &&
(sqrtf(SQ(xDistFromLink) + SQ(yDistFromLink) + SQ(zDistFromLink)) <= 25.0f)) {

View file

@ -469,7 +469,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) {
switch (this->work[FHGFIRE_FIRE_MODE]) {
case FHGFIRE_LIGHT_GREEN:
canBottleReflect1 =
((player->stateFlags1 & PLAYER_STATE1_1) &&
((player->stateFlags1 & PLAYER_STATE1_SWINGING_BOTTLE) &&
(ABS((s16)(player->actor.shape.rot.y - (s16)(bossGnd->actor.yawTowardsPlayer + 0x8000))) <
0x2000) &&
(sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f))

View file

@ -10394,7 +10394,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21);
}
this->stateFlags1 &= ~(PLAYER_STATE1_1 | PLAYER_STATE1_9 | PLAYER_STATE1_12 | PLAYER_STATE1_22);
this->stateFlags1 &= ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_12 | PLAYER_STATE1_22);
this->stateFlags2 &= ~(PLAYER_STATE2_0 | PLAYER_STATE2_2 | PLAYER_STATE2_3 | PLAYER_STATE2_5 | PLAYER_STATE2_6 |
PLAYER_STATE2_8 | PLAYER_STATE2_9 | PLAYER_STATE2_12 | PLAYER_STATE2_14 |
PLAYER_STATE2_16 | PLAYER_STATE2_22 | PLAYER_STATE2_26);
@ -12378,11 +12378,11 @@ void func_8084EAC0(Player* this, PlayState* play) {
}
}
static BottleCatchInfo D_80854A04[] = {
{ ACTOR_EN_ELF, ITEM_FAIRY, 0x2A, 0x46 },
{ ACTOR_EN_FISH, ITEM_FISH, 0x1F, 0x47 },
{ ACTOR_EN_ICE_HONO, ITEM_BLUE_FIRE, 0x20, 0x5D },
{ ACTOR_EN_INSECT, ITEM_BUG, 0x21, 0x7A },
static BottleCatchInfo sBottleCatchInfos[] = {
{ ACTOR_EN_ELF, ITEM_FAIRY, PLAYER_AP_BOTTLE_FAIRY, 0x46 },
{ ACTOR_EN_FISH, ITEM_FISH, PLAYER_AP_BOTTLE_FISH, 0x47 },
{ ACTOR_EN_ICE_HONO, ITEM_BLUE_FIRE, PLAYER_AP_BOTTLE_FIRE, 0x5D },
{ ACTOR_EN_INSECT, ITEM_BUG, PLAYER_AP_BOTTLE_BUG, 0x7A },
};
void func_8084ECA4(Player* this, PlayState* play) {
@ -12397,7 +12397,7 @@ void func_8084ECA4(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
if (this->unk_84F != 0) {
if (this->unk_850 == 0) {
Message_StartTextbox(play, D_80854A04[this->unk_84F - 1].textId, &this->actor);
Message_StartTextbox(play, sBottleCatchInfos[this->unk_84F - 1].textId, &this->actor);
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
this->unk_850 = 1;
} else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
@ -12420,14 +12420,14 @@ void func_8084ECA4(Player* this, PlayState* play) {
}
if (this->interactRangeActor != NULL) {
catchInfo = &D_80854A04[0];
for (i = 0; i < 4; i++, catchInfo++) {
catchInfo = &sBottleCatchInfos[0];
for (i = 0; i < ARRAY_COUNT(sBottleCatchInfos); i++, catchInfo++) {
if (this->interactRangeActor->id == catchInfo->actorId) {
break;
}
}
if (i < 4) {
if (i < ARRAY_COUNT(sBottleCatchInfos)) {
this->unk_84F = i + 1;
this->unk_850 = 0;
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
@ -12442,8 +12442,11 @@ void func_8084ECA4(Player* this, PlayState* play) {
}
}
//! @bug If the animation is changed at any point above (such as by func_8083C0E8() or func_808322D0()), it will
//! change the curFrame to 0. This causes this flag to be set for one frame, at a time when it does not look like
//! Player is swinging the bottle.
if (this->skelAnime.curFrame <= 7.0f) {
this->stateFlags1 |= PLAYER_STATE1_1;
this->stateFlags1 |= PLAYER_STATE1_SWINGING_BOTTLE;
}
}