1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 14:31:17 +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:
Tharo 2024-08-14 20:29:43 +01:00 committed by GitHub
parent 137e0d2a10
commit eaf955ad22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
200 changed files with 1113 additions and 1045 deletions

View file

@ -104,10 +104,10 @@ void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, PlayState* play) {
Actor* thisx = &this->actor; // required
s32 type;
if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) {
type = this->actor.params >> 4 & 3;
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
type = PARAMS_GET_U(this->actor.params, 4, 2);
Flags_SetSwitch(play, this->actor.params >> 8 & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6));
if (type == OBJLIGHTSWITCH_TYPE_1) {
OnePointCutscene_AttentionSetSfx(play, thisx, NA_SE_SY_TRE_BOX_APPEAR);
@ -120,10 +120,10 @@ void ObjLightswitch_SetSwitchFlag(ObjLightswitch* this, PlayState* play) {
}
void ObjLightswitch_ClearSwitchFlag(ObjLightswitch* this, PlayState* play) {
if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) {
Flags_UnsetSwitch(play, this->actor.params >> 8 & 0x3F);
if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
Flags_UnsetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6));
if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_1) {
if (PARAMS_GET_U(this->actor.params, 4, 2) == OBJLIGHTSWITCH_TYPE_1) {
OnePointCutscene_AttentionSetSfx(play, &this->actor, NA_SE_SY_TRE_BOX_APPEAR);
}
}
@ -161,13 +161,13 @@ void ObjLightswitch_SpawnDisappearEffects(ObjLightswitch* this, PlayState* play)
void ObjLightswitch_Init(Actor* thisx, PlayState* play) {
ObjLightswitch* this = (ObjLightswitch*)thisx;
s32 switchFlagSet = Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F);
s32 switchFlagSet = Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6));
s32 removeSelf = false;
Actor_ProcessInitChain(&this->actor, sInitChain);
Actor_SetFocus(&this->actor, 0.0f);
if (switchFlagSet) {
if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN) {
if (PARAMS_GET_U(this->actor.params, 4, 2) == OBJLIGHTSWITCH_TYPE_BURN) {
removeSelf = true;
} else {
ObjLightswitch_SetupOn(this);
@ -175,7 +175,7 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) {
} else {
ObjLightswitch_SetupOff(this);
}
if ((this->actor.params & 1) == 1) {
if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) {
if (switchFlagSet) {
Math_Vec3f_Copy(&this->actor.world.pos, &D_80B97F68);
Math_Vec3f_Copy(&this->actor.home.pos, &D_80B97F68);
@ -221,7 +221,7 @@ void ObjLightswitch_SetupOff(ObjLightswitch* this) {
}
void ObjLightswitch_Off(ObjLightswitch* this, PlayState* play) {
switch (this->actor.params >> 4 & 3) {
switch (PARAMS_GET_U(this->actor.params, 4, 2)) {
case OBJLIGHTSWITCH_TYPE_STAY_ON:
case OBJLIGHTSWITCH_TYPE_2:
if (this->collider.base.acFlags & AC_HIT) {
@ -288,9 +288,9 @@ void ObjLightswitch_SetupOn(ObjLightswitch* this) {
}
void ObjLightswitch_On(ObjLightswitch* this, PlayState* play) {
switch (this->actor.params >> 4 & 3) {
switch (PARAMS_GET_U(this->actor.params, 4, 2)) {
case OBJLIGHTSWITCH_TYPE_STAY_ON:
if (!Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) {
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
ObjLightswitch_SetupTurnOff(this);
}
break;
@ -324,7 +324,7 @@ void ObjLightswitch_SetupTurnOff(ObjLightswitch* this) {
}
void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play) {
if ((this->actor.params >> 4 & 3) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category ||
if (PARAMS_GET_U(this->actor.params, 4, 2) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category ||
this->toggleDelay <= 0) {
this->timer--;
@ -378,7 +378,7 @@ void ObjLightswitch_Update(Actor* thisx, PlayState* play2) {
this->actionFunc(this, play);
if (this->actor.update != NULL) {
if ((this->actor.params & 1) == 1) {
if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) {
this->actor.world.pos.x = this->actor.child->world.pos.x;
this->actor.world.pos.y = this->actor.child->world.pos.y + 60.0f;
this->actor.world.pos.z = this->actor.child->world.pos.z;
@ -404,7 +404,7 @@ void ObjLightswitch_DrawOpa(Actor* thisx, PlayState* play) {
(u8)(this->alpha >> 6));
gSPSegment(POLY_OPA_DISP++, 0x09, &D_80116280[2]);
if ((thisx->params & 1) == 1) {
if (PARAMS_GET_U(thisx->params, 0, 1) == 1) {
thisx->world.pos.x = thisx->child->world.pos.x;
thisx->world.pos.y = thisx->child->world.pos.y + 60.0f;
thisx->world.pos.z = thisx->child->world.pos.z;
@ -486,11 +486,11 @@ void ObjLightswitch_Draw(Actor* thisx, PlayState* play) {
ObjLightswitch* this = (ObjLightswitch*)thisx;
s32 alpha = this->alpha >> 6 & 0xFF;
if ((this->actor.params & 1) == 1) {
if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) {
Collider_UpdateSpheres(0, &this->collider);
}
if ((this->actor.params >> 4 & 3) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) {
if (PARAMS_GET_U(this->actor.params, 4, 2) == OBJLIGHTSWITCH_TYPE_BURN && (alpha > 0 || alpha < 255)) {
ObjLightswitch_DrawXlu(thisx, play);
} else {
ObjLightswitch_DrawOpa(thisx, play);