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

z_shot_sun: minor doc (#1429)

* z_shot_sun: minor doc

document one field and function remaining in z_shot_sun

* z_shot_sun: updated state doc'ing

* Update z_shot_sun.c

format enum

* ran format.py

* `z_shot_sun`: changes based on feedback

gave enum better name, removed redundant comment.

* Update z_shot_sun.c

enum changed.
This commit is contained in:
blackgamma7 2022-11-18 08:24:27 -05:00 committed by GitHub
parent edb6a25cee
commit 1666517f47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 13 deletions

View file

@ -18,7 +18,7 @@ void ShotSun_Update(Actor* thisx, PlayState* play);
void ShotSun_SpawnFairy(ShotSun* this, PlayState* play); void ShotSun_SpawnFairy(ShotSun* this, PlayState* play);
void ShotSun_TriggerFairy(ShotSun* this, PlayState* play); void ShotSun_TriggerFairy(ShotSun* this, PlayState* play);
void func_80BADF0C(ShotSun* this, PlayState* play); void ShotSun_UpdateFairySpawner(ShotSun* this, PlayState* play);
void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play); void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play);
ActorInit Shot_Sun_InitVars = { ActorInit Shot_Sun_InitVars = {
@ -33,6 +33,12 @@ ActorInit Shot_Sun_InitVars = {
NULL, NULL,
}; };
typedef enum {
/* 0 */ SPAWNER_OUT_OF_RANGE ,
/* 1 */ SPAWNER_OCARINA_START,
/* 2 */ SPAWNER_OCARINA_PLAYING
} FairySpawnerState;
static ColliderCylinderInit sCylinderInit = { static ColliderCylinderInit sCylinderInit = {
{ {
COLTYPE_NONE, COLTYPE_NONE,
@ -61,10 +67,10 @@ void ShotSun_Init(Actor* thisx, PlayState* play) {
osSyncPrintf("%d ---- オカリナの秘密発生!!!!!!!!!!!!!\n", this->actor.params); osSyncPrintf("%d ---- オカリナの秘密発生!!!!!!!!!!!!!\n", this->actor.params);
params = this->actor.params & 0xFF; params = this->actor.params & 0xFF;
if (params == 0x40 || params == 0x41) { if (params == 0x40 || params == 0x41) {
this->unk_1A4 = 0; this->fairySpawnerState = SPAWNER_OUT_OF_RANGE;
this->actor.flags |= ACTOR_FLAG_4; this->actor.flags |= ACTOR_FLAG_4;
this->actor.flags |= ACTOR_FLAG_25; this->actor.flags |= ACTOR_FLAG_25;
this->actionFunc = func_80BADF0C; this->actionFunc = ShotSun_UpdateFairySpawner;
this->actor.flags |= ACTOR_FLAG_27; this->actor.flags |= ACTOR_FLAG_27;
} else { } else {
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
@ -119,35 +125,35 @@ void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) {
} }
} }
void func_80BADF0C(ShotSun* this, PlayState* play) { void ShotSun_UpdateFairySpawner(ShotSun* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
s32 pad; s32 pad;
s32 params = this->actor.params & 0xFF; s32 params = this->actor.params & 0xFF;
if (Math3D_Vec3fDistSq(&this->actor.world.pos, &player->actor.world.pos) > SQ(150.0f)) { if (Math3D_Vec3fDistSq(&this->actor.world.pos, &player->actor.world.pos) > SQ(150.0f)) {
this->unk_1A4 = 0; this->fairySpawnerState = SPAWNER_OUT_OF_RANGE;
} else { } else {
if (this->unk_1A4 == 0) { if (this->fairySpawnerState == SPAWNER_OUT_OF_RANGE) {
if (!(player->stateFlags2 & PLAYER_STATE2_24)) { if (!(player->stateFlags2 & PLAYER_STATE2_24)) {
player->stateFlags2 |= PLAYER_STATE2_23; player->stateFlags2 |= PLAYER_STATE2_23;
return; return;
} else { } else {
this->unk_1A4 = 1; this->fairySpawnerState = SPAWNER_OCARINA_START;
} }
} }
if (this->unk_1A4 == 1) { if (this->fairySpawnerState == SPAWNER_OCARINA_START) {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
this->unk_1A4 = 2; this->fairySpawnerState = SPAWNER_OCARINA_PLAYING;
} else if (this->unk_1A4 == 2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { } else if (this->fairySpawnerState == SPAWNER_OCARINA_PLAYING && play->msgCtx.ocarinaMode == OCARINA_MODE_04) {
if ((params == 0x40 && play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) || if ((params == 0x40 && play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) ||
(params == 0x41 && play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS)) { (params == 0x41 && play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS)) {
this->actionFunc = ShotSun_TriggerFairy; this->actionFunc = ShotSun_TriggerFairy;
OnePointCutscene_Attention(play, &this->actor); OnePointCutscene_Attention(play, &this->actor);
this->timer = 0; this->timer = 0;
} else { } else {
this->unk_1A4 = 0; this->fairySpawnerState = SPAWNER_OUT_OF_RANGE;
} }
this->unk_1A4 = 0; this->fairySpawnerState = SPAWNER_OUT_OF_RANGE;
} }
} }
} }

View file

@ -14,7 +14,7 @@ typedef struct ShotSun {
/* 0x0198 */ ShotSunActionFunc actionFunc; /* 0x0198 */ ShotSunActionFunc actionFunc;
/* 0x019C */ Vec3s hitboxPos; /* 0x019C */ Vec3s hitboxPos;
/* 0x01A2 */ s16 timer; // Frames until fairy spawns /* 0x01A2 */ s16 timer; // Frames until fairy spawns
/* 0x01A4 */ u8 unk_1A4; /* 0x01A4 */ u8 fairySpawnerState;
} ShotSun; // size = 0x01A8 } ShotSun; // size = 0x01A8
#endif #endif