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

@ -109,7 +109,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) {
DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->movementFlags = 0;
this->type = thisx->params >> 12 & 0xF;
this->type = PARAMS_GET_U(thisx->params, 12, 4);
this->iceSmokeTimer = 0;
this->unk_1FB = ENBOX_STATE_0;
this->dyna.actor.gravity = -5.5f;
@ -118,7 +118,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) {
if (play) {} // helps the compiler store play2 into s1
if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) {
if (Flags_GetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5))) {
this->alpha = 255;
this->iceSmokeTimer = 100;
EnBox_SetupAction(this, EnBox_Open);
@ -264,7 +264,7 @@ void EnBox_Fall(EnBox* this, PlayState* play) {
}
void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) {
s32 treasureFlag = this->dyna.actor.params & 0x1F;
s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
Actor_SetClosestSecretDistance(&this->dyna.actor, play);
@ -283,7 +283,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) {
// used for types 9, 10
void func_809C9700(EnBox* this, PlayState* play) {
s32 treasureFlag = this->dyna.actor.params & 0x1F;
s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
Player* player = GET_PLAYER(play);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
@ -320,7 +320,7 @@ void func_809C9700(EnBox* this, PlayState* play) {
}
void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) {
s32 treasureFlag = this->dyna.actor.params & 0x1F;
s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
Actor_SetClosestSecretDistance(&this->dyna.actor, play);
@ -334,7 +334,7 @@ void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) {
}
void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) {
s32 treasureFlag = this->dyna.actor.params & 0x1F;
s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
Actor_SetClosestSecretDistance(&this->dyna.actor, play);
@ -417,16 +417,16 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) {
Audio_PlayFanfare(NA_BGM_OPEN_TRE_BOX | 0x900);
}
}
PRINTF("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F);
Flags_SetTreasure(play, this->dyna.actor.params & 0x1F);
PRINTF("Actor_Environment_Tbox_On() %d\n", PARAMS_GET_U(this->dyna.actor.params, 0, 5));
Flags_SetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5));
} else {
player = GET_PLAYER(play);
Actor_WorldToActorCoords(&this->dyna.actor, &sp4C, &player->actor.world.pos);
if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f &&
Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) {
Actor_OfferGetItemNearby(&this->dyna.actor, play, 0 - (this->dyna.actor.params >> 5 & 0x7F));
Actor_OfferGetItemNearby(&this->dyna.actor, play, -PARAMS_GET_U(this->dyna.actor.params, 5, 7));
}
if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) {
if (Flags_GetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5))) {
EnBox_SetupAction(this, EnBox_Open);
}
}
@ -537,7 +537,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
Actor_SetFocus(&this->dyna.actor, 40.0f);
}
if ((this->dyna.actor.params >> 5 & 0x7F) == GI_ICE_TRAP && this->actionFunc == EnBox_Open &&
if (PARAMS_GET_U(this->dyna.actor.params, 5, 7) == GI_ICE_TRAP && this->actionFunc == EnBox_Open &&
this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) {
EnBox_SpawnIceSmoke(this, play);
}