1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 07:21: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:
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

@ -53,21 +53,21 @@ s32 ElfMsg_KillCheck(ElfMsg* this, PlayState* play) {
if ((this->actor.world.rot.y > 0) && (this->actor.world.rot.y < 0x41) &&
Flags_GetSwitch(play, this->actor.world.rot.y - 1)) {
LOG_STRING("共倒れ", "../z_elf_msg.c", 161); // "Mutual destruction"
if (((this->actor.params >> 8) & 0x3F) != 0x3F) {
Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F);
if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) {
Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6));
}
Actor_Kill(&this->actor);
return 1;
} else if ((this->actor.world.rot.y == -1) && Flags_GetClear(play, this->actor.room)) {
LOG_STRING("共倒れ", "../z_elf_msg.c", 172); // "Mutual destruction"
if (((this->actor.params >> 8) & 0x3F) != 0x3F) {
Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F);
if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) {
Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6));
}
Actor_Kill(&this->actor);
return 1;
} else if (((this->actor.params >> 8) & 0x3F) == 0x3F) {
} else if (PARAMS_GET_U(this->actor.params, 8, 6) == 0x3F) {
return 0;
} else if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) {
} else if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
Actor_Kill(&this->actor);
return 1;
}
@ -78,7 +78,7 @@ void ElfMsg_Init(Actor* thisx, PlayState* play) {
ElfMsg* this = (ElfMsg*)thisx;
// "Conditions for Elf Tag disappearing"
PRINTF(VT_FGCOL(CYAN) "\nエルフ タグ 消える条件 %d" VT_RST "\n", (thisx->params >> 8) & 0x3F);
PRINTF(VT_FGCOL(CYAN) "\nエルフ タグ 消える条件 %d" VT_RST "\n", PARAMS_GET_U(thisx->params, 8, 6));
PRINTF(VT_FGCOL(CYAN) "\nthisx->shape.angle.sy = %d\n" VT_RST, thisx->shape.rot.y);
if (thisx->shape.rot.y >= 0x41) {
// "Conditions for Elf Tag appearing"
@ -100,7 +100,7 @@ void ElfMsg_Init(Actor* thisx, PlayState* play) {
thisx->scale.y = thisx->world.rot.z * 0.04f;
}
if (thisx->params & 0x4000) {
if (PARAMS_GET_NOSHIFT(thisx->params, 14, 1)) {
ElfMsg_SetupAction(this, ElfMsg_CallNaviCuboid);
} else {
ElfMsg_SetupAction(this, ElfMsg_CallNaviCylinder);
@ -115,10 +115,10 @@ void ElfMsg_Destroy(Actor* thisx, PlayState* play) {
s32 ElfMsg_GetMessageId(ElfMsg* this) {
// Negative message ID forces link to talk to Navi
if (this->actor.params & 0x8000) {
return (this->actor.params & 0xFF) + 0x100;
if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) {
return PARAMS_GET_U(this->actor.params, 0, 8) + 0x100;
} else {
return -((this->actor.params & 0xFF) + 0x100);
return -(PARAMS_GET_U(this->actor.params, 0, 8) + 0x100);
}
}
@ -156,8 +156,8 @@ void ElfMsg_Update(Actor* thisx, PlayState* play) {
if (!ElfMsg_KillCheck(this, play)) {
if (Actor_TalkOfferAccepted(&this->actor, play)) {
if (((this->actor.params >> 8) & 0x3F) != 0x3F) {
Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F);
if (PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) {
Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6));
}
Actor_Kill(&this->actor);
return;
@ -180,7 +180,7 @@ void ElfMsg_Draw(Actor* thisx, PlayState* play) {
}
Gfx_SetupDL_25Opa(play->state.gfxCtx);
if (thisx->params & 0x8000) {
if (PARAMS_GET_NOSHIFT(thisx->params, 15, 1)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 100, 100, R_NAVI_MSG_REGION_ALPHA);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, R_NAVI_MSG_REGION_ALPHA);
@ -190,7 +190,7 @@ void ElfMsg_Draw(Actor* thisx, PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_809AD278);
if (thisx->params & 0x4000) {
if (PARAMS_GET_NOSHIFT(thisx->params, 14, 1)) {
gSPDisplayList(POLY_XLU_DISP++, sCubeDL);
} else {
gSPDisplayList(POLY_XLU_DISP++, sCylinderDL);