mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-18 21:10:19 +00:00
Generic actor params getters (#1359)
* Initial PARAMS_GET macros * NOSHIFT macro * Use number of bits rather than raw mask values * Add descriptions for each generic macro * Reformat * Adjust comment * format * edit en_door macro names * edit redead macro name * edit bdan switch macro name, and remove unneeded comments in go2 * mizushutter macro names * remove PARAMS_GET_S, rework ishi switch flag handling * actually remove PARAMS_GET_S * remove PARAMS_GET2_S * PARAMS_GET_U and PARAMS_GET_S * format * fix merge * format --------- Co-authored-by: fig02 <fig02srl@gmail.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
137e0d2a10
commit
eaf955ad22
200 changed files with 1113 additions and 1045 deletions
|
@ -63,11 +63,11 @@ static Color_RGB8 sPrimColors[] = {
|
|||
};
|
||||
|
||||
u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) {
|
||||
if (!((this->dyna.actor.params >> 10) & 1)) {
|
||||
if (!PARAMS_GET_U(this->dyna.actor.params, 10, 1)) {
|
||||
if (this->unk_177 == 0) {
|
||||
return this->unk_175;
|
||||
} else {
|
||||
u8 temp = ((this->dyna.actor.params >> 15) & 1) ? true : false;
|
||||
u8 temp = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false;
|
||||
|
||||
if (this->unk_177 == 1) {
|
||||
return this->unk_174 ^ temp;
|
||||
|
@ -78,14 +78,14 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
return (((this->dyna.actor.params >> 15) & 1) ? true : false) ^ this->unk_174;
|
||||
return (PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false) ^ this->unk_174;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, PlayState* play) {
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
|
||||
this->dyna.actor.world.pos.z, 0, 0, 0,
|
||||
sSizeOptions[(this->dyna.actor.params >> 8) & 1].demoEffectParams);
|
||||
sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].demoEffectParams);
|
||||
}
|
||||
|
||||
void ObjTimeblock_ToggleSwitchFlag(PlayState* play, s32 flag) {
|
||||
|
@ -109,23 +109,23 @@ void ObjTimeblock_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
Actor_SetScale(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].scale);
|
||||
Actor_SetScale(&this->dyna.actor, sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].scale);
|
||||
|
||||
if ((this->dyna.actor.params >> 6) & 1) {
|
||||
if (PARAMS_GET_U(this->dyna.actor.params, 6, 1)) {
|
||||
this->unk_177 = 0;
|
||||
} else {
|
||||
this->unk_177 = ((this->dyna.actor.params & 0x3F) < 0x38) ? 2 : 1;
|
||||
this->unk_177 = (PARAMS_GET_U(this->dyna.actor.params, 0, 6) < 0x38) ? 2 : 1;
|
||||
}
|
||||
|
||||
this->songObserverFunc = ObjTimeblock_WaitForOcarina;
|
||||
|
||||
Actor_SetFocus(&this->dyna.actor, sSizeOptions[(this->dyna.actor.params >> 8) & 1].height);
|
||||
Actor_SetFocus(&this->dyna.actor, sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].height);
|
||||
|
||||
this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false;
|
||||
this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false;
|
||||
this->unk_174 = (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) ? true : false;
|
||||
this->unk_175 = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false;
|
||||
this->isVisible = ObjTimeblock_CalculateIsVisible(this);
|
||||
|
||||
if (!((this->dyna.actor.params >> 10) & 1)) {
|
||||
if (!PARAMS_GET_U(this->dyna.actor.params, 10, 1)) {
|
||||
ObjTimeblock_SetupNormal(this);
|
||||
} else if (this->isVisible) {
|
||||
ObjTimeblock_SetupAltBehaviorVisible(this);
|
||||
|
@ -135,8 +135,8 @@ void ObjTimeblock_Init(Actor* thisx, PlayState* play) {
|
|||
|
||||
// "Block of time"
|
||||
PRINTF("時のブロック (<arg> %04xH <type> save:%d color:%d range:%d move:%d)\n", (u16)this->dyna.actor.params,
|
||||
this->unk_177, this->dyna.actor.home.rot.z & 7, (this->dyna.actor.params >> 11) & 7,
|
||||
(this->dyna.actor.params >> 10) & 1);
|
||||
this->unk_177, this->dyna.actor.home.rot.z & 7, PARAMS_GET_U(this->dyna.actor.params, 11, 3),
|
||||
PARAMS_GET_U(this->dyna.actor.params, 10, 1));
|
||||
}
|
||||
|
||||
void ObjTimeblock_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
@ -151,7 +151,7 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, PlayState* play) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (this->dyna.actor.xzDistToPlayer <= sRanges[(this->dyna.actor.params >> 11) & 7]) {
|
||||
if (this->dyna.actor.xzDistToPlayer <= sRanges[PARAMS_GET_U(this->dyna.actor.params, 11, 3)]) {
|
||||
Vec3f playerRelativePos;
|
||||
f32 blockSize;
|
||||
|
||||
|
@ -225,7 +225,7 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) {
|
|||
if (this->unk_177 == 0) {
|
||||
this->dyna.actor.params ^= 0x8000;
|
||||
} else {
|
||||
ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F);
|
||||
ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,9 +234,9 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) {
|
|||
this->demoEffectFirstPartTimer--;
|
||||
if (this->demoEffectFirstPartTimer == 0) {
|
||||
if (this->unk_177 == 0) {
|
||||
this->unk_175 = ((this->dyna.actor.params >> 15) & 1) ? true : false;
|
||||
this->unk_175 = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false;
|
||||
} else {
|
||||
this->unk_174 = (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) ? true : false;
|
||||
this->unk_174 = (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void func_80BA06AC(ObjTimeblock* this, PlayState* play) {
|
||||
s32 switchFlag = this->dyna.actor.params & 0x3F;
|
||||
s32 switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6);
|
||||
|
||||
this->unk_172 = play->msgCtx.lastPlayedSong;
|
||||
|
||||
|
@ -277,7 +277,7 @@ void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play) {
|
|||
OnePointCutscene_Attention(play, &this->dyna.actor);
|
||||
// "Time Block Attention Camera (frame counter)"
|
||||
PRINTF("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames);
|
||||
ObjTimeblock_ToggleSwitchFlag(play, this->dyna.actor.params & 0x3F);
|
||||
ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
|
||||
}
|
||||
|
||||
func_80BA06AC(this, play);
|
||||
|
@ -296,10 +296,11 @@ void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this) {
|
|||
}
|
||||
|
||||
void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play) {
|
||||
s32 switchFlag = this->dyna.actor.params & 0x3F;
|
||||
s32 switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6);
|
||||
s8 switchFlagIsSet = (Flags_GetSwitch(play, switchFlag)) ? true : false;
|
||||
|
||||
if (this->unk_176 ^ switchFlagIsSet && switchFlagIsSet ^ (((this->dyna.actor.params >> 15) & 1) ? true : false)) {
|
||||
if (this->unk_176 ^ switchFlagIsSet &&
|
||||
switchFlagIsSet ^ (PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false)) {
|
||||
if (this->demoEffectTimer <= 0) {
|
||||
ObjTimeblock_SpawnDemoEffect(this, play);
|
||||
this->demoEffectTimer = 160;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue