1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 02:54:24 +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

@ -641,9 +641,6 @@ typedef struct ActorContext {
/* 0x13C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ACTOROVL_ALLOC_ABSOLUTE
} ActorContext; // size = 0x140
#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10
#define GET_TRANSITION_ACTOR_INDEX(actor) ((u16)(actor)->params >> TRANSITION_ACTOR_PARAMS_INDEX_SHIFT)
// EnDoor and DoorKiller share openAnim and playerIsOpening
// Due to alignment, a substruct cannot be used in the structs of these actors.
#define DOOR_ACTOR_BASE \
@ -710,4 +707,33 @@ typedef struct NpcInteractInfo {
/* 0x24 */ char unk_24[0x4];
} NpcInteractInfo; // size = 0x28
// Converts a number of bits to a bitmask, helper for params macros
// e.g. 3 becomes 0b111 (7)
#define NBITS_TO_MASK(n) \
((1 << (n)) - 1)
// Extracts the `n`-bit value at position `s` in `p`, shifts then masks
// Unsigned variant, no possibility of sign extension
#define PARAMS_GET_U(p, s, n) \
(((p) >> (s)) & NBITS_TO_MASK(n))
// Extracts the `n`-bit value at position `s` in `p`, masks then shifts
// Signed variant, possibility of sign extension
#define PARAMS_GET_S(p, s, n) \
(((p) & (NBITS_TO_MASK(n) << (s))) >> (s))
// Extracts all bits past position `s` in `p`
#define PARAMS_GET_NOMASK(p, s) \
((p) >> (s))
// Extracts the `n`-bit value at position `s` in `p` without shifting it from its current position
#define PARAMS_GET_NOSHIFT(p, s, n) \
((p) & (NBITS_TO_MASK(n) << (s)))
// Generates a bitmask for bit position `s` of length `n`
#define PARAMS_MAKE_MASK(s, n) PARAMS_GET_NOSHIFT(~0, s, n)
#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10
#define GET_TRANSITION_ACTOR_INDEX(actor) PARAMS_GET_NOMASK((u16)(actor)->params, 10)
#endif

View file

@ -80,7 +80,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) {
EnAObj* this = (EnAObj*)thisx;
f32 shadowScale = 6.0f;
this->textId = (thisx->params >> 8) & 0xFF;
this->textId = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
switch (thisx->params) {

View file

@ -142,10 +142,10 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
f32 yOffset = 980.0f;
f32 shadowScale = 6.0f;
s32 getItemId = GI_NONE;
s16 spawnParam8000 = this->actor.params & 0x8000;
s16 spawnParam8000 = PARAMS_GET_NOSHIFT(this->actor.params, 15, 1);
s32 pad1;
this->collectibleFlag = (this->actor.params & 0x3F00) >> 8;
this->collectibleFlag = PARAMS_GET_S(this->actor.params, 8, 6);
this->actor.params &= 0xFF;

View file

@ -443,7 +443,7 @@ void Play_Init(GameState* thisx) {
Camera_InitDataUsingPlayer(&this->mainCamera, player);
Camera_RequestMode(&this->mainCamera, CAM_MODE_NORMAL);
playerStartBgCamIndex = player->actor.params & 0xFF;
playerStartBgCamIndex = PARAMS_GET_U(player->actor.params, 0, 8);
if (playerStartBgCamIndex != 0xFF) {
PRINTF("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartBgCamIndex);
Camera_RequestBgCam(&this->mainCamera, playerStartBgCamIndex);

View file

@ -429,7 +429,7 @@ RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomS
}
player = GET_PLAYER(play);
player->actor.params = (player->actor.params & 0xFF00) | bgCamIndex;
player->actor.params = PARAMS_GET_NOSHIFT(player->actor.params, 8, 8) | bgCamIndex;
bgEntry = SEGMENTED_TO_VIRTUAL(roomShapeImageMulti->backgrounds);
for (i = 0; i < roomShapeImageMulti->numBackgrounds; i++) {

View file

@ -123,7 +123,7 @@ void BgBdanObjects_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
this->var.switchFlag = (thisx->params >> 8) & 0x3F;
this->var.switchFlag = PARAMS_GET_U(thisx->params, 8, 6);
thisx->params &= 0xFF;
if (thisx->params == JABU_OBJECTS_TYPE_WATERBOX_HEIGHT_CHANGER) {
thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5;

View file

@ -120,7 +120,7 @@ void func_8086D0EC(BgBdanSwitch* this) {
this->unk_1CC += 0xFA0;
}
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case BLUE:
case YELLOW_HEAVY:
case YELLOW:
@ -143,7 +143,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) {
s16 type;
s32 flag;
type = this->dyna.actor.params & 0xFF;
type = PARAMS_GET_U(this->dyna.actor.params, 0, 8);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (type == YELLOW_TALL_1 || type == YELLOW_TALL_2) {
this->dyna.actor.scale.z = 0.05f;
@ -169,7 +169,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) {
break;
}
flag = Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
flag = Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
switch (type) {
case BLUE:
@ -206,7 +206,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) {
void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play) {
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case BLUE:
case YELLOW_HEAVY:
case YELLOW:
@ -223,9 +223,9 @@ void func_8086D4B4(BgBdanSwitch* this, PlayState* play) {
s32 pad;
s32 type;
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
type = this->dyna.actor.params & 0xFF;
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
type = PARAMS_GET_U(this->dyna.actor.params, 0, 8);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
if (type == BLUE || type == YELLOW_TALL_2) {
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
} else {
@ -235,9 +235,9 @@ void func_8086D4B4(BgBdanSwitch* this, PlayState* play) {
}
void func_8086D548(BgBdanSwitch* this, PlayState* play) {
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
if ((this->dyna.actor.params & 0xFF) == YELLOW_TALL_2) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == YELLOW_TALL_2) {
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
}
}
@ -249,7 +249,7 @@ void func_8086D5C4(BgBdanSwitch* this) {
}
void func_8086D5E0(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case BLUE:
if (func_800435B4(&this->dyna)) {
func_8086D67C(this);
@ -288,7 +288,7 @@ void func_8086D730(BgBdanSwitch* this) {
}
void func_8086D754(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case BLUE:
if (!func_800435B4(&this->dyna)) {
if (this->unk_1D8 <= 0) {
@ -300,7 +300,7 @@ void func_8086D754(BgBdanSwitch* this, PlayState* play) {
}
break;
case YELLOW:
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
func_8086D7FC(this);
}
break;
@ -410,7 +410,7 @@ void func_8086DB4C(BgBdanSwitch* this) {
}
void func_8086DB68(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
default:
return;
case YELLOW_TALL_1:
@ -451,9 +451,9 @@ void func_8086DCCC(BgBdanSwitch* this) {
}
void func_8086DCE8(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case YELLOW_TALL_1:
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
func_8086DDA8(this);
}
break;
@ -473,7 +473,8 @@ void func_8086DDA8(BgBdanSwitch* this) {
}
void func_8086DDC0(BgBdanSwitch* this, PlayState* play) {
if ((((this->dyna.actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->dyna.actor.category)) ||
if (((PARAMS_GET_U(this->dyna.actor.params, 0, 8) != YELLOW_TALL_2) ||
(func_8005B198() == this->dyna.actor.category)) ||
(this->unk_1DA <= 0)) {
this->unk_1C8 += 0.3f;
if (this->unk_1C8 >= 2.0f) {
@ -493,7 +494,7 @@ void BgBdanSwitch_Update(Actor* thisx, PlayState* play) {
}
this->actionFunc(this, play);
func_8086D0EC(this);
type = this->dyna.actor.params & 0xFF;
type = PARAMS_GET_U(this->dyna.actor.params, 0, 8);
if (type != 3 && type != 4) {
this->unk_1D8--;
} else {
@ -519,7 +520,7 @@ void func_8086DF58(BgBdanSwitch* this, PlayState* play, Gfx* dlist) {
void BgBdanSwitch_Draw(Actor* thisx, PlayState* play) {
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case YELLOW_HEAVY:
case YELLOW:
func_8086DF58(this, play, gJabuYellowFloorSwitchDL);

View file

@ -4,7 +4,6 @@
#include "ultra64.h"
#include "global.h"
// BgBdanSwitch.actor.params & 0xFF
typedef enum BgBdanSwitchType {
/* 0x00 */ BLUE,
/* 0x01 */ YELLOW_HEAVY,

View file

@ -122,7 +122,7 @@ void BgBombwall_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
Actor_SetScale(&this->dyna.actor, 0.1f);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_8086EE94(this, play);
} else {
BgBombwall_InitDynapoly(this, play);
@ -213,7 +213,7 @@ void func_8086ED70(BgBombwall* this, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
func_8086EDFC(this, play);
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
} else if (this->dyna.actor.xzDistToPlayer < 600.0f) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
@ -232,7 +232,7 @@ void func_8086EE40(BgBombwall* this, PlayState* play) {
} else {
func_8086EE94(this, play);
if (((this->dyna.actor.params >> 0xF) & 1) != 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 15, 1) != 0) {
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
}
}

View file

@ -79,7 +79,7 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc
void BgBreakwall_Init(Actor* thisx, PlayState* play) {
BgBreakwall* this = (BgBreakwall*)thisx;
s32 pad;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
s32 wallType = (u8)PARAMS_GET_U(this->dyna.actor.params, 13, 2);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 0);
@ -91,7 +91,7 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) {
}
if (this->bombableWallDList != NULL) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -203,7 +203,7 @@ Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos
void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
CollisionHeader* colHeader = NULL;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
s32 wallType = (u8)PARAMS_GET_U(this->dyna.actor.params, 13, 2);
this->dyna.actor.objectSlot = this->requiredObjectSlot;
Actor_SetObjectDependency(play, &this->dyna.actor);
@ -227,7 +227,7 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) {
void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
Vec3f effectPos;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
s32 wallType = (u8)PARAMS_GET_U(this->dyna.actor.params, 13, 2);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
effectPos.y = effectPos.z = effectPos.x = 0.0f;
@ -240,7 +240,7 @@ void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) {
}
BgBreakwall_SpawnFragments(play, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f);
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
if (wallType == BWALL_KD_FLOOR) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EXPLOSION);

View file

@ -118,7 +118,7 @@ void BgDodoago_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
BgDodoago_SetupAction(this, BgDodoago_DoNothing);
this->dyna.actor.shape.rot.x = 0x1333;
play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255;
@ -156,7 +156,7 @@ void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) {
if (((play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) ||
((play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) {
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
this->state = 0;
Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -296,9 +296,9 @@ void BgDodoago_Update(Actor* thisx, PlayState* play) {
}
} else {
sTimer++;
Flags_GetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
if (!sDisableBombCatcher && sTimer > 140) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
// this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher
sDisableBombCatcher++;
} else {

View file

@ -52,7 +52,7 @@ void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) {
this->updateFunc = BgGndDarkmeiro_Noop;
Actor_SetScale(&this->dyna.actor, 0.1f);
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case DARKMEIRO_INVISIBLE_PATH:
this->dyna.actor.draw = BgGndDarkmeiro_DrawInvisiblePath;
this->dyna.actor.flags |= ACTOR_FLAG_REACT_TO_LENS;
@ -60,14 +60,14 @@ void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) {
case DARKMEIRO_CLEAR_BLOCK:
CollisionHeader_GetVirtual(&gClearBlockCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (((this->dyna.actor.params >> 8) & 0x3F) == 0x3F) {
if (PARAMS_GET_U(this->dyna.actor.params, 8, 6) == 0x3F) {
this->updateFunc = BgGndDarkmeiro_UpdateStaticBlock;
this->dyna.actor.draw = BgGndDarkmeiro_DrawStaticBlock;
} else {
this->actionFlags = this->timer1 = this->timer2 = 0;
thisx->draw = BgGndDarkmeiro_DrawSwitchBlock;
this->updateFunc = BgGndDarkmeiro_UpdateSwitchBlock;
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
} else {
this->timer1 = 64;
@ -79,18 +79,18 @@ void BgGndDarkmeiro_Init(Actor* thisx, PlayState* play2) {
this->actionFlags = this->timer1 = this->timer2 = 0;
this->updateFunc = BgGndDarkmeiro_UpdateBlockTimer;
thisx->draw = NULL;
if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 1)) {
this->timer1 = 64;
this->actionFlags |= 4;
}
if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 2)) {
this->timer2 = 64;
this->actionFlags |= 8;
}
if ((this->timer1 != 0) || (this->timer2 != 0)) {
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
} else {
Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
}
break;
}
@ -100,7 +100,7 @@ void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx;
if ((this->dyna.actor.params & 0xFF) != 1) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) != 1) {
return;
}
@ -113,12 +113,12 @@ void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play) {
void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) {
s16 timeLeft;
if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 1)) {
if (this->actionFlags & 4) {
if (this->timer1 > 0) {
this->timer1--;
} else {
Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 1);
Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 1);
this->actionFlags &= ~4;
}
} else {
@ -129,12 +129,12 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) {
}
}
if (Flags_GetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 2)) {
if (this->actionFlags & 8) {
if (this->timer2 > 0) {
this->timer2--;
} else {
Flags_UnsetSwitch(play, ((this->dyna.actor.params >> 8) & 0x3F) + 2);
Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6) + 2);
this->actionFlags &= ~8;
}
} else {
@ -150,9 +150,9 @@ void BgGndDarkmeiro_UpdateBlockTimer(BgGndDarkmeiro* this, PlayState* play) {
func_8002F994(&this->dyna.actor, timeLeft);
}
if ((this->timer1 >= 64) || (this->timer2 >= 64)) {
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
} else {
Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_UnsetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
}
}
@ -164,7 +164,7 @@ void BgGndDarkmeiro_UpdateSwitchBlock(BgGndDarkmeiro* this, PlayState* play) {
this->timer1--;
}
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
this->timer1 = 64;
}

View file

@ -53,7 +53,7 @@ void BgGndNisekabe_Draw(Actor* thisx, PlayState* play) {
gGanonsCastleScrubsFakeWallDL,
};
BgGndNisekabe* this = (BgGndNisekabe*)thisx;
u32 index = this->actor.params & 0xFF;
u32 index = PARAMS_GET_U(this->actor.params, 0, 8);
if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) {
Gfx_DrawDListXlu(play, dLists[index]);

View file

@ -65,12 +65,12 @@ void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
this->actionFunc = NULL;
switch (this->actor.params & 0xFF) {
switch (PARAMS_GET_U(this->actor.params, 0, 8)) {
case 0:
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actionFunc = func_8087B284;
if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, 0, 0, 0, 9);
@ -83,7 +83,7 @@ void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) {
break;
case 1:
case 2:
if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
this->actor.draw = BgGndSoulmeiro_Draw;
} else {
this->actor.draw = NULL;
@ -96,7 +96,7 @@ void BgGndSoulmeiro_Init(Actor* thisx, PlayState* play) {
void BgGndSoulmeiro_Destroy(Actor* thisx, PlayState* play) {
BgGndSoulmeiro* this = (BgGndSoulmeiro*)thisx;
if ((this->actor.params & 0xFF) == 0) {
if (PARAMS_GET_U(this->actor.params, 0, 8) == 0) {
Collider_DestroyCylinder(play, &this->collider);
}
}
@ -112,13 +112,13 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) {
}
if (this->unk_198 == 20) {
Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6));
thisx->draw = NULL;
}
// This should be this->unk_198 == 0, this is required to match
if (!this->unk_198) {
Flags_SetSwitch(play, (thisx->params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6));
Actor_Kill(&this->actor);
Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0,
0, 0, 9);
@ -162,7 +162,7 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) {
void func_8087B284(BgGndSoulmeiro* this, PlayState* play) {
s32 pad;
if (!Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
this->actor.draw = BgGndSoulmeiro_Draw;
if (this->collider.base.acFlags & AC_HIT) {
Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
@ -177,7 +177,7 @@ void func_8087B284(BgGndSoulmeiro* this, PlayState* play) {
}
void func_8087B350(BgGndSoulmeiro* this, PlayState* play) {
if (Flags_GetSwitch(play, (this->actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
this->actor.draw = BgGndSoulmeiro_Draw;
} else {
this->actor.draw = NULL;
@ -198,7 +198,7 @@ void BgGndSoulmeiro_Draw(Actor* thisx, PlayState* play) {
gSpiritTrialLightSourceDL,
gSpiritTrialLightFloorDL,
};
s32 params = thisx->params & 0xFF;
s32 params = PARAMS_GET_U(thisx->params, 0, 8);
if (1) {}

View file

@ -74,7 +74,7 @@ void BgHakaGate_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params == BGHAKAGATE_SKULL) {

View file

@ -49,7 +49,7 @@ void BgHakaHuta_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
this->unk_16A = (thisx->params >> 8) & 0xFF;
this->unk_16A = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
if (Flags_GetSwitch(play, thisx->params)) {
this->counter = -1;

View file

@ -59,7 +59,7 @@ void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->unk_168 = (thisx->params >> 8) & 0xFF;
this->unk_168 = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
if (thisx->params == 2) {

View file

@ -138,8 +138,8 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain);
this->unk_151 = thisx->params & 0xFF;
thisx->params = (thisx->params >> 8) & 0xFF;
this->unk_151 = PARAMS_GET_U(thisx->params, 0, 8);
thisx->params = PARAMS_GET_U(thisx->params, 8, 8);
if (this->unk_151 != 0) {
thisx->flags |= ACTOR_FLAG_REACT_TO_LENS;

View file

@ -44,7 +44,7 @@ void BgHakaShip_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
this->switchFlag = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8);
this->dyna.actor.params &= 0xFF;
if (this->dyna.actor.params == 0) {

View file

@ -197,7 +197,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) {
Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR);
} else {
// Drops a small key and sets a collect flag
collectibleParams = ((this->dyna.actor.params & 0x3F) << 8) | ITEM00_SMALL_KEY;
collectibleParams = (PARAMS_GET_U(this->dyna.actor.params, 0, 6) << 8) | ITEM00_SMALL_KEY;
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
}
if (collectibleParams != -1) {

View file

@ -77,7 +77,7 @@ void BgHakaZou_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
if (thisx->params == STA_UNKNOWN) {

View file

@ -94,7 +94,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) {
thisx->params |= 4;
}
switch (thisx->params & 0xFF) {
switch (PARAMS_GET_U(thisx->params, 0, 8)) {
case HEAVYBLOCK_BIG_PIECE:
thisx->draw = BgHeavyBlock_DrawPiece;
this->actionFunc = BgHeavyBlock_MovePiece;
@ -114,7 +114,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) {
case HEAVYBLOCK_BREAKABLE:
BgHeavyBlock_SetupDynapoly(this, play);
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) {
Actor_Kill(thisx);
return;
}
@ -124,7 +124,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) {
case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
BgHeavyBlock_SetupDynapoly(this, play);
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) {
this->actionFunc = BgHeavyBlock_DoNothing;
thisx->shape.rot.x = thisx->world.rot.x = 0x8AD0;
thisx->shape.rot.y = thisx->world.rot.y = 0xC000;
@ -151,7 +151,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) {
void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play) {
BgHeavyBlock* this = (BgHeavyBlock*)thisx;
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case HEAVYBLOCK_BIG_PIECE:
break;
case HEAVYBLOCK_SMALL_PIECE:
@ -320,7 +320,7 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) {
if (Actor_HasParent(&this->dyna.actor, play)) {
this->timer = 0;
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case HEAVYBLOCK_BREAKABLE:
OnePointCutscene_Init(play, 4020, 270, &this->dyna.actor, CAM_ID_MAIN);
break;
@ -393,10 +393,10 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) {
if (this->dyna.actor.home.pos.y <= yIntersect) {
Rumble_Request(0.0f, 255, 60, 4);
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case HEAVYBLOCK_BREAKABLE:
BgHeavyBlock_SpawnPieces(this, play);
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
Actor_Kill(&this->dyna.actor);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
@ -420,7 +420,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) {
Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
break;
case HEAVYBLOCK_UNBREAKABLE:
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
@ -457,7 +457,7 @@ void BgHeavyBlock_Land(BgHeavyBlock* this, PlayState* play) {
this->dyna.actor.world.pos = this->dyna.actor.home.pos;
Actor_MoveXZGravity(&this->dyna.actor);
this->dyna.actor.home.pos = this->dyna.actor.world.pos;
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
BgHeavyBlock_SpawnDust(play, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f,
Rand_CenteredFloat(30.0f) + 552.0f, 0.0f, 0.0f, 0.0f, 0);
@ -513,7 +513,7 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) {
}
void BgHeavyBlock_DrawPiece(Actor* thisx, PlayState* play) {
switch (thisx->params & 0xFF) {
switch (PARAMS_GET_U(thisx->params, 0, 8)) {
case HEAVYBLOCK_BIG_PIECE:
Matrix_Translate(50.0f, -260.0f, -20.0f, MTXMODE_APPLY);
Gfx_DrawDListOpa(play, gHeavyBlockBigPieceDL);

View file

@ -72,7 +72,7 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) {
PRINTF("Curtain (arg_data 0x%04x)\n", this->actor.params);
Actor_SetFocus(&this->actor, 20.0f);
this->type = (thisx->params >> 0xC) & 0xF;
this->type = PARAMS_GET_U(thisx->params, 12, 4);
if (this->type > 6) {
// "Type is not set"
PRINTF("Error : object のタイプが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", 352,
@ -83,7 +83,7 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) {
this->size = ((this->type == 2) || (this->type == 4)) ? 1 : 0;
hcParams = &sHCParams[this->size];
this->treasureFlag = (thisx->params >> 6) & 0x3F;
this->treasureFlag = PARAMS_GET_U(thisx->params, 6, 6);
thisx->params &= 0x3F;
if (OOT_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) {

View file

@ -106,7 +106,7 @@ void BgHidanDalm_Init(Actor* thisx, PlayState* play) {
Collider_InitTris(play, &this->collider);
Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems);
this->switchFlag = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
if (Flags_GetSwitch(play, this->switchFlag)) {
Actor_Kill(thisx);

View file

@ -76,7 +76,7 @@ void BgHidanFwbig_Init(Actor* thisx, PlayState* play2) {
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->direction = (u16)(thisx->params >> 8);
this->direction = (u16)PARAMS_GET_NOMASK(thisx->params, 8);
thisx->params &= 0xFF;
if (this->direction != 0) {
this->actor.home.pos.x = 1560.0f;

View file

@ -113,7 +113,7 @@ s32 BgHidanHamstep_SpawnChildren(BgHidanHamstep* this, PlayState* play2) {
pos.z = (((i * 160.0f) + 60.0f) * cos) + this->dyna.actor.home.pos.z;
params = (i + 1) & 0xFF;
params |= (this->dyna.actor.params & 0xFF00);
params |= PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 8);
step = (BgHidanHamstep*)Actor_SpawnAsChild(&play->actorCtx, &step->dyna.actor, play, ACTOR_BG_HIDAN_HAMSTEP,
pos.x, pos.y, pos.z, this->dyna.actor.world.rot.x,
@ -138,7 +138,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if ((this->dyna.actor.params & 0xFF) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
Collider_InitTris(play, &this->collider);
Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems);
@ -152,7 +152,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) {
}
}
if ((this->dyna.actor.params & 0xFF) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
CollisionHeader_GetVirtual(&gFireTempleStoneStep1Col, &colHeader);
} else {
CollisionHeader_GetVirtual(&gFireTempleStoneStep2Col, &colHeader);
@ -160,16 +160,16 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) {
if ((this->dyna.actor.params & 0xFF) == 0) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 8))) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + (-20.0f);
BgHidanHamstep_SetupAction(this, 4);
} else {
this->dyna.actor.world.pos.y =
sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1] + this->dyna.actor.home.pos.y;
sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1] + this->dyna.actor.home.pos.y;
BgHidanHamstep_SetupAction(this, 4);
}
} else if ((this->dyna.actor.params & 0xFF) == 0) {
} else if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
BgHidanHamstep_SetupAction(this, 0);
} else {
BgHidanHamstep_SetupAction(this, 2);
@ -178,7 +178,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.gravity = -1.2f;
this->dyna.actor.minVelocityY = -12.0f;
if ((this->dyna.actor.params & 0xFF) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
// "Fire Temple Object [Hammer Step] appears"
PRINTF("◯◯◯炎の神殿オブジェクト【ハンマーステップ】出現\n");
if (BgHidanHamstep_SpawnChildren(this, play) == 0) {
@ -201,7 +201,7 @@ void BgHidanHamstep_Destroy(Actor* thisx, PlayState* play) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if ((this->dyna.actor.params & 0xFF) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
Collider_DestroyTris(play, &this->collider);
}
}
@ -232,7 +232,7 @@ void func_80888638(BgHidanHamstep* this, PlayState* play) {
BgHidanHamstep* child = (BgHidanHamstep*)this->dyna.actor.child;
while (child != NULL) {
if ((child->dyna.actor.params & 0xFF) != 0) {
if (PARAMS_GET_U(child->dyna.actor.params, 0, 8) != 0) {
func_808884C8(child, play);
}
child = (BgHidanHamstep*)child->dyna.actor.child;
@ -242,7 +242,7 @@ void func_80888638(BgHidanHamstep* this, PlayState* play) {
void func_80888694(BgHidanHamstep* this, BgHidanHamstep* parent) {
BgHidanHamstep* child;
if ((this->dyna.actor.params & 0xFF) >= 2) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) >= 2) {
if (parent->dyna.actor.world.pos.y < this->dyna.actor.world.pos.y) {
this->dyna.actor.world.pos.y = parent->dyna.actor.world.pos.y;
} else if ((this->dyna.actor.world.pos.y - parent->dyna.actor.world.pos.y) < -100.0f) {
@ -267,7 +267,7 @@ void func_80888734(BgHidanHamstep* this) {
if (parent != NULL) {
this->dyna.actor.velocity.y = parent->dyna.actor.velocity.y;
if ((this->dyna.actor.params & 0xFF) == 1) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 1) {
this->dyna.actor.world.pos.y = parent->dyna.actor.world.pos.y - 100.0f;
} else {
this->dyna.actor.world.pos.y += (this->dyna.actor.velocity.y * frameDivisor);
@ -283,7 +283,7 @@ void func_808887C4(BgHidanHamstep* this, PlayState* play) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_HAMMER_SWITCH);
this->collider.base.acFlags = AC_NONE;
BgHidanHamstep_SetupAction(this, 1);
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 8));
} else {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
@ -329,9 +329,9 @@ void func_808889B8(BgHidanHamstep* this, PlayState* play) {
func_80888734(this);
if ((parent->action == 4) || ((parent->action == 3) && (parent->unk_244 >= 5))) {
if ((this->dyna.actor.params & 0xFF) == 1) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 1) {
this->dyna.actor.world.pos.y =
sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1] + this->dyna.actor.home.pos.y;
sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1] + this->dyna.actor.home.pos.y;
BgHidanHamstep_SetupAction(this, 4);
} else {
BgHidanHamstep_SetupAction(this, 3);
@ -348,7 +348,7 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) {
func_80888694(this, (BgHidanHamstep*)this->dyna.actor.parent);
#if OOT_DEBUG
if (((this->dyna.actor.params & 0xFF) <= 0) || ((this->dyna.actor.params & 0xFF) >= 6)) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) <= 0 || PARAMS_GET_U(this->dyna.actor.params, 0, 8) >= 6) {
// "[Hammer Step] arg_data strange (arg_data = %d)"
PRINTF("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", this->dyna.actor.params);
PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 696);
@ -356,13 +356,13 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) {
#endif
if (((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) <=
sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1]) &&
sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1]) &&
(this->dyna.actor.velocity.y <= 0.0f)) {
this->unk_244++;
if (this->unk_244 >= 7) {
this->dyna.actor.world.pos.y =
sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1] + this->dyna.actor.home.pos.y;
sYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8) - 1] + this->dyna.actor.home.pos.y;
BgHidanHamstep_SetupAction(this, 3);
} else {
this->dyna.actor.velocity.y *= -0.24f;
@ -379,7 +379,7 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) {
Rumble_Request(SQ(100.0f), 255, 20, 150);
func_808884C8(this, play);
if ((this->dyna.actor.params & 0xFF) == 5) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 5) {
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
}
@ -406,7 +406,7 @@ void BgHidanHamstep_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_hidan_hamstep.c", 787),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if ((thisx->params & 0xFF) == 0) {
if (PARAMS_GET_U(thisx->params, 0, 8) == 0) {
gSPDisplayList(POLY_OPA_DISP++, gFireTempleStoneStep1DL);
} else {
gSPDisplayList(POLY_OPA_DISP++, gFireTempleStoneStep2DL);

View file

@ -85,8 +85,8 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) {
Vec3f* vtx;
Actor_ProcessInitChain(thisx, sInitChain);
this->unk_16A = thisx->params & 0x3F;
thisx->params = (thisx->params >> 8) & 0xFF;
this->unk_16A = PARAMS_GET_U(thisx->params, 0, 6);
thisx->params = PARAMS_GET_U(thisx->params, 8, 8);
Collider_InitTris(play, &this->collider);
Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems);
DynaPolyActor_Init(&this->dyna, 0);

View file

@ -69,21 +69,21 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
Actor_SetFocus(thisx, 50.0f);
PRINTF("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, thisx->params & 0xFF,
((s32)thisx->params >> 8) & 0xFF);
PRINTF("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params,
PARAMS_GET_U(thisx->params, 0, 8), PARAMS_GET_U((s32)thisx->params, 8, 8));
Actor_ProcessInitChain(thisx, sInitChain);
#if OOT_DEBUG
if (((thisx->params & 0xFF) < 0) || ((thisx->params & 0xFF) >= 3)) {
if (PARAMS_GET_U(thisx->params, 0, 8) < 0 || PARAMS_GET_U(thisx->params, 0, 8) >= 3) {
PRINTF("arg_data おかしい 【格子】\n");
}
#endif
CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader);
CollisionHeader_GetVirtual(sMetalFencesCollisions[PARAMS_GET_U(thisx->params, 0, 8)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
thisx->world.rot.y = D_80889E7C[this->dyna.actor.params & 0xFF] + thisx->shape.rot.y;
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) {
thisx->world.rot.y = D_80889E7C[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] + thisx->shape.rot.y;
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 8))) {
func_80889ACC(this);
BgHidanKousi_SetupAction(this, func_80889D28);
} else {
@ -99,15 +99,15 @@ void BgHidanKousi_Destroy(Actor* thisx, PlayState* play) {
void func_80889ACC(BgHidanKousi* this) {
s32 pad[2];
Vec3s* rot = &this->dyna.actor.world.rot;
f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_SinS(rot->y);
f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_CosS(rot->y);
f32 temp1 = D_80889E40[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] * Math_SinS(rot->y);
f32 temp2 = D_80889E40[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] * Math_CosS(rot->y);
this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + temp1;
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp2;
}
void func_80889B5C(BgHidanKousi* this, PlayState* play) {
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 8))) {
BgHidanKousi_SetupAction(this, func_80889BC0);
OnePointCutscene_Attention(play, &this->dyna.actor);
this->unk_168 = 0xC8;
@ -133,7 +133,7 @@ void func_80889C18(BgHidanKousi* this, PlayState* play) {
void func_80889C90(BgHidanKousi* this, PlayState* play) {
Actor_UpdatePos(&this->dyna.actor);
if (D_80889E40[this->dyna.actor.params & 0xFF] <
if (D_80889E40[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] <
Math_Vec3f_DistXYZ(&this->dyna.actor.home.pos, &this->dyna.actor.world.pos)) {
func_80889ACC(this);
BgHidanKousi_SetupAction(this, func_80889D28);
@ -159,7 +159,7 @@ void BgHidanKousi_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 354),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, sMetalFencesDLs[thisx->params & 0xFF]);
gSPDisplayList(POLY_OPA_DISP++, sMetalFencesDLs[PARAMS_GET_U(thisx->params, 0, 8)]);
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_kousi.c", 359);
}

View file

@ -77,9 +77,9 @@ void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, PlayState* play
CollisionHeader* colHeader = NULL;
s32 pad2;
if (collisionHeaders[this->dyna.actor.params & 0xFF] != NULL) {
if (collisionHeaders[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] != NULL) {
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(collisionHeaders[this->dyna.actor.params & 0xFF], &colHeader);
CollisionHeader_GetVirtual(collisionHeaders[PARAMS_GET_U(this->dyna.actor.params, 0, 8)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
} else {
this->dyna.bgId = BGACTOR_NEG_ONE;
@ -94,14 +94,15 @@ void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, PlayState
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems);
this->collider.elements[0].dim.modelSphere.radius = sphereRadii[this->dyna.actor.params & 0xFF];
this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[this->dyna.actor.params & 0xFF];
this->collider.elements[0].dim.modelSphere.radius = sphereRadii[PARAMS_GET_U(this->dyna.actor.params, 0, 8)];
this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[PARAMS_GET_U(this->dyna.actor.params, 0, 8)];
}
void BgHidanKowarerukabe_OffsetActorYPos(BgHidanKowarerukabe* this) {
static f32 actorYPosOffsets[] = { 0.7f, 0.0f, 0.0f };
this->dyna.actor.world.pos.y = actorYPosOffsets[this->dyna.actor.params & 0xFF] + this->dyna.actor.home.pos.y;
this->dyna.actor.world.pos.y =
actorYPosOffsets[PARAMS_GET_U(this->dyna.actor.params, 0, 8)] + this->dyna.actor.home.pos.y;
}
static InitChainEntry sInitChain[] = {
@ -115,8 +116,8 @@ void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) {
BgHidanKowarerukabe_InitDynaPoly(this, play);
if (((this->dyna.actor.params & 0xFF) < CRACKED_STONE_FLOOR) ||
((this->dyna.actor.params & 0xFF) > LARGE_BOMBABLE_WALL)) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) < CRACKED_STONE_FLOOR ||
PARAMS_GET_U(this->dyna.actor.params, 0, 8) > LARGE_BOMBABLE_WALL) {
// "Error: Fire Temple Breakable Walls. arg_data I can't determine the (%s %d)(arg_data 0x%04x)"
PRINTF("Error : 炎の神殿 壊れる壁 の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n",
"../z_bg_hidan_kowarerukabe.c", 254, this->dyna.actor.params);
@ -124,7 +125,7 @@ void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) {
return;
}
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -283,7 +284,7 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, PlayState* pl
}
void BgHidanKowarerukabe_Break(BgHidanKowarerukabe* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case CRACKED_STONE_FLOOR:
BgHidanKowarerukabe_FloorBreak(this, play);
break;
@ -304,9 +305,9 @@ void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play) {
if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) {
BgHidanKowarerukabe_Break(this, play);
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
if ((this->dyna.actor.params & 0xFF) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) {
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_EXPLOSION);
} else {
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN);
@ -329,7 +330,7 @@ void BgHidanKowarerukabe_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_hidan_kowarerukabe.c", 568),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, sBreakableWallDLists[this->dyna.actor.params & 0xFF]);
gSPDisplayList(POLY_OPA_DISP++, sBreakableWallDLists[PARAMS_GET_U(this->dyna.actor.params, 0, 8)]);
Collider_UpdateSpheres(0, &this->collider);

View file

@ -74,10 +74,10 @@ void BgHidanRock_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
this->type = thisx->params & 0xFF;
this->type = PARAMS_GET_U(thisx->params, 0, 8);
this->unk_169 = 0;
thisx->params = ((thisx->params) >> 8) & 0xFF;
thisx->params = PARAMS_GET_U(thisx->params, 8, 8);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit);

View file

@ -9,8 +9,8 @@
#define FLAGS 0
#define BGICESHELTER_GET_TYPE(thisx) (((thisx)->params >> 8) & 7)
#define BGICESHELTER_NO_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 1)
#define BGICESHELTER_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 8, 3)
#define BGICESHELTER_NO_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 6, 1)
void BgIceShelter_Init(Actor* thisx, PlayState* play);
void BgIceShelter_Destroy(Actor* thisx, PlayState* play);
@ -183,7 +183,8 @@ void BgIceShelter_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
// The only red ice actor in the game that doesn't use a switch flag is the one for King Zora
if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor) && (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F))) {
if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor) &&
(Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)))) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -432,7 +433,7 @@ void BgIceShelter_Melt(BgIceShelter* this, PlayState* play) {
if (this->alpha <= 0) {
if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor)) {
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
}
if (type == RED_ICE_KING_ZORA) {

View file

@ -53,8 +53,8 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) {
colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 0);
sp28 = this->dyna.actor.params & 0xFF;
this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF;
sp28 = PARAMS_GET_U(this->dyna.actor.params, 0, 8);
this->dyna.actor.params = PARAMS_GET_U(this->dyna.actor.params, 8, 8);
CollisionHeader_GetVirtual(&object_ice_objects_Col_002854, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (sp28 == 2) {

View file

@ -51,7 +51,8 @@ void BgInGate_Init(Actor* thisx, PlayState* play) {
}
Actor_SetScale(&this->dyna.actor, 0.1f);
if (((this->dyna.actor.params & 1) != 0) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6)) {
if ((PARAMS_GET_U(this->dyna.actor.params, 0, 1) != 0) &&
(GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6)) {
play->csCtx.curFrame = 0;
BgInGate_SetupAction(this, func_80892890);
} else {
@ -72,7 +73,7 @@ void func_80892890(BgInGate* this, PlayState* play) {
if (play->csCtx.curFrame >= 50) {
phi0 = 0x4000;
if ((this->dyna.actor.params & 2) == 0) {
if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 1, 1)) {
phi0 = -0x4000;
}
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y + phi0;
@ -86,7 +87,7 @@ void func_80892890(BgInGate* this, PlayState* play) {
}
csFrames = (Math_SinS(csFrames) * 16384.0f);
phi1 = csFrames;
if ((this->dyna.actor.params & 2) == 0) {
if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 1, 1)) {
phi1 = -phi1;
}
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y + phi1;

View file

@ -105,7 +105,7 @@ void BgJya1flift_Init(Actor* thisx, PlayState* play) {
BgJya1flift_InitDynapoly(this, play, &g1fliftCol, 0);
Actor_ProcessInitChain(thisx, sInitChain);
BgJya1flift_InitCollision(thisx, play);
if (Flags_GetSwitch(play, (thisx->params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) {
LINK_AGE_IN_YEARS == YEARS_ADULT ? BgJya1flift_ChangeDirection(this) : BgJya1flift_SetupDoNothing(this);
} else {
BgJya1flift_SetupWaitForSwitch(this);
@ -131,7 +131,7 @@ void BgJya1flift_SetupWaitForSwitch(BgJya1flift* this) {
}
void BgJya1flift_WaitForSwitch(BgJya1flift* this, PlayState* play) {
if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
BgJya1flift_ChangeDirection(this);
}
}

View file

@ -43,7 +43,7 @@ void BgJyaBlock_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(play, thisx->params & 0x3F)) {
if ((LINK_AGE_IN_YEARS != YEARS_CHILD) || !Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
}
}

View file

@ -78,7 +78,7 @@ void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
BgJyaBombchuiwa_SetupCollider(this, play);
if (Flags_GetSwitch(play, this->actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6))) {
BgJyaBombchuiwa_SpawnLightRay(this, play);
} else {
BgJyaBombchuiwa_SetupWaitForExplosion(this, play);

View file

@ -91,17 +91,17 @@ void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) {
void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) {
BgJyaBombiwa* this = (BgJyaBombiwa*)thisx;
if ((this->dyna.actor.params & 0x3F) != 0x29) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 6) != 0x29) {
PRINTF(VT_COL(YELLOW, BLACK));
// "Warning: Switch Number changed (%s %d)(SW %d)"
PRINTF(" : Switch Number が変更された(%s %d)(SW %d)\n", "../z_bg_jya_bombiwa.c", 218,
this->dyna.actor.params & 0x3F);
PARAMS_GET_U(this->dyna.actor.params, 0, 6));
PRINTF(VT_RST);
}
BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, 0);
BgJyaBombiwa_InitCollider(this, play);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
} else {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
@ -167,7 +167,7 @@ void BgJyaBombiwa_Update(Actor* thisx, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
BgJyaBombiwa_Break(this, play);
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN);
Actor_Kill(&this->dyna.actor);
} else {

View file

@ -153,7 +153,7 @@ void func_80895A70(BgJyaCobra* this) {
BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent;
MirRay* mirRay;
switch (this->dyna.actor.params & 3) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 2)) {
case 0:
mirRay = (MirRay*)this->dyna.actor.child;
if (mirRay == NULL) {
@ -186,7 +186,7 @@ void func_80895A70(BgJyaCobra* this) {
mirRay->unLit = 0;
Math_Vec3f_Copy(&mirRay->sourcePt, &this->unk_180);
Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_NEW);
Matrix_RotateX(BINANG_TO_RAD(D_80897308[this->dyna.actor.params & 3]), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD(D_80897308[PARAMS_GET_U(this->dyna.actor.params, 0, 2)]), MTXMODE_APPLY);
sp28.x = 0.0f;
sp28.y = 0.0;
sp28.z = this->unk_190 * 2800.0f;
@ -212,14 +212,14 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) {
BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent;
f32 phi_f0;
if ((params & 3) == 2 && mirror != NULL &&
if (PARAMS_GET_U(params, 0, 2) == 2 && mirror != NULL &&
(!(mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) ||
!(mirror->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED))) {
Math_StepToF(&this->unk_18C, 0.0f, 0.05f);
} else {
this->unk_18C = 1.0f;
if (D_80897310[params & 3]) {
phi_v0 = this->dyna.actor.shape.rot.y - D_80897314[params & 3];
if (D_80897310[PARAMS_GET_U(params, 0, 2)]) {
phi_v0 = this->dyna.actor.shape.rot.y - D_80897314[PARAMS_GET_U(params, 0, 2)];
phi_v0 = ABS(phi_v0);
if (phi_v0 < 0x2000 && phi_v0 != -0x8000) {
this->unk_18C += (phi_v0 - 0x2000) * (3.0f / 0x4000);
@ -234,9 +234,9 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) {
this->unk_180.y = this->dyna.actor.world.pos.y + 57.0f;
this->unk_180.z = this->dyna.actor.world.pos.z;
if ((params & 3) == 0) {
if (PARAMS_GET_U(params, 0, 2) == 0) {
this->unk_190 = 0.1f;
} else if ((params & 3) == 1) {
} else if (PARAMS_GET_U(params, 0, 2) == 1) {
phi_f0 = 0.1f;
phi_v0 = this->dyna.actor.shape.rot.y - 0x8000;
if (phi_v0 < 0x500 && phi_v0 > -0x500) {
@ -249,7 +249,7 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) {
}
}
Math_StepToF(&this->unk_190, phi_f0, 0.04f);
} else if ((params & 3) == 2) {
} else if (PARAMS_GET_U(params, 0, 2) == 2) {
phi_f0 = 0.1f;
phi_v0 = this->dyna.actor.shape.rot.y - 0x8000;
if (phi_v0 < 0x500 && phi_v0 > -0x500) {
@ -286,8 +286,8 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) {
Lib_MemSet(shadowTex, COBRA_SHADOW_TEX_SIZE, 0);
Matrix_RotateX((M_PI / 4), MTXMODE_NEW);
rotY = !(this->dyna.actor.params & 3) ? (this->dyna.actor.shape.rot.y + 0x4000)
: (this->dyna.actor.shape.rot.y - 0x4000);
rotY = !PARAMS_GET_U(this->dyna.actor.params, 0, 2) ? (this->dyna.actor.shape.rot.y + 0x4000)
: (this->dyna.actor.shape.rot.y - 0x4000);
Matrix_RotateY(BINANG_TO_RAD(rotY), MTXMODE_APPLY);
Matrix_Scale(0.9f, 0.9f, 0.9f, MTXMODE_APPLY);
@ -408,21 +408,22 @@ void BgJyaCobra_Init(Actor* thisx, PlayState* play) {
BgJyaCobra_InitDynapoly(this, play, &gCobraCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(play, ((s32)this->dyna.actor.params >> 8) & 0x3F)) {
if (!PARAMS_GET_U(this->dyna.actor.params, 0, 2) &&
Flags_GetSwitch(play, PARAMS_GET_U((s32)this->dyna.actor.params, 8, 6))) {
this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y = 0;
}
if (!(this->dyna.actor.params & 3)) {
if (!PARAMS_GET_U(this->dyna.actor.params, 0, 2)) {
BgJyaCobra_SpawnRay(this, play);
}
func_80896918(this, play);
if ((this->dyna.actor.params & 3) == 1 || (this->dyna.actor.params & 3) == 2) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 1 || PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 2) {
this->dyna.actor.room = -1;
}
if ((this->dyna.actor.params & 3) == 1) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 1) {
BgJyaCobra_UpdateShadowFromTop(this);
}
@ -528,7 +529,7 @@ void BgJyaCobra_Update(Actor* thisx, PlayState* play2) {
func_80895C74(this, play);
func_80895A70(this);
if ((this->dyna.actor.params & 3) == 0 || (this->dyna.actor.params & 3) == 2) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 0 || PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 2) {
BgJyaCobra_UpdateShadowFromSide(this);
}
}
@ -551,7 +552,7 @@ void func_80896D78(BgJyaCobra* this, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_cobra.c", 924);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
sp44.x = D_80897308[this->dyna.actor.params & 3] + this->dyna.actor.shape.rot.x;
sp44.x = D_80897308[PARAMS_GET_U(this->dyna.actor.params, 0, 2)] + this->dyna.actor.shape.rot.x;
sp44.y = this->dyna.actor.shape.rot.y;
sp44.z = this->dyna.actor.shape.rot.z;
Matrix_SetTranslateRotateYXZ(this->unk_180.x, this->unk_180.y, this->unk_180.z, &sp44);
@ -567,7 +568,7 @@ void func_80896D78(BgJyaCobra* this, PlayState* play) {
void BgJyaCobra_DrawShadow(BgJyaCobra* this, PlayState* play) {
s32 pad;
s16 params = this->dyna.actor.params & 3;
s16 params = PARAMS_GET_U(this->dyna.actor.params, 0, 2);
Vec3f sp64;
Vec3s* phi_a3;
@ -618,7 +619,7 @@ void BgJyaCobra_Draw(Actor* thisx, PlayState* play) {
func_80896D78(this, play);
}
if ((this->dyna.actor.params & 3) == 2) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 2) == 2) {
BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent;
if (mirror != NULL && (mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) &&

View file

@ -84,7 +84,7 @@ void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, PlayState* play) {
Collider_InitCylinder(play, colCylinder);
Collider_SetCylinder(play, colCylinder, &this->dyna.actor, &sCylinderInit);
if ((this->dyna.actor.params & 1) == 1) {
if (PARAMS_GET_U(this->dyna.actor.params, 0, 1) == 1) {
this->colCylinder.dim.radius = 40;
this->colCylinder.dim.height = 100;
}
@ -227,7 +227,7 @@ void BgJyaIronobj_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
BgJyaIronobj_InitCylinder(this, play);
CollisionHeader_GetVirtual(sCollisionHeaders[thisx->params & 1], &colHeader);
CollisionHeader_GetVirtual(sCollisionHeaders[PARAMS_GET_U(thisx->params, 0, 1)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
func_808992D8(this);
}
@ -253,7 +253,7 @@ void func_808992E8(BgJyaIronobj* this, PlayState* play) {
actor = this->colCylinder.base.ac;
this->colCylinder.base.acFlags &= ~AC_HIT;
if (actor != NULL && actor->id == ACTOR_EN_IK) {
particleFunc[this->dyna.actor.params & 1](this, play, (EnIk*)actor);
particleFunc[PARAMS_GET_U(this->dyna.actor.params, 0, 1)](this, play, (EnIk*)actor);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR);
dropPos.x = this->dyna.actor.world.pos.x;
dropPos.y = this->dyna.actor.world.pos.y + 20.0f;
@ -277,5 +277,5 @@ void BgJyaIronobj_Update(Actor* thisx, PlayState* play) {
}
void BgJyaIronobj_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, sOpaDL[thisx->params & 1]);
Gfx_DrawDListOpa(play, sOpaDL[PARAMS_GET_U(thisx->params, 0, 1)]);
}

View file

@ -63,7 +63,7 @@ void BgJyaKanaami_Init(Actor* thisx, PlayState* play) {
BgJyaKanaami_InitDynaPoly(this, play, &gKanaamiCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_80899A08(this);
} else {
func_80899880(this);
@ -83,7 +83,7 @@ void func_80899880(BgJyaKanaami* this) {
}
void func_80899894(BgJyaKanaami* this, PlayState* play) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || this->unk_16A > 0) {
if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) {
OnePointCutscene_Init(play, 3450, -99, &this->dyna.actor, CAM_ID_MAIN);
}

View file

@ -63,7 +63,7 @@ void BgJyaLift_Init(Actor* thisx, PlayState* play) {
PRINTF("女神リフト CT\n");
BgJyaLift_InitDynapoly(this, play, &gLiftCol, 0);
Actor_ProcessInitChain(thisx, sInitChain);
if (Flags_GetSwitch(play, (thisx->params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) {
BgJyaLift_SetFinalPosY(this);
} else {
BgJyaLift_SetInitPosY(this);
@ -92,7 +92,7 @@ void BgJyaLift_SetInitPosY(BgJyaLift* this) {
}
void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || (this->moveDelay > 0)) {
this->moveDelay++;
if (this->moveDelay >= 20) {
OnePointCutscene_Init(play, 3430, -99, &this->dyna.actor, CAM_ID_MAIN);

View file

@ -161,7 +161,7 @@ void BgJyaMegami_Init(Actor* thisx, PlayState* play) {
BgJyaMegami_InitDynaPoly(this, play, &GMegamiCol, 0);
BgJyaMegami_InitCollider(this, play);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
} else {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
@ -195,7 +195,7 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) {
this->lightTimer--;
}
if (this->lightTimer > 40) {
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
BgJyaMegami_SetupExplode(this);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION);
OnePointCutscene_Init(play, 3440, -99, &this->dyna.actor, CAM_ID_MAIN);

View file

@ -49,7 +49,7 @@ void BgMenkuriNisekabe_Update(Actor* thisx, PlayState* play) {
void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play) {
BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx;
u32 index = this->actor.params & 0xFF;
u32 index = PARAMS_GET_U(this->actor.params, 0, 8);
if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) {
Gfx_DrawDListXlu(play, sDLists[index]);

View file

@ -176,12 +176,12 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->yRot = this->dyna.actor.world.pos.y;
this->dList = sDLists[(u16)this->dyna.actor.params & 0xF];
this->dList = sDLists[PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)];
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(sColHeaders[(u16)this->dyna.actor.params & 0xF], &colHeader);
CollisionHeader_GetVirtual(sColHeaders[PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
switch ((u16)this->dyna.actor.params & 0xF) {
switch (PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)) {
case MIZUBWALL_FLOOR: {
f32 sin;
f32 cos;
@ -190,7 +190,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Vec3f offset;
Vec3f vtx[3];
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) {
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->dList = NULL;
this->actionFunc = BgMizuBwall_DoNothing;
@ -229,7 +229,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Vec3f offset;
Vec3f vtx[3];
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) {
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->dList = NULL;
this->actionFunc = BgMizuBwall_DoNothing;
@ -268,7 +268,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Vec3f offset;
Vec3f vtx[3];
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) {
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->dList = NULL;
this->actionFunc = BgMizuBwall_DoNothing;
@ -309,7 +309,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Vec3f offset;
Vec3f vtx[3];
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) {
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->dList = NULL;
this->actionFunc = BgMizuBwall_DoNothing;
@ -351,7 +351,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Vec3f offset;
Vec3f vtx[3];
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6))) {
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->dList = NULL;
this->actionFunc = BgMizuBwall_DoNothing;
@ -444,7 +444,7 @@ void BgMizuBwall_SpawnDebris(BgMizuBwall* this, PlayState* play) {
Vec3f debrisOffsets[15];
for (i = 0; i < ARRAY_COUNT(debrisOffsets); i++) {
switch ((u16)this->dyna.actor.params & 0xF) {
switch (PARAMS_GET_U((u16)this->dyna.actor.params, 0, 4)) {
case MIZUBWALL_FLOOR:
debrisOffsets[i].x = (Rand_ZeroOne() * 80.0f) - 40.0f;
debrisOffsets[i].y = Rand_ZeroOne() * 0;
@ -484,7 +484,7 @@ void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play) {
BgMizuBwall_SetAlpha(this, play);
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
Flags_SetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 8, 6));
this->breakTimer = 1;
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->dList = NULL;

View file

@ -10,11 +10,11 @@
#define FLAGS ACTOR_FLAG_4
#define MOVEBG_TYPE(params) (((u16)(params) >> 0xC) & 0xF)
#define MOVEBG_FLAGS(params) ((u16)(params)&0x3F)
#define MOVEBG_PATH_ID(params) (((u16)(params) >> 0x8) & 0xF)
#define MOVEBG_POINT_ID(params) ((u16)(params)&0xF)
#define MOVEBG_SPEED(params) (((u16)(params) >> 0x4) & 0xF)
#define MOVEBG_TYPE(params) PARAMS_GET_U((u16)(params), 12, 4)
#define MOVEBG_FLAGS(params) PARAMS_GET_U((u16)(params), 0, 6)
#define MOVEBG_PATH_ID(params) PARAMS_GET_U((u16)(params), 8, 4)
#define MOVEBG_POINT_ID(params) PARAMS_GET_U((u16)(params), 0, 4)
#define MOVEBG_SPEED(params) PARAMS_GET_U((u16)(params), 4, 4)
void BgMizuMovebg_Init(Actor* thisx, PlayState* play);
void BgMizuMovebg_Destroy(Actor* thisx, PlayState* play);

View file

@ -52,30 +52,30 @@ void BgMizuShutter_Init(Actor* thisx, PlayState* play) {
s32 pad3;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->displayList = sDisplayLists[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)];
this->displayList = sDisplayLists[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)];
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(sCollisionHeaders[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)], &colHeader);
CollisionHeader_GetVirtual(sCollisionHeaders[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if ((BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor) == BGMIZUSHUTTER_SMALL) ||
(BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor) == BGMIZUSHUTTER_LARGE)) {
if ((BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor) == BGMIZUSHUTTER_SMALL) ||
(BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor) == BGMIZUSHUTTER_LARGE)) {
this->closedPos = this->dyna.actor.world.pos;
this->timer = 0;
this->timerMax = BGMIZUSHUTTER_TIMER_PARAM(&this->dyna.actor) * 20;
this->timerMax = BGMIZUSHUTTER_GET_TIMER(&this->dyna.actor) * 20;
Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.world.rot.y), MTXMODE_NEW);
Matrix_RotateX(BINANG_TO_RAD(this->dyna.actor.world.rot.x), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(this->dyna.actor.world.rot.z), MTXMODE_APPLY);
Matrix_MultVec3f(&sDisplacements[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)], &this->openPos);
Matrix_MultVec3f(&sDisplacements[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)], &this->openPos);
this->openPos.x += this->dyna.actor.world.pos.x;
this->openPos.y += this->dyna.actor.world.pos.y;
this->openPos.z += this->dyna.actor.world.pos.z;
if (this->timerMax != 0x3F * 20) {
Flags_UnsetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor));
Flags_UnsetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor));
this->dyna.actor.world.pos = this->closedPos;
}
if (Flags_GetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor))) {
if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) {
this->dyna.actor.world.pos = this->openPos;
this->actionFunc = BgMizuShutter_WaitForTimer;
} else {
@ -92,7 +92,7 @@ void BgMizuShutter_Destroy(Actor* thisx, PlayState* play) {
}
void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play) {
if (Flags_GetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor))) {
if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) {
if (ABS(this->dyna.actor.world.rot.x) > 0x2C60) {
OnePointCutscene_Init(play, 4510, -99, &this->dyna.actor, CAM_ID_MAIN);
} else {
@ -111,7 +111,7 @@ void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play) {
}
void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) {
if (Flags_GetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor))) {
if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) {
Math_SmoothStepToF(&this->dyna.actor.world.pos.x, this->openPos.x, 1.0f, 4.0f, 0.1f);
Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->openPos.y, 1.0f, 4.0f, 0.1f);
Math_SmoothStepToF(&this->dyna.actor.world.pos.z, this->openPos.z, 1.0f, 4.0f, 0.1f);
@ -141,7 +141,7 @@ void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play) {
func_8002F994(&this->dyna.actor, this->timer);
if (this->timer == 0) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE);
Flags_UnsetSwitch(play, BGMIZUSHUTTER_SWITCH_PARAM(&this->dyna.actor));
Flags_UnsetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor));
this->actionFunc = BgMizuShutter_Move;
}
}

View file

@ -4,10 +4,11 @@
#include "ultra64.h"
#include "global.h"
#define BGMIZUSHUTTER_SIZE_PARAM(thisx) (((u16)(thisx)->params >> 0xC) & 0xF)
#define BGMIZUSHUTTER_TIMER_PARAM(thisx) (((u16)(thisx)->params >> 0x6) & 0x3F)
#define BGMIZUSHUTTER_SWITCH_PARAM(thisx) (((u16)(thisx)->params >> 0x0) & 0x3F)
#define BGMIZUSHUTTER_PARAMS(size, timer, switchFlag) (((size) << 0xC) | ((timer) << 0x6) | (switchFlag))
#define BGMIZUSHUTTER_GET_SIZE(thisx) PARAMS_GET_U((u16)(thisx)->params, 12, 4)
#define BGMIZUSHUTTER_GET_TIMER(thisx) PARAMS_GET_U((u16)(thisx)->params, 6, 6)
#define BGMIZUSHUTTER_GET_SWITCH(thisx) PARAMS_GET_U((u16)(thisx)->params, 0, 6)
#define BGMIZUSHUTTER_PARAMS(size, timer, switchFlag) (((size) << 12) | ((timer) << 6) | (switchFlag))
struct BgMizuShutter;

View file

@ -98,8 +98,8 @@ void BgMizuWater_Init(Actor* thisx, PlayState* play) {
s32 waterLevelActionIndex;
waterBoxes = play->colCtx.colHeader->waterBoxes;
this->type = this->actor.params & 0xFF;
this->switchFlag = (this->actor.params >> 8) & 0xFF;
this->type = PARAMS_GET_U(this->actor.params, 0, 8);
this->switchFlag = PARAMS_GET_U(this->actor.params, 8, 8);
Actor_ProcessInitChain(&this->actor, sInitChain);
initialActorY = this->actor.world.pos.y;
this->baseY = initialActorY;

View file

@ -75,7 +75,7 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) {
// "mori (bigST.keyceiling)"
PRINTF("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params,
Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F),
Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)),
Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room),
GET_PLAYER(play)->actor.world.pos.y);
BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0);
@ -88,7 +88,7 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->dyna.actor);
return;
}
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 270.0f;
@ -114,7 +114,7 @@ void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
thisx->draw = BgMoriBigst_Draw;
if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) {
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 6))) {
BgMoriBigst_SetupDone(this, play);
} else {
BgMoriBigst_SetupStalfosFight(this, play);
@ -219,7 +219,7 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) {
void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play) {
if ((this->dyna.actor.home.rot.z == 0) && !Player_InCsMode(play)) {
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
BgMoriBigst_SetupDone(this, play);
}
}

View file

@ -139,7 +139,7 @@ void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) {
void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
if (play->roomCtx.curRoom.num == 2) {
this->dyna.actor.world.pos.y = 73.0f;
BgMoriElevator_SetupSetPosition(this);
@ -214,12 +214,12 @@ void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play) {
} else if ((play->roomCtx.curRoom.num == 17) && (-275.0f < this->dyna.actor.world.pos.y)) {
this->targetY = -779.0f;
BgMoriElevator_StopMovement(this);
} else if ((play->roomCtx.curRoom.num == 2) && Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) &&
} else if ((play->roomCtx.curRoom.num == 2) && Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) &&
(this->unk_16C == 0)) {
this->targetY = 73.0f;
func_808A1C30(this);
} else if ((play->roomCtx.curRoom.num == 2) && !Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) &&
(this->unk_16C != 0)) {
} else if ((play->roomCtx.curRoom.num == 2) &&
!Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) && (this->unk_16C != 0)) {
this->targetY = 233.0f;
func_808A1CF4(this, play);
}
@ -249,7 +249,7 @@ void BgMoriElevator_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
this->unk_170 = this->dyna.interactFlags;
this->unk_16C = Flags_GetSwitch(play, (thisx->params & 0x3F));
this->unk_16C = Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6));
}
void BgMoriElevator_Draw(Actor* thisx, PlayState* play) {

View file

@ -71,7 +71,7 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgMoriHashira4* this = (BgMoriHashira4*)thisx;
this->switchFlag = (this->dyna.actor.params >> 8) & 0x3F;
this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 8, 6);
this->dyna.actor.params &= 0xFF;
if (this->dyna.actor.params == 0) {

View file

@ -61,16 +61,16 @@ void BgMoriHineri_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
switchFlagParam = this->dyna.actor.params & 0x3F;
t6 = this->dyna.actor.params & 0x4000;
switchFlagParam = PARAMS_GET_U(this->dyna.actor.params, 0, 6);
t6 = PARAMS_GET_NOSHIFT(this->dyna.actor.params, 14, 1);
if (t6 != 0) {
this->switchFlag = switchFlagParam;
} else {
this->switchFlag = ((this->dyna.actor.params >> 8) & 0x3F);
this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 8, 6);
this->switchFlag = (Flags_GetSwitch(play, this->switchFlag)) ? 1 : 0;
}
this->dyna.actor.params = ((this->dyna.actor.params & 0x8000) >> 0xE);
this->dyna.actor.params = TWISTED_HALLWAY_GET_PARAM_15(&this->dyna.actor);
if (Flags_GetSwitch(play, switchFlagParam)) {
if (this->dyna.actor.params == 0) {
this->dyna.actor.params = 1;

View file

@ -6,6 +6,9 @@
struct BgMoriHineri;
// Due to a unique access pattern, this param cannot use the generic "PARAMS_GET_U" macros
#define TWISTED_HALLWAY_GET_PARAM_15(thisx) (((thisx)->params & (NBITS_TO_MASK(1) << (15))) >> ((15) - (1)))
typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*);
typedef struct BgMoriHineri {

View file

@ -58,7 +58,7 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) {
this->actor.scale.z = 1.0f;
this->actor.world.pos.x = 119.0f;
this->actor.world.pos.z = -1820.0f;
this->prevSwitchFlagSet = Flags_GetSwitch(play, this->actor.params & 0x3F);
this->prevSwitchFlagSet = Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6));
if (this->prevSwitchFlagSet != 0) {
this->actor.world.pos.y = -282.0f;
BgMoriIdomizu_SetWaterLevel(play, -282);
@ -111,7 +111,7 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play) {
s32 switchFlagSet;
roomNum = play->roomCtx.curRoom.num;
switchFlagSet = Flags_GetSwitch(play, thisx->params & 0x3F);
switchFlagSet = Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6));
if (switchFlagSet) {
this->targetWaterLevel = -282.0f;
} else {

View file

@ -196,8 +196,8 @@ void BgPoEvent_Init(Actor* thisx, PlayState* play) {
BgPoEvent* this = (BgPoEvent*)thisx;
Actor_ProcessInitChain(thisx, sInitChain);
this->type = (thisx->params >> 8) & 0xF;
this->index = (thisx->params >> 0xC) & 0xF;
this->type = PARAMS_GET_U(thisx->params, 8, 4);
this->index = PARAMS_GET_U(thisx->params, 12, 4);
thisx->params &= 0x3F;
if (this->type >= 2) {

View file

@ -80,7 +80,7 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain);
this->flameColor = (thisx->params >> 8) & 0xFF;
this->flameColor = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0x3F;
thisx->colChkInfo.mass = MASS_IMMOVABLE;

View file

@ -50,8 +50,8 @@ void BgRelayObjects_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = thisx->params & 0x3F;
thisx->params = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 0, 6);
thisx->params = PARAMS_GET_U(thisx->params, 8, 8);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
if (thisx->params == WINDMILL_ROTATING_GEAR) {
CollisionHeader_GetVirtual(&gWindmillRotatingPlatformCol, &colHeader);

View file

@ -45,7 +45,7 @@ static Gfx* D_808AC510[] = {
void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) {
BgSpot01Objects2* this = (BgSpot01Objects2*)thisx;
switch (this->dyna.actor.params & 7) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 3)) {
case 0:
case 1:
case 2:
@ -99,7 +99,7 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) {
this->dyna.actor.objectSlot = this->requiredObjectSlot;
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
switch (this->dyna.actor.params & 7) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 3)) {
case 4: // Shooting gallery
CollisionHeader_GetVirtual(&gKakarikoShootingGalleryCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
@ -108,10 +108,10 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) {
CollisionHeader_GetVirtual(&object_spot01_matoyab_col, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
if (IS_DAY) {
func_808AC22C(play->pathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0);
func_808AC22C(play->pathList, &position, PARAMS_GET_U((s32)thisx->params, 8, 8), 0);
Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_DAIKU_KAKARIKO, position.x, position.y,
position.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z,
((((s32)thisx->params >> 8) & 0xFF) << 8) + 1);
(PARAMS_GET_U((s32)thisx->params, 8, 8) << 8) + 1);
}
break;
case 0: // Potion Shop Poster
@ -135,5 +135,5 @@ void BgSpot01Objects2_Update(Actor* thisx, PlayState* play) {
}
void func_808AC4A4(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, D_808AC510[thisx->params & 7]);
Gfx_DrawDListOpa(play, D_808AC510[PARAMS_GET_U(thisx->params, 0, 3)]);
}

View file

@ -53,8 +53,8 @@ void BgSpot02Objects_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, 0);
this->unk_16B = (u16)(thisx->params >> 8);
thisx->params = (u16)(thisx->params & 0xFF);
this->unk_16B = (u16)PARAMS_GET_NOMASK(thisx->params, 8);
thisx->params = (u16)PARAMS_GET_U(thisx->params, 0, 8);
switch (thisx->params) {
case 0:

View file

@ -47,7 +47,7 @@ void BgSpot03Taki_Init(Actor* thisx, PlayState* play) {
s16 pad;
CollisionHeader* colHeader = NULL;
this->switchFlag = (this->dyna.actor.params & 0x3F);
this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6);
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&object_spot03_object_Col_000C98, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -45,7 +45,7 @@ void BgSpot05Soko_Init(Actor* thisx, PlayState* play) {
s32 pad2;
Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params == 0) {

View file

@ -96,8 +96,8 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) {
s32 pad;
CollisionHeader* colHeader = NULL;
this->switchFlag = thisx->params & 0xFF;
thisx->params = (thisx->params >> 8) & 0xFF;
this->switchFlag = PARAMS_GET_U(thisx->params, 0, 8);
thisx->params = PARAMS_GET_U(thisx->params, 8, 8);
PRINTF("spot06 obj nthisx->arg_data=[%d]", thisx->params);

View file

@ -162,7 +162,7 @@ void BgSpot08Bakudankabe_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, 0);
if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -184,7 +184,7 @@ void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
func_808B0324(this, play);
Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F));
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN);
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
Actor_Kill(&this->dyna.actor);

View file

@ -59,7 +59,7 @@ void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, Coll
// Sets params to 0x10 (medium, nonrotating) if not in the cases listed.
void BgSpot08Iceblock_CheckParams(BgSpot08Iceblock* this) {
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case 0xFF:
this->dyna.actor.params = 0x10;
break;
@ -90,7 +90,7 @@ void BgSpot08Iceblock_SinkUnderPlayer(BgSpot08Iceblock* this) {
f32 target;
f32 step;
switch (this->dyna.actor.params & 0xF0) {
switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) {
case 0:
step = 0.15f;
break;
@ -177,7 +177,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(play);
switch (this->dyna.actor.params & 0xFF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case 0x11: // Medium nonrotating
rollDataIndex = 0;
break;
@ -262,7 +262,7 @@ void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, PlayState* play) {
sin = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f;
cos = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f;
if (!(this->dyna.actor.params & 0x100)) {
if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 1)) {
Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT08_ICEBLOCK,
this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, this->dyna.actor.home.pos.z,
this->dyna.actor.home.rot.x, this->dyna.actor.home.rot.y, this->dyna.actor.home.rot.z,
@ -291,7 +291,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) {
PRINTF("(spot08 流氷)(arg_data 0x%04x)\n", this->dyna.actor.params);
BgSpot08Iceblock_CheckParams(this);
switch (this->dyna.actor.params & 0x200) {
switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) {
case 0:
colHeader = &gZorasFountainIcebergCol;
break;
@ -300,7 +300,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) {
break;
}
switch (this->dyna.actor.params & 0xF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) {
case 2:
case 3:
BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
@ -317,7 +317,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
switch (this->dyna.actor.params & 0xF0) {
switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) {
case 0:
Actor_SetScale(&this->dyna.actor, 0.2f);
break;
@ -334,7 +334,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) {
this->surfaceNormal.y = 1.0f;
this->rotationAxis.x = 1.0f;
switch (this->dyna.actor.params & 0xF) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) {
case 0:
case 1:
BgSpot08Iceblock_SetupFloatNonrotating(this);
@ -395,7 +395,7 @@ void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play
BgSpot08Iceblock_SetWaterline(this);
// parent handles rotations of both
if (!(this->dyna.actor.params & 0x100)) {
if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 1)) {
this->dyna.actor.world.rot.y += 0x190;
sin = Math_SinS(this->dyna.actor.world.rot.y) * 100.0f;
cos = Math_CosS(this->dyna.actor.world.rot.y) * 100.0f;
@ -436,7 +436,7 @@ void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play) {
Gfx* dList;
BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx;
switch (this->dyna.actor.params & 0x200) {
switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) {
case 0:
dList = gZorasFountainIcebergDL;
break;

View file

@ -113,7 +113,7 @@ void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, 0);
if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -136,7 +136,7 @@ void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
func_808B2218(this, play);
Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F));
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
SfxSource_PlaySfxAtFixedWorldPos(play, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN);
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
Actor_Kill(&this->dyna.actor);

View file

@ -67,7 +67,7 @@ void BgSpot12Gate_Init(Actor* thisx, PlayState* play) {
BgSpot12Gate_InitDynaPoly(this, play, &gGerudoFortressWastelandGateCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_808B3274(this);
} else {
func_808B30C0(this);
@ -86,7 +86,7 @@ void func_808B30C0(BgSpot12Gate* this) {
}
void func_808B30D8(BgSpot12Gate* this, PlayState* play) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_808B3134(this);
OnePointCutscene_Init(play, 4160, -99, &this->dyna.actor, CAM_ID_MAIN);
}

View file

@ -63,7 +63,7 @@ void BgSpot12Saku_Init(Actor* thisx, PlayState* play) {
func_808B3420(this, play, &gGerudoFortressGTGShutterCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_808B3714(this);
} else {
func_808B3550(this);
@ -84,7 +84,7 @@ void func_808B3550(BgSpot12Saku* this) {
}
void func_808B357C(BgSpot12Saku* this, PlayState* play) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_808B35E4(this);
this->timer = 20;
OnePointCutscene_Init(play, 4170, -99, &this->dyna.actor, CAM_ID_MAIN);

View file

@ -126,7 +126,7 @@ void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play) {
func_808B3960(this, play, &gLonLonMilkCrateCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
func_808B3A34(this);
if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
func_808B44B8(this, play);
this->dyna.actor.world.pos = D_808B45C4[D_808B4590];
D_808B4590++;

View file

@ -144,8 +144,8 @@ static f32 D_808B6074[] = { 66.0f, 51.0f, 48.0f, 36.0f, 21.0f };
static s16 D_808B6088[] = { 0, 1, 2, 3, 4 };
void func_808B4C30(BgSpot16Bombstone* this) {
this->switchFlag = (this->actor.params >> 8) & 0x3F;
this->actor.params &= 0xFF;
this->switchFlag = PARAMS_GET_U(this->actor.params, 8, 6);
this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8);
}
void func_808B4C4C(BgSpot16Bombstone* this, PlayState* play) {

View file

@ -96,7 +96,7 @@ void BgSpot17Bakudankabe_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, 0);
if (Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -115,7 +115,7 @@ void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play) {
BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx;
if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(play, &this->dyna.actor) != NULL) {
func_808B6BC0(this, play);
Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F));
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN);
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
Actor_Kill(&this->dyna.actor);

View file

@ -144,7 +144,7 @@ void BgSpot18Basket_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.home.pos.y += 0.01f;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
func_808B7BB0(this);
return;
}
@ -174,7 +174,7 @@ void func_808B7AEC(BgSpot18Basket* this) {
}
void func_808B7AFC(BgSpot18Basket* this, PlayState* play) {
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
OnePointCutscene_Init(play, 4220, 80, &this->dyna.actor, CAM_ID_MAIN);
func_808B7B58(this);
}
@ -382,15 +382,15 @@ void func_808B81A0(BgSpot18Basket* this, PlayState* play) {
}
}
} else if (this->unk_218 == 2) {
if ((this->unk_21A != 0) || Flags_GetCollectible(play, (actor->params & 0x3F))) {
if ((this->unk_21A != 0) || Flags_GetCollectible(play, PARAMS_GET_U(actor->params, 0, 6))) {
collectible = Item_DropCollectible(play, &tempVector, ITEM00_RUPEE_PURPLE);
if (collectible != NULL) {
collectible->actor.velocity.y = 11.0f;
collectible->actor.world.rot.y = D_808B85E4[1];
}
} else {
collectible =
Item_DropCollectible(play, &tempVector, ((actor->params & 0x3F) << 8) | ITEM00_HEART_PIECE);
collectible = Item_DropCollectible(play, &tempVector,
(PARAMS_GET_U(actor->params, 0, 6) << 8) | ITEM00_HEART_PIECE);
if (collectible != NULL) {
collectible->actor.velocity.y = 11.0f;
collectible->actor.world.rot.y = D_808B85E4[1];

View file

@ -101,13 +101,13 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) {
return 0;
}
switch (D_808B90F0[this->dyna.actor.params & 0xF][age]) {
switch (D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age]) {
case 0:
case 1:
if (D_808B90F0[this->dyna.actor.params & 0xF][age] == 0) {
if (D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age] == 0) {
PRINTF("出現しない Object (0x%04x)\n", this->dyna.actor.params);
}
return D_808B90F0[this->dyna.actor.params & 0xF][age];
return D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age];
case 2:
PRINTF("Error : Obj出現判定が設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 202,
this->dyna.actor.params);
@ -120,7 +120,7 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) {
}
s32 func_808B8A5C(BgSpot18Obj* this, PlayState* play) {
Actor_SetScale(&this->dyna.actor, D_808B90F4[this->dyna.actor.params & 0xF]);
Actor_SetScale(&this->dyna.actor, D_808B90F4[PARAMS_GET_U(this->dyna.actor.params, 0, 4)]);
return 1;
}
@ -129,13 +129,13 @@ s32 func_808B8A98(BgSpot18Obj* this, PlayState* play) {
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(D_808B90FC[this->dyna.actor.params & 0xF], &colHeader);
CollisionHeader_GetVirtual(D_808B90FC[PARAMS_GET_U(this->dyna.actor.params, 0, 4)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
return 1;
}
s32 func_808B8B08(BgSpot18Obj* this, PlayState* play) {
this->dyna.actor.flags |= D_808B9104[this->dyna.actor.params & 0xF];
this->dyna.actor.flags |= D_808B9104[PARAMS_GET_U(this->dyna.actor.params, 0, 4)];
return 1;
}
@ -155,7 +155,7 @@ s32 func_808B8BB4(BgSpot18Obj* this, PlayState* play) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
func_808B9030(this);
} else if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
} else if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) {
func_808B9030(this);
this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.x;
this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z;
@ -172,8 +172,8 @@ s32 func_808B8C90(BgSpot18Obj* this, PlayState* play) {
}
s32 func_808B8CC8(BgSpot18Obj* this, PlayState* play) {
if ((D_808B913C[this->dyna.actor.params & 0xF] != NULL) &&
(!D_808B913C[this->dyna.actor.params & 0xF](this, play))) {
if ((D_808B913C[PARAMS_GET_U(this->dyna.actor.params, 0, 4)] != NULL) &&
(!D_808B913C[PARAMS_GET_U(this->dyna.actor.params, 0, 4)](this, play))) {
return 0;
}
return 1;
@ -255,7 +255,7 @@ void func_808B8F08(BgSpot18Obj* this, PlayState* play) {
this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z;
this->dyna.unk_150 = 0.0f;
player->stateFlags2 &= ~PLAYER_STATE2_4;
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6));
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
} else {
@ -281,5 +281,5 @@ void BgSpot18Obj_Update(Actor* thisx, PlayState* play) {
}
void BgSpot18Obj_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, sDlists[thisx->params & 0xF]);
Gfx_DrawDListOpa(play, sDlists[PARAMS_GET_U(thisx->params, 0, 4)]);
}

View file

@ -39,7 +39,7 @@ static InitChainEntry sInitChain[] = {
void BgSpot18Shutter_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgSpot18Shutter* this = (BgSpot18Shutter*)thisx;
s32 param = (this->dyna.actor.params >> 8) & 1;
s32 param = PARAMS_GET_U(this->dyna.actor.params, 8, 1);
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, 0);
@ -54,7 +54,7 @@ void BgSpot18Shutter_Init(Actor* thisx, PlayState* play) {
this->actionFunc = func_808B9618;
}
} else {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
this->actionFunc = func_808B95AC;
this->dyna.actor.world.pos.y += 180.0f;
} else {
@ -85,7 +85,7 @@ void func_808B95AC(BgSpot18Shutter* this, PlayState* play) {
}
void func_808B95B8(BgSpot18Shutter* this, PlayState* play) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) {
Actor_SetFocus(&this->dyna.actor, 70.0f);
OnePointCutscene_Attention(play, &this->dyna.actor);
this->actionFunc = func_808B9698;
@ -95,7 +95,7 @@ void func_808B95B8(BgSpot18Shutter* this, PlayState* play) {
void func_808B9618(BgSpot18Shutter* this, PlayState* play) {
if (GET_INFTABLE(INFTABLE_109)) {
Actor_SetFocus(&this->dyna.actor, 70.0f);
if (((this->dyna.actor.params >> 8) & 1) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 8, 1) == 0) {
this->actionFunc = func_808B9698;
} else {
this->actionFunc = func_808B971C;

View file

@ -44,8 +44,8 @@ void BgYdanHasi_Init(Actor* thisx, PlayState* play) {
WaterBox* waterBox;
Actor_ProcessInitChain(thisx, sInitChain);
this->type = ((thisx->params >> 8) & 0x3F);
thisx->params &= 0xFF;
this->type = PARAMS_GET_U(thisx->params, 8, 6);
thisx->params = PARAMS_GET_U(thisx->params, 0, 8);
waterBox = &play->colCtx.colHeader->waterBoxes[1];
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
if (thisx->params == HASI_WATER) {

View file

@ -88,8 +88,8 @@ void BgYdanMaruta_Init(Actor* thisx, PlayState* play) {
Collider_InitTris(play, &this->collider);
Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->elements);
this->switchFlag = this->dyna.actor.params & 0xFFFF;
thisx->params = (thisx->params >> 8) & 0xFF; // thisx is required to match here
this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 16);
thisx->params = PARAMS_GET_U(thisx->params, 8, 8); // thisx is required to match here
if (this->dyna.actor.params == 0) {
triInit = &sTrisElementsInit[0];

View file

@ -91,9 +91,9 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
f32 nSinsX;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->isDestroyedSwitchFlag = thisx->params & 0x3F;
this->burnSwitchFlag = (thisx->params >> 6) & 0x3F;
this->dyna.actor.params = (thisx->params >> 0xC) & 0xF;
this->isDestroyedSwitchFlag = PARAMS_GET_U(thisx->params, 0, 6);
this->burnSwitchFlag = PARAMS_GET_U(thisx->params, 6, 6);
this->dyna.actor.params = PARAMS_GET_U(thisx->params, 12, 4);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Collider_InitTris(play, &this->trisCollider);
Collider_SetTris(play, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems);

View file

@ -59,13 +59,13 @@ void func_808C0C50(BgZg* this) {
}
s32 func_808C0C98(BgZg* this, PlayState* play) {
s32 flag = (this->dyna.actor.params >> 8) & 0xFF;
s32 flag = PARAMS_GET_U(this->dyna.actor.params, 8, 8);
return Flags_GetSwitch(play, flag);
}
s32 func_808C0CC8(BgZg* this) {
s32 flag = this->dyna.actor.params & 0xFF;
s32 flag = PARAMS_GET_U(this->dyna.actor.params, 0, 8);
return flag;
}

View file

@ -910,8 +910,8 @@ void func_808FF898(BossGanon2* this, PlayState* play) {
if (actor->id == ACTOR_DEMO_GJ) {
DemoGj* gj = (DemoGj*)actor;
if (((actor->params & 0xFF) == 0x10) || ((actor->params & 0xFF) == 0x11) ||
((actor->params & 0xFF) == 0x16)) {
if ((PARAMS_GET_U(actor->params, 0, 8) == 0x10) || (PARAMS_GET_U(actor->params, 0, 8) == 0x11) ||
(PARAMS_GET_U(actor->params, 0, 8) == 0x16)) {
if (SQ(this->unk_218.x - gj->dyna.actor.world.pos.x) +
SQ(this->unk_218.z - gj->dyna.actor.world.pos.z) <
SQ(100.0f)) {
@ -951,8 +951,8 @@ s32 func_808FFA24(BossGanon2* this, PlayState* play) {
if (actor->id == ACTOR_DEMO_GJ) {
DemoGj* gj = (DemoGj*)actor;
if (((actor->params & 0xFF) == 0x10) || ((actor->params & 0xFF) == 0x11) ||
((actor->params & 0xFF) == 0x16)) {
if ((PARAMS_GET_U(actor->params, 0, 8) == 0x10) || (PARAMS_GET_U(actor->params, 0, 8) == 0x11) ||
(PARAMS_GET_U(actor->params, 0, 8) == 0x16)) {
if (SQ(this->actor.world.pos.x - gj->dyna.actor.world.pos.x) +
SQ(this->actor.world.pos.z - gj->dyna.actor.world.pos.z) <
SQ(200.0f)) {

View file

@ -2659,7 +2659,7 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) {
sp4C = 200.0f;
BossVa_Spark(play, this, 1, 125, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true);
this->actor.flags &= ~ACTOR_FLAG_0;
if (this->actor.params & 1) {
if (PARAMS_GET_U(this->actor.params, 0, 1)) {
sp4C = -200.0f;
}

View file

@ -170,8 +170,8 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
DemoEffect* crystalLight;
DemoEffect* lightRing;
effectType = (this->actor.params & 0x00FF);
lightEffect = ((this->actor.params & 0xF000) >> 12);
effectType = PARAMS_GET_S(this->actor.params, 0, 8);
lightEffect = PARAMS_GET_S(this->actor.params, 12, 4);
PRINTF(VT_FGCOL(CYAN) " no = %d\n" VT_RST, effectType);
@ -504,7 +504,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
void DemoEffect_Destroy(Actor* thisx, PlayState* play) {
DemoEffect* this = (DemoEffect*)thisx;
s32 effectType = (this->actor.params & 0x00FF);
s32 effectType = PARAMS_GET_S(this->actor.params, 0, 8);
if (effectType == DEMO_EFFECT_TIMEWARP_MASTERSWORD || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE ||
effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) {
@ -661,7 +661,7 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play) {
* 3) Timeblock is cleared with the Song of Time (Large and Small have different versions of Timewarp)
*/
void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) {
s32 effectType = (this->actor.params & 0x00FF);
s32 effectType = PARAMS_GET_S(this->actor.params, 0, 8);
if (!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) {
ASSERT(0, "0", "../z_demo_effect.c", 1283);
@ -773,7 +773,7 @@ void DemoEffect_UpdateTimeWarpTimeblock(DemoEffect* this, PlayState* play) {
shrinkProgress = (100 - this->timeWarp.shrinkTimer) * 0.010f;
scale = shrinkProgress * 0.14f;
if ((this->actor.params & 0x00FF) == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) {
if (PARAMS_GET_S(this->actor.params, 0, 8) == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) {
scale *= 0.6f;
}
@ -1016,7 +1016,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) {
u16 pad;
s32 isLargeSize;
isLargeSize = ((this->actor.params & 0x0F00) >> 8);
isLargeSize = PARAMS_GET_S(this->actor.params, 8, 4);
if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[this->cueChannel] != NULL) {
DemoEffect_SetPosRotFromCue(this, play, this->cueChannel, 0);
@ -2005,7 +2005,7 @@ s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s
void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
DemoEffect* this = (DemoEffect*)thisx;
u8 effectType = (this->actor.params & 0x00FF);
u8 effectType = PARAMS_GET_S(this->actor.params, 0, 8);
if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL ||
CutsceneFlags_Get(play, 1) || IS_CUTSCENE_LAYER || gSaveContext.save.entranceIndex == ENTR_TEMPLE_OF_TIME_4) {

View file

@ -77,23 +77,23 @@ typedef void (*DemoGjDrawFunc)(DemoGj*, PlayState*);
// bits 11-15
s32 DemoGj_GetCollectibleType(DemoGj* this) {
s32 params = this->dyna.actor.params >> 0xB;
s32 type = PARAMS_GET_U(this->dyna.actor.params, 11, 5);
return params & 0x1F;
return type;
}
// bits 8-10
s32 DemoGj_GetCollectibleAmount(DemoGj* this) {
s32 params = this->dyna.actor.params >> 0x8;
s32 amount = PARAMS_GET_U(this->dyna.actor.params, 8, 3);
return params & 7;
return amount;
}
// bits 0-7
s32 DemoGj_GetType(DemoGj* this) {
s32 params = this->dyna.actor.params;
s32 type = PARAMS_GET_U(this->dyna.actor.params, 0, 8);
return params & 0xFF;
return type;
}
void DemoGj_InitCylinder(DemoGj* this, PlayState* play, ColliderCylinder* cylinder,

View file

@ -66,9 +66,9 @@ void DoorAna_Init(Actor* thisx, PlayState* play) {
this->actor.shape.rot.z = 0;
this->actor.shape.rot.y = this->actor.shape.rot.z;
// init block for grottos that are initially "hidden" (require explosives/hammer/song of storms to open)
if ((this->actor.params & 0x300) != 0) {
if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 2) != 0) {
// only allocate collider for grottos that need bombing/hammering open
if ((this->actor.params & 0x200) != 0) {
if (PARAMS_GET_NOSHIFT(this->actor.params, 9, 1) != 0) {
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
} else {
@ -86,7 +86,7 @@ void DoorAna_Destroy(Actor* thisx, PlayState* play) {
DoorAna* this = (DoorAna*)thisx;
// free collider if it has one
if ((this->actor.params & 0x200) != 0) {
if (PARAMS_GET_NOSHIFT(this->actor.params, 9, 1) != 0) {
Collider_DestroyCylinder(play, &this->collider);
}
}
@ -95,7 +95,7 @@ void DoorAna_Destroy(Actor* thisx, PlayState* play) {
void DoorAna_WaitClosed(DoorAna* this, PlayState* play) {
u32 openGrotto = false;
if (!(this->actor.params & 0x200)) {
if (!PARAMS_GET_NOSHIFT(this->actor.params, 9, 1)) {
// opening with song of storms
if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && CutsceneFlags_Get(play, 5)) {
openGrotto = true;
@ -130,11 +130,11 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) {
if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) {
if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(player->stateFlags1 & PLAYER_STATE1_31) && (player->av1.actionVar1 == 0)) {
destinationIdx = ((this->actor.params >> 0xC) & 7) - 1;
destinationIdx = PARAMS_GET_U(this->actor.params, 12, 3) - 1;
Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF);
gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.home.rot.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF;
gSaveContext.respawn[RESPAWN_MODE_RETURN].data = PARAMS_GET_U(this->actor.params, 0, 16);
if (destinationIdx < 0) {
destinationIdx = this->actor.home.rot.z + 1;
}

View file

@ -44,7 +44,7 @@ void DoorGerudo_Init(Actor* thisx, PlayState* play) {
CollisionHeader_GetVirtual(&gGerudoCellDoorCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
if (Flags_GetSwitch(play, thisx->params & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) {
this->actionFunc = func_8099485C;
thisx->world.pos.y = thisx->home.pos.y + 200.0f;
} else {
@ -100,7 +100,7 @@ void func_8099485C(DoorGerudo* this, PlayState* play) {
if (this->isActive) {
this->actionFunc = func_8099496C;
gSaveContext.save.info.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1;
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6));
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
} else {
s32 direction = func_80994750(this, play);
@ -110,7 +110,7 @@ void func_8099485C(DoorGerudo* this, PlayState* play) {
if (gSaveContext.save.info.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) {
player->naviTextId = -0x203;
} else if (!Flags_GetCollectible(play, (this->dyna.actor.params >> 8) & 0x1F)) {
} else if (!Flags_GetCollectible(play, PARAMS_GET_U(this->dyna.actor.params, 8, 5))) {
player->naviTextId = -0x225;
} else {
player->doorType = PLAYER_DOORTYPE_SLIDING;

View file

@ -121,7 +121,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
this->openAnim = 0;
this->playerIsOpening = false;
switch ((u8)(this->actor.params & 0xFF)) {
switch ((u8)PARAMS_GET_U(this->actor.params, 0, 8)) {
case DOOR_KILLER_DOOR:
// `jointTable` is used for both the `jointTable` and `morphTable` args here. Because this actor doesn't
// play any animations it does not cause problems, but it would need to be changed otherwise.
@ -144,8 +144,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
this->colliderJntSph.elements[0].dim.worldSphere.center.z = (s16)this->actor.world.pos.z;
// If tied to a switch flag and that switch flag is already set, kill the actor.
if ((((this->actor.params >> 8) & 0x3F) != 0x3F) &&
Flags_GetSwitch(play, ((this->actor.params >> 8) & 0x3F))) {
if ((PARAMS_GET_U(this->actor.params, 8, 6) != 0x3F) &&
Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
Actor_Kill(&this->actor);
}
break;
@ -180,7 +180,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
void DoorKiller_Destroy(Actor* thisx, PlayState* play) {
DoorKiller* this = (DoorKiller*)thisx;
if ((thisx->params & 0xFF) == DOOR_KILLER_DOOR) {
if (PARAMS_GET_U(thisx->params, 0, 8) == DOOR_KILLER_DOOR) {
Collider_DestroyCylinder(play, &this->colliderCylinder);
Collider_DestroyJntSph(play, &this->colliderJntSph);
}
@ -241,7 +241,7 @@ void DoorKiller_SetAC(DoorKiller* this, PlayState* play) {
}
void DoorKiller_Die(DoorKiller* this, PlayState* play) {
s32 switchFlag = (this->actor.params >> 8) & 0x3F;
s32 switchFlag = PARAMS_GET_U(this->actor.params, 8, 6);
// Can set a switch flag on death based on params
if (switchFlag != 0x3F) {
@ -472,7 +472,7 @@ void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) {
void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
DoorKiller_UpdateTexture(&this->actor, play);
switch (this->actor.params & 0xFF) {
switch (PARAMS_GET_U(this->actor.params, 0, 8)) {
case DOOR_KILLER_DOOR:
this->actionFunc = DoorKiller_Wait;
this->actor.draw = DoorKiller_DrawDoor;
@ -515,7 +515,7 @@ void DoorKiller_DrawDoor(Actor* thisx, PlayState* play) {
void DoorKiller_DrawRubble(Actor* thisx, PlayState* play) {
static Gfx* dLists[] = { object_door_killer_DL_001250, object_door_killer_DL_001550, object_door_killer_DL_0017B8,
object_door_killer_DL_001A58 };
s32 rubblePieceIndex = (thisx->params & 0xFF) - 1;
s32 rubblePieceIndex = PARAMS_GET_U(thisx->params, 0, 8) - 1;
DoorKiller* this = (DoorKiller*)thisx;
if ((this->timer >= 20) || ((this->timer & 1) == 0)) {

View file

@ -20,8 +20,8 @@
*
*/
#define DOORSHUTTER_GET_TYPE(actor) (((actor)->params >> 6) & 0xF)
#define DOORSHUTTER_GET_SWITCH_FLAG(actor) ((actor)->params & 0x3F)
#define DOORSHUTTER_GET_TYPE(actor) PARAMS_GET_U((actor)->params, 6, 4)
#define DOORSHUTTER_GET_SWITCH_FLAG(actor) PARAMS_GET_U((actor)->params, 0, 6)
#define DOORSHUTTER_PARAMS(type, switchFlag) ((((type) & 0xF) << 6) | ((switchFlag) & 0x3F))

View file

@ -167,7 +167,7 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) {
gSaveContext.save.entranceIndex == ENTR_DESERT_COLOSSUS_8 ||
gSaveContext.save.entranceIndex == ENTR_GRAVEYARD_8) &&
!IS_CUTSCENE_LAYER) ||
(GET_PLAYER(play)->actor.params & 0xF00) != 0x200) {
PARAMS_GET_NOSHIFT(GET_PLAYER(play)->actor.params, 8, 4) != 0x200) {
Actor_Kill(&this->actor);
}
if (Actor_WorldDistXZToActor(&player->actor, &this->actor) > 100.0f) {

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);

View file

@ -53,21 +53,21 @@ s32 ElfMsg2_KillCheck(ElfMsg2* 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_msg2.c", 171); // "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("共倒れ2", "../z_elf_msg2.c", 182); // "Mutual destruction 2"
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))) {
LOG_STRING("共倒れ", "../z_elf_msg2.c", 192); // "Mutual destruction"
Actor_Kill(&this->actor);
return 1;
@ -99,7 +99,7 @@ void ElfMsg2_Destroy(Actor* thisx, PlayState* play) {
}
s32 ElfMsg2_GetMessageId(ElfMsg2* this) {
return (this->actor.params & 0xFF) + 0x100;
return PARAMS_GET_U(this->actor.params, 0, 8) + 0x100;
}
/**
@ -112,7 +112,7 @@ void ElfMsg2_WaitForTextClose(ElfMsg2* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
if (this->actor.world.rot.z != 1) {
Actor_Kill(&this->actor);
switchFlag = (this->actor.params >> 8) & 0x3F;
switchFlag = PARAMS_GET_U(this->actor.params, 8, 6);
if (switchFlag != 0x3F) {
Flags_SetSwitch(play, switchFlag);
}

View file

@ -104,7 +104,7 @@ void EnBa_Init(Actor* thisx, PlayState* play) {
}
this->actor.targetMode = 4;
this->upperParams = (thisx->params >> 8) & 0xFF;
this->upperParams = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
if (this->actor.params < EN_BA_DEAD_BLOB) {

View file

@ -319,15 +319,15 @@ void EnBb_Init(Actor* thisx, PlayState* play) {
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->elements);
this->actionState = thisx->params >> 8;
this->actionState = PARAMS_GET_NOMASK(thisx->params, 8);
if (thisx->params & 0x80) {
if (PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) {
thisx->params |= 0xFF00;
}
if (thisx->params <= ENBB_BLUE) {
ActorShape_Init(&thisx->shape, 200.0f, ActorShadow_DrawCircle, 35.0f);
}
if (thisx->params & 0xFF00) {
if (PARAMS_GET_NOSHIFT(thisx->params, 8, 8)) {
this->timer = 0;
this->flameScaleY = 80.0f;
this->flameScaleX = 100.0f;

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);
}

View file

@ -70,18 +70,17 @@ void EnBrob_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->colliders[1]);
Collider_SetCylinder(play, &this->colliders[1], &this->dyna.actor, &sCylinderInit);
CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit);
if (((thisx->params >> 8) & 0xFF) == 0) {
if (PARAMS_GET_U(thisx->params, 8, 8) == 0) {
Actor_SetScale(&this->dyna.actor, 0.01f);
thisx->params &= 0xFF;
if (thisx->params != 0xFF) {
thisx->scale.y *= (thisx->params & 0xFF) * (1.0f / 30.0f);
thisx->scale.y *= PARAMS_GET_U(thisx->params, 0, 8) * (1.0f / 30.0f);
}
} else {
Actor_SetScale(&this->dyna.actor, 0.005f);
thisx->params &= 0xFF;
if (thisx->params != 0xFF) {
thisx->scale.y *= (thisx->params & 0xFF) * (2.0f / 30.0f);
thisx->scale.y *= PARAMS_GET_U(thisx->params, 0, 8) * (2.0f / 30.0f);
}
}

View file

@ -154,7 +154,7 @@ void EnButte_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
if ((this->actor.params & 1) == 1) {
if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) {
this->actor.uncullZoneScale = 200.0f;
}
@ -268,7 +268,7 @@ void EnButte_FlyAround(EnButte* this, PlayState* play) {
EnButte_SelectFlightParams(this, &sFlyAroundParams[this->flightParamsIdx]);
}
if (((this->actor.params & 1) == 1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) &&
if ((PARAMS_GET_U(this->actor.params, 0, 1) == 1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) &&
(this->swordDownTimer <= 0) &&
((Math3D_Dist2DSq(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x,
this->actor.home.pos.z) < SQ(120.0f)) ||
@ -396,7 +396,7 @@ void EnButte_Update(Actor* thisx, PlayState* play) {
this->unk_25E += 0x1000;
this->unk_260 += 0x600;
if ((this->actor.params & 1) == 1) {
if (PARAMS_GET_U(this->actor.params, 0, 1) == 1) {
if (GET_PLAYER(play)->meleeWeaponState == 0) {
if (this->swordDownTimer > 0) {
this->swordDownTimer--;
@ -427,7 +427,7 @@ void EnButte_Draw(Actor* thisx, PlayState* play) {
Collider_UpdateSpheres(0, &this->collider);
}
if (((this->actor.params & 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) {
if ((PARAMS_GET_U(this->actor.params, 0, 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) {
EnButte_DrawTransformationEffect(this, play);
}
}

View file

@ -99,7 +99,7 @@ void EnBx_Init(Actor* thisx, PlayState* play) {
thisx->colChkInfo.mass = MASS_IMMOVABLE;
this->unk_14C = 0;
thisx->uncullZoneDownward = 2000.0f;
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0xFF)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 8, 8))) {
Actor_Kill(&this->actor);
}
thisx->params &= 0xFF;
@ -141,7 +141,7 @@ void EnBx_Update(Actor* thisx, PlayState* play) {
(&player->actor == this->collider.base.ac) || (&player->actor == this->colliderQuad.base.at)) {
tmp33 = player->invincibilityTimer & 0xFF;
tmp32 = thisx->world.rot.y;
if (!(thisx->params & 0x80)) {
if (!PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) {
tmp32 = thisx->yawTowardsPlayer;
}
if ((&player->actor != this->collider.base.at) && (&player->actor != this->collider.base.ac) &&
@ -190,7 +190,7 @@ void EnBx_Update(Actor* thisx, PlayState* play) {
Collider_UpdateCylinder(thisx, &this->collider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
if (thisx->params & 0x80) {
if (PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) {
CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base);
}
}
@ -212,14 +212,14 @@ void EnBx_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x0C, mtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F]));
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[PARAMS_GET_U(this->actor.params, 0, 7)]));
gSPSegment(POLY_OPA_DISP++, 0x09,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 16, 16, 1, 0,
(play->gameplayFrames * -10) % 128, 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_bx.c", 478),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->actor.params & 0x80) {
if (PARAMS_GET_NOSHIFT(this->actor.params, 7, 1)) {
func_809D1D0C(&this->actor, play);
}

View file

@ -144,7 +144,7 @@ void EnCs_Init(Actor* thisx, PlayState* play) {
sAnimationInfo[ENCS_ANIM_0].morphFrames);
this->actor.targetMode = 6;
this->path = this->actor.params & 0xFF;
this->path = PARAMS_GET_U(this->actor.params, 0, 8);
this->unk_1EC = 0; // This variable is unused anywhere else
this->talkState = 0;
this->currentAnimIndex = -1;

View file

@ -152,13 +152,13 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) {
s32 noKill = true;
s32 isFree = false;
if ((this->actor.params & 3) == 0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0))) {
if (PARAMS_GET_U(this->actor.params, 0, 2) == 0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0))) {
isFree = true;
} else if ((this->actor.params & 3) == 1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1))) {
} else if (PARAMS_GET_U(this->actor.params, 0, 2) == 1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1))) {
isFree = true;
} else if ((this->actor.params & 3) == 2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2))) {
} else if (PARAMS_GET_U(this->actor.params, 0, 2) == 2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2))) {
isFree = true;
} else if ((this->actor.params & 3) == 3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3))) {
} else if (PARAMS_GET_U(this->actor.params, 0, 2) == 3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3))) {
isFree = true;
}
@ -200,7 +200,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) {
this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2;
this->actionFunc = EnDaiku_Jailed;
} else {
if ((this->actor.params & 3) == 1 || (this->actor.params & 3) == 3) {
if (PARAMS_GET_U(this->actor.params, 0, 2) == 1 || PARAMS_GET_U(this->actor.params, 0, 2) == 3) {
EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex);
this->stateFlags |= ENDAIKU_STATEFLAG_1;
} else {
@ -295,7 +295,7 @@ void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) {
this->actor.textId = 0x6007;
}
} else if (play->sceneId == SCENE_CARPENTERS_TENT) {
switch (this->actor.params & 3) {
switch (PARAMS_GET_U(this->actor.params, 0, 2)) {
case 0:
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) {
this->actor.textId = 0x6060;
@ -378,7 +378,7 @@ void EnDaiku_Jailed(EnDaiku* this, PlayState* play) {
void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) {
this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
EnDaiku_UpdateText(this, play);
}
@ -400,14 +400,14 @@ void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) {
this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2);
gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] |=
EVENTCHKINF_CARPENTERS_FREE_MASK(this->actor.params & 3);
EVENTCHKINF_CARPENTERS_FREE_MASK(PARAMS_GET_U(this->actor.params, 0, 2));
this->actor.gravity = -1.0f;
this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive;
this->escapeSubCamTimer = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].maxFramesActive;
EnDaiku_InitSubCamera(this, play);
exitLoop = false;
path = &play->pathList[this->actor.params >> 4 & 0xF];
path = &play->pathList[PARAMS_GET_U(this->actor.params, 4, 4)];
while (!exitLoop) {
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
dx = pointPos->x - this->actor.world.pos.x;
@ -444,11 +444,11 @@ void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) {
Vec3f eyePosDeltaWorld;
this->subCamActive = true;
this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive;
this->escapeSubCamTimer = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].maxFramesActive;
eyePosDeltaLocal.x = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.x;
eyePosDeltaLocal.y = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.y;
eyePosDeltaLocal.z = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.z;
eyePosDeltaLocal.x = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.x;
eyePosDeltaLocal.y = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.y;
eyePosDeltaLocal.z = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.z;
Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_NEW);
Matrix_MultVec3f(&eyePosDeltaLocal, &eyePosDeltaWorld);
@ -524,7 +524,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play) {
f32 dxz;
Vec3s* pointPos;
path = &play->pathList[this->actor.params >> 4 & 0xF];
path = &play->pathList[PARAMS_GET_U(this->actor.params, 4, 4)];
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z;
@ -594,13 +594,13 @@ void EnDaiku_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
if ((thisx->params & 3) == 0) {
if (PARAMS_GET_U(thisx->params, 0, 2) == 0) {
gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255);
} else if ((thisx->params & 3) == 1) {
} else if (PARAMS_GET_U(thisx->params, 0, 2) == 1) {
gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255);
} else if ((thisx->params & 3) == 2) {
} else if (PARAMS_GET_U(thisx->params, 0, 2) == 2) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255);
} else if ((thisx->params & 3) == 3) {
} else if (PARAMS_GET_U(thisx->params, 0, 2) == 3) {
gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255);
}
@ -637,7 +637,7 @@ void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, vo
if (limb == 15) { // head
Matrix_MultVec3f(&targetPosHeadLocal, &this->actor.focus.pos);
gSPDisplayList(POLY_OPA_DISP++, hairDLists[this->actor.params & 3]);
gSPDisplayList(POLY_OPA_DISP++, hairDLists[PARAMS_GET_U(this->actor.params, 0, 2)]);
}
CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1330);

View file

@ -133,7 +133,7 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) {
case SCENE_KAKARIKO_VILLAGE:
if (IS_DAY) {
this->flags |= 1;
this->flags |= initFlags[this->actor.params & 3];
this->flags |= initFlags[PARAMS_GET_U(this->actor.params, 0, 2)];
}
break;
case SCENE_KAKARIKO_CENTER_GUEST_HOUSE:
@ -184,7 +184,8 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) {
this->actionFunc = EnDaikuKakariko_Run;
} else {
if (this->flags & 8) {
if (((this->actor.params & 3) == CARPENTER_SABOORO) || ((this->actor.params & 3) == CARPENTER_SHIRO)) {
if ((PARAMS_GET_U(this->actor.params, 0, 2) == CARPENTER_SABOORO) ||
(PARAMS_GET_U(this->actor.params, 0, 2) == CARPENTER_SHIRO)) {
EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_5, &this->currentAnimIndex);
this->flags |= 0x800;
} else {
@ -244,10 +245,11 @@ void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, PlayState* play) {
if ((sp26 >= 0) && (sp26 <= 320) && (sp24 >= 0) && (sp24 <= 240) && (this->talkState == 0) &&
(Actor_OfferTalk(&this->actor, play, 100.0f) == 1)) {
this->actor.textId = MaskReaction_GetTextId(play, sMaskReactionSets[this->actor.params & 3]);
this->actor.textId =
MaskReaction_GetTextId(play, sMaskReactionSets[PARAMS_GET_U(this->actor.params, 0, 2)]);
if (this->actor.textId == 0) {
switch (this->actor.params & 3) {
switch (PARAMS_GET_U(this->actor.params, 0, 2)) {
case 0:
if (this->flags & 8) {
this->actor.textId = 0x5076;
@ -364,7 +366,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) {
s32 run;
do {
path = &play->pathList[(this->actor.params >> 8) & 0xFF];
path = &play->pathList[PARAMS_GET_U(this->actor.params, 8, 8)];
pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint];
xDist = pathPos->x - this->actor.world.pos.x;
zDist = pathPos->z - this->actor.world.pos.z;
@ -536,7 +538,7 @@ void EnDaikuKakariko_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V
if (limbIndex == 15) {
Matrix_MultVec3f(&unkVec, &this->actor.focus.pos);
gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[this->actor.params & 3]);
gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[PARAMS_GET_U(this->actor.params, 0, 2)]);
}
CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1113);
@ -549,13 +551,13 @@ void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
if ((thisx->params & 3) == CARPENTER_ICHIRO) {
if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_ICHIRO) {
gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255);
} else if ((thisx->params & 3) == CARPENTER_SABOORO) {
} else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_SABOORO) {
gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255);
} else if ((thisx->params & 3) == CARPENTER_JIRO) {
} else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_JIRO) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255);
} else if ((thisx->params & 3) == CARPENTER_SHIRO) {
} else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_SHIRO) {
gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255);
}

View file

@ -119,7 +119,7 @@ void EnDekunuts_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit);
this->shotsPerRound = ((thisx->params >> 8) & 0xFF);
this->shotsPerRound = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;
if ((this->shotsPerRound == 0xFF) || (this->shotsPerRound == 0)) {
this->shotsPerRound = 1;

View file

@ -190,7 +190,7 @@ s8 EnDog_CanFollow(EnDog* this, PlayState* play) {
if (gSaveContext.dogParams != 0) {
return 0;
}
gSaveContext.dogParams = (this->actor.params & 0x7FFF);
gSaveContext.dogParams = PARAMS_GET_S(this->actor.params, 0, 15);
return 1;
}
@ -248,12 +248,12 @@ void EnDog_Init(Actor* thisx, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_0);
if ((this->actor.params & 0x8000) == 0) {
this->actor.params = (this->actor.params & 0xF0FF) | ((((this->actor.params & 0x0F00) >> 8) + 1) << 8);
if (!PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) {
this->actor.params = (this->actor.params & ~(0xF << 8)) | ((PARAMS_GET_S(this->actor.params, 8, 4) + 1) << 8);
}
followingDog = ((gSaveContext.dogParams & 0x0F00) >> 8);
if (followingDog == ((this->actor.params & 0x0F00) >> 8) && ((this->actor.params & 0x8000) == 0)) {
if (followingDog == PARAMS_GET_S(this->actor.params, 8, 4) && !PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) {
Actor_Kill(&this->actor);
return;
}
@ -264,16 +264,16 @@ void EnDog_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.0075f);
this->waypoint = 0;
this->actor.gravity = -1.0f;
this->path = Path_GetByIndex(play, (this->actor.params & 0x00F0) >> 4, 0xF);
this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 4, 4), 0xF);
switch (play->sceneId) {
case SCENE_MARKET_NIGHT:
if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1)) {
if ((!gSaveContext.dogIsLost) && PARAMS_GET_S(this->actor.params, 8, 4) == 1) {
Actor_Kill(&this->actor);
}
break;
case SCENE_DOG_LADY_HOUSE: // Richard's Home
if (!(this->actor.params & 0x8000)) {
if (!PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) {
if (!gSaveContext.dogIsLost) {
this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_Wait;
@ -287,7 +287,7 @@ void EnDog_Init(Actor* thisx, PlayState* play) {
break;
}
if (this->actor.params & 0x8000) {
if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) {
this->nextBehavior = DOG_WALK;
this->actionFunc = EnDog_FollowPlayer;
} else {
@ -477,8 +477,9 @@ void EnDog_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g,
colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a);
gDPSetEnvColor(POLY_OPA_DISP++, colors[PARAMS_GET_S(this->actor.params, 0, 4)].r,
colors[PARAMS_GET_S(this->actor.params, 0, 4)].g, colors[PARAMS_GET_S(this->actor.params, 0, 4)].b,
colors[PARAMS_GET_S(this->actor.params, 0, 4)].a);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnDog_OverrideLimbDraw, EnDog_PostLimbDraw, this);

View file

@ -144,7 +144,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) {
}
// Double doors
if (ENDOOR_IS_DOUBLE_DOOR(&this->actor)) {
if (ENDOOR_GET_IS_DOUBLE_DOOR(&this->actor)) {
EnDoor* other;
xOffset = Math_CosS(this->actor.shape.rot.y) * 30.0f;
@ -152,7 +152,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) {
other = (EnDoor*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DOOR,
this->actor.world.pos.x + xOffset, this->actor.world.pos.y,
this->actor.world.pos.z - zOffset, 0, this->actor.shape.rot.y + 0x8000, 0,
this->actor.params & ~ENDOOR_PARAMS_DOUBLE_DOOR_FLAG);
this->actor.params & ~ENDOOR_PARAMS_IS_DOUBLE_DOOR_MASK);
if (other != NULL) {
other->unk_192 = 1;
}

Some files were not shown because too many files have changed in this diff Show more