mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-24 16:01:26 +00:00
Generic actor params getters (#1359)
* Initial PARAMS_GET macros * NOSHIFT macro * Use number of bits rather than raw mask values * Add descriptions for each generic macro * Reformat * Adjust comment * format * edit en_door macro names * edit redead macro name * edit bdan switch macro name, and remove unneeded comments in go2 * mizushutter macro names * remove PARAMS_GET_S, rework ishi switch flag handling * actually remove PARAMS_GET_S * remove PARAMS_GET2_S * PARAMS_GET_U and PARAMS_GET_S * format * fix merge * format --------- Co-authored-by: fig02 <fig02srl@gmail.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
137e0d2a10
commit
eaf955ad22
200 changed files with 1113 additions and 1045 deletions
|
@ -352,9 +352,9 @@ static EnHyInit2Info sInit2Info[] = {
|
|||
};
|
||||
|
||||
s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) {
|
||||
u8 headInfoIndex = sModelInfo[this->actor.params & 0x7F].headInfoIndex;
|
||||
u8 skelInfoIndex2 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex2;
|
||||
u8 skelInfoIndex1 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex1;
|
||||
u8 headInfoIndex = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].headInfoIndex;
|
||||
u8 skelInfoIndex2 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].skelInfoIndex2;
|
||||
u8 skelInfoIndex1 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].skelInfoIndex1;
|
||||
|
||||
this->objectSlotSkel1 = Object_GetSlot(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId);
|
||||
if (this->objectSlotSkel1 < 0) {
|
||||
|
@ -417,16 +417,16 @@ void func_80A6F7CC(EnHy* this, PlayState* play, s32 getItemId) {
|
|||
u16 EnHy_GetTextId(PlayState* play, Actor* thisx) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
EnHy* this = (EnHy*)thisx;
|
||||
u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_37 + (this->actor.params & 0x7F));
|
||||
u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_37 + PARAMS_GET_S(this->actor.params, 0, 7));
|
||||
|
||||
if (textId != 0) {
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_5) {
|
||||
player->exchangeItemId = EXCH_ITEM_BOTTLE_BLUE_FIRE;
|
||||
}
|
||||
return textId;
|
||||
}
|
||||
|
||||
switch (this->actor.params & 0x7F) {
|
||||
switch (PARAMS_GET_S(this->actor.params, 0, 7)) {
|
||||
case ENHY_TYPE_AOB:
|
||||
if (play->sceneId == SCENE_KAKARIKO_CENTER_GUEST_HOUSE) {
|
||||
return (this->unk_330 & EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK)
|
||||
|
@ -678,7 +678,7 @@ s16 EnHy_UpdateTalkState(PlayState* play, Actor* thisx) {
|
|||
|
||||
void EnHy_UpdateEyes(EnHy* this) {
|
||||
if (DECR(this->nextEyeIndexTimer) == 0) {
|
||||
u8 headInfoIndex = sModelInfo[this->actor.params & 0x7F].headInfoIndex;
|
||||
u8 headInfoIndex = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].headInfoIndex;
|
||||
|
||||
this->curEyeIndex++;
|
||||
if ((sHeadInfo[headInfoIndex].eyeTextures != NULL) &&
|
||||
|
@ -690,14 +690,14 @@ void EnHy_UpdateEyes(EnHy* this) {
|
|||
}
|
||||
|
||||
void EnHy_InitCollider(EnHy* this) {
|
||||
u8 type = this->actor.params & 0x7F;
|
||||
u8 type = PARAMS_GET_S(this->actor.params, 0, 7);
|
||||
|
||||
this->collider.dim.radius = sColliderInfo[type].radius;
|
||||
this->collider.dim.height = sColliderInfo[type].height;
|
||||
}
|
||||
|
||||
void EnHy_InitSetProperties(EnHy* this) {
|
||||
u8 type = this->actor.params & 0x7F;
|
||||
u8 type = PARAMS_GET_S(this->actor.params, 0, 7);
|
||||
|
||||
this->actor.shape.shadowScale = sInit2Info[type].shadowScale;
|
||||
Actor_SetScale(&this->actor, sInit2Info[type].scale);
|
||||
|
@ -713,9 +713,9 @@ void EnHy_UpdateCollider(EnHy* this, PlayState* play) {
|
|||
pos.x = this->actor.world.pos.x;
|
||||
pos.y = this->actor.world.pos.y;
|
||||
pos.z = this->actor.world.pos.z;
|
||||
pos.x += sColliderInfo[this->actor.params & 0x7F].offset.x;
|
||||
pos.y += sColliderInfo[this->actor.params & 0x7F].offset.y;
|
||||
pos.z += sColliderInfo[this->actor.params & 0x7F].offset.z;
|
||||
pos.x += sColliderInfo[PARAMS_GET_S(this->actor.params, 0, 7)].offset.x;
|
||||
pos.y += sColliderInfo[PARAMS_GET_S(this->actor.params, 0, 7)].offset.y;
|
||||
pos.z += sColliderInfo[PARAMS_GET_S(this->actor.params, 0, 7)].offset.z;
|
||||
this->collider.dim.pos = pos;
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ void EnHy_UpdateCollider(EnHy* this, PlayState* play) {
|
|||
void func_80A70834(EnHy* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_5) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_5) {
|
||||
if (!Inventory_HasSpecificBottle(ITEM_BOTTLE_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_BUG) &&
|
||||
!Inventory_HasSpecificBottle(ITEM_BOTTLE_FISH)) {
|
||||
switch (func_8002F368(play)) {
|
||||
|
@ -765,7 +765,7 @@ void func_80A70978(EnHy* this, PlayState* play) {
|
|||
Player* player = GET_PLAYER(play);
|
||||
s16 trackingMode;
|
||||
|
||||
switch (this->actor.params & 0x7F) {
|
||||
switch (PARAMS_GET_S(this->actor.params, 0, 7)) {
|
||||
case ENHY_TYPE_BOJ_3:
|
||||
case ENHY_TYPE_BJI_7:
|
||||
case ENHY_TYPE_BOJ_9:
|
||||
|
@ -793,13 +793,13 @@ void func_80A70978(EnHy* this, PlayState* play) {
|
|||
this->interactInfo.trackPos = player->actor.world.pos;
|
||||
|
||||
if (LINK_IS_ADULT) {
|
||||
this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].adultYOffset;
|
||||
this->interactInfo.yOffset = sPlayerTrackingInfo[PARAMS_GET_S(this->actor.params, 0, 7)].adultYOffset;
|
||||
} else {
|
||||
this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].childYOffset;
|
||||
this->interactInfo.yOffset = sPlayerTrackingInfo[PARAMS_GET_S(this->actor.params, 0, 7)].childYOffset;
|
||||
}
|
||||
|
||||
Npc_TrackPoint(&this->actor, &this->interactInfo, sPlayerTrackingInfo[this->actor.params & 0x7F].presetIndex,
|
||||
trackingMode);
|
||||
Npc_TrackPoint(&this->actor, &this->interactInfo,
|
||||
sPlayerTrackingInfo[PARAMS_GET_S(this->actor.params, 0, 7)].presetIndex, trackingMode);
|
||||
|
||||
if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnHy_GetTextId,
|
||||
EnHy_UpdateTalkState)) {
|
||||
|
@ -810,29 +810,31 @@ void func_80A70978(EnHy* this, PlayState* play) {
|
|||
s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) {
|
||||
switch (play->sceneId) {
|
||||
case SCENE_KAKARIKO_VILLAGE:
|
||||
if (!((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_9 || (this->actor.params & 0x7F) == ENHY_TYPE_BOJ_10 ||
|
||||
(this->actor.params & 0x7F) == ENHY_TYPE_BOJ_12 || (this->actor.params & 0x7F) == ENHY_TYPE_AHG_2 ||
|
||||
(this->actor.params & 0x7F) == ENHY_TYPE_BJI_7)) {
|
||||
if (!(PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_9 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_10 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_12 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_AHG_2 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BJI_7)) {
|
||||
return true;
|
||||
} else if (!LINK_IS_ADULT) {
|
||||
return true;
|
||||
} else if ((this->actor.params & 0x7F) != ENHY_TYPE_BOJ_12 && IS_NIGHT) {
|
||||
} else if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_BOJ_12 && IS_NIGHT) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
case SCENE_IMPAS_HOUSE:
|
||||
if ((this->actor.params & 0x7F) != ENHY_TYPE_BOJ_10) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_BOJ_10) {
|
||||
return true;
|
||||
} else if (LINK_IS_CHILD) {
|
||||
return false;
|
||||
} else if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_10 && IS_DAY) {
|
||||
} else if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_10 && IS_DAY) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
case SCENE_DOG_LADY_HOUSE:
|
||||
if ((this->actor.params & 0x7F) != ENHY_TYPE_AOB) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_AOB) {
|
||||
return true;
|
||||
} else if (IS_DAY) {
|
||||
return false;
|
||||
|
@ -840,11 +842,11 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) {
|
|||
return true;
|
||||
}
|
||||
case SCENE_KAKARIKO_CENTER_GUEST_HOUSE:
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_AOB) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_AOB) {
|
||||
return !LINK_IS_ADULT ? false : true;
|
||||
} else if (!((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_9 ||
|
||||
(this->actor.params & 0x7F) == ENHY_TYPE_AHG_2 ||
|
||||
(this->actor.params & 0x7F) == ENHY_TYPE_BJI_7)) {
|
||||
} else if (!(PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_9 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_AHG_2 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BJI_7)) {
|
||||
return true;
|
||||
} else if (IS_DAY) {
|
||||
return false;
|
||||
|
@ -855,7 +857,7 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) {
|
|||
}
|
||||
case SCENE_BACK_ALLEY_DAY:
|
||||
case SCENE_BACK_ALLEY_NIGHT:
|
||||
if ((this->actor.params & 0x7F) != ENHY_TYPE_BOJ_14) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) != ENHY_TYPE_BOJ_14) {
|
||||
return true;
|
||||
} else if (IS_NIGHT) {
|
||||
return false;
|
||||
|
@ -865,7 +867,7 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) {
|
|||
return true;
|
||||
}
|
||||
default:
|
||||
switch (this->actor.params & 0x7F) {
|
||||
switch (PARAMS_GET_S(this->actor.params, 0, 7)) {
|
||||
case ENHY_TYPE_BJI_19:
|
||||
case ENHY_TYPE_AHG_20:
|
||||
if (LINK_IS_ADULT) {
|
||||
|
@ -879,7 +881,7 @@ s32 EnHy_ShouldSpawn(EnHy* this, PlayState* play) {
|
|||
void EnHy_Init(Actor* thisx, PlayState* play) {
|
||||
EnHy* this = (EnHy*)thisx;
|
||||
|
||||
if ((this->actor.params & 0x7F) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, play) ||
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) >= ENHY_TYPE_MAX || !EnHy_FindOsAnimeObject(this, play) ||
|
||||
!EnHy_FindSkelAndHeadObjects(this, play)) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
|
@ -902,15 +904,16 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) {
|
|||
this->actor.objectSlot = this->objectSlotSkel1;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment);
|
||||
SkelAnime_InitFlex(play, &this->skelAnime,
|
||||
sSkeletonInfo[sModelInfo[this->actor.params & 0x7F].skelInfoIndex1].skeleton, NULL,
|
||||
this->jointTable, this->morphTable, 16);
|
||||
sSkeletonInfo[sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].skelInfoIndex1].skeleton,
|
||||
NULL, this->jointTable, this->morphTable, 16);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment);
|
||||
Collider_InitCylinder(play, &this->collider);
|
||||
Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit);
|
||||
EnHy_InitCollider(this);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
|
||||
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, sModelInfo[this->actor.params & 0x7F].animInfoIndex);
|
||||
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo,
|
||||
sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].animInfoIndex);
|
||||
|
||||
if ((play->sceneId == SCENE_BACK_ALLEY_DAY) || (play->sceneId == SCENE_MARKET_DAY)) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_4;
|
||||
|
@ -922,9 +925,9 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) {
|
|||
}
|
||||
|
||||
EnHy_InitSetProperties(this);
|
||||
this->path = Path_GetByIndex(play, (this->actor.params & 0x780) >> 7, 15);
|
||||
this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 7, 4), 15);
|
||||
|
||||
switch (this->actor.params & 0x7F) {
|
||||
switch (PARAMS_GET_S(this->actor.params, 0, 7)) {
|
||||
case ENHY_TYPE_BOJ_3:
|
||||
if (this->path != NULL) {
|
||||
this->actor.speed = 3.0f;
|
||||
|
@ -1111,7 +1114,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
|
|||
if (limbIndex == 15) {
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotHead].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment);
|
||||
i = sModelInfo[this->actor.params & 0x7F].headInfoIndex;
|
||||
i = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].headInfoIndex;
|
||||
*dList = sHeadInfo[i].headDList;
|
||||
|
||||
if (sHeadInfo[i].eyeTextures != NULL) {
|
||||
|
@ -1158,7 +1161,7 @@ void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
|
|||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotSkel2].segment);
|
||||
}
|
||||
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_3 && limbIndex == 8) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_BOJ_3 && limbIndex == 8) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_005BC8);
|
||||
}
|
||||
|
||||
|
@ -1190,10 +1193,10 @@ void EnHy_Draw(Actor* thisx, PlayState* play) {
|
|||
if (this->actionFunc != EnHy_InitImpl) {
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
Matrix_Translate(this->modelOffset.x, this->modelOffset.y, this->modelOffset.z, MTXMODE_APPLY);
|
||||
envColorSeg8 = sModelInfo[this->actor.params & 0x7F].envColorSeg8;
|
||||
envColorSeg9 = sModelInfo[this->actor.params & 0x7F].envColorSeg9;
|
||||
envColorSeg8 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].envColorSeg8;
|
||||
envColorSeg9 = sModelInfo[PARAMS_GET_S(this->actor.params, 0, 7)].envColorSeg9;
|
||||
|
||||
switch (this->actor.params & 0x7F) {
|
||||
switch (PARAMS_GET_S(this->actor.params, 0, 7)) {
|
||||
// ENHY_TYPE_AOB
|
||||
// ENHY_TYPE_COB
|
||||
case ENHY_TYPE_AHG_2:
|
||||
|
@ -1222,11 +1225,12 @@ void EnHy_Draw(Actor* thisx, PlayState* play) {
|
|||
EnHy_SetEnvColor(play->state.gfxCtx, envColorSeg9.r, envColorSeg9.g, envColorSeg9.b,
|
||||
envColorSeg9.a));
|
||||
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_8 || (this->actor.params & 0x7F) == ENHY_TYPE_CNE_11) {
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_8) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_8 ||
|
||||
PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_11) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_8) {
|
||||
envColorSeg10 = envColorSeg8;
|
||||
}
|
||||
if ((this->actor.params & 0x7F) == ENHY_TYPE_CNE_11) {
|
||||
if (PARAMS_GET_S(this->actor.params, 0, 7) == ENHY_TYPE_CNE_11) {
|
||||
envColorSeg10.r = envColorSeg10.g = envColorSeg10.b = 255;
|
||||
envColorSeg10.a = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue