mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-20 22:11:16 +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
|
@ -89,7 +89,7 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) {
|
|||
u16 EnGo_GetTextID(PlayState* play, Actor* thisx) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
switch (thisx->params & 0xF0) {
|
||||
switch (PARAMS_GET_NOSHIFT(thisx->params, 4, 4)) {
|
||||
case 0x90:
|
||||
if (gSaveContext.save.info.playerData.bgsFlag) {
|
||||
return 0x305E;
|
||||
|
@ -133,7 +133,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) {
|
|||
}
|
||||
}
|
||||
case 0x10:
|
||||
if (Flags_GetSwitch(play, thisx->params >> 8)) {
|
||||
if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(thisx->params, 8))) {
|
||||
return 0x3052;
|
||||
} else {
|
||||
return 0x3051;
|
||||
|
@ -349,26 +349,30 @@ s32 EnGo_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 intera
|
|||
|
||||
void EnGo_ChangeAnim(EnGo* this, s32 index) {
|
||||
Animation_Change(&this->skelAnime, sAnimationInfo[index].animation,
|
||||
sAnimationInfo[index].playSpeed * ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f), 0.0f,
|
||||
Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode,
|
||||
sAnimationInfo[index].playSpeed *
|
||||
(PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f),
|
||||
0.0f, Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode,
|
||||
sAnimationInfo[index].morphFrames);
|
||||
}
|
||||
|
||||
s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) {
|
||||
if (((this->actor.params) & 0xF0) == 0x90) {
|
||||
return true;
|
||||
} else if (play->sceneId == SCENE_FIRE_TEMPLE && !Flags_GetSwitch(play, (this->actor.params) >> 8) &&
|
||||
LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x10) {
|
||||
} else if (play->sceneId == SCENE_FIRE_TEMPLE && !Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) &&
|
||||
LINK_IS_ADULT && PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x10) {
|
||||
return true;
|
||||
} else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) {
|
||||
} else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT &&
|
||||
PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x00) {
|
||||
return true;
|
||||
} else if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && LINK_IS_CHILD &&
|
||||
((this->actor.params & 0xF0) == 0x20 || (this->actor.params & 0xF0) == 0x30 ||
|
||||
(this->actor.params & 0xF0) == 0x40)) {
|
||||
(PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x20 ||
|
||||
PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x30 ||
|
||||
PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x40)) {
|
||||
return true;
|
||||
} else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_CHILD &&
|
||||
((this->actor.params & 0xF0) == 0x50 || (this->actor.params & 0xF0) == 0x60 ||
|
||||
(this->actor.params & 0xF0) == 0x70)) {
|
||||
(PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x50 ||
|
||||
PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x60 ||
|
||||
PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x70)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -376,7 +380,7 @@ s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) {
|
|||
}
|
||||
|
||||
f32 EnGo_GetPlayerTrackingYOffset(EnGo* this) {
|
||||
switch (this->actor.params & 0xF0) {
|
||||
switch (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4)) {
|
||||
case 0x00:
|
||||
return 10.0f;
|
||||
case 0x20:
|
||||
|
@ -426,7 +430,7 @@ s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) {
|
|||
}
|
||||
|
||||
xyzDistSq = (this->actor.scale.x / 0.01f) * SQ(100.0f);
|
||||
if ((this->actor.params & 0xF0) == 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) {
|
||||
Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW);
|
||||
xyzDistSq *= 4.8f;
|
||||
}
|
||||
|
@ -467,11 +471,11 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) {
|
|||
f32 xDist;
|
||||
f32 zDist;
|
||||
|
||||
if ((this->actor.params & 0xF) == 15) {
|
||||
if (PARAMS_GET_U(this->actor.params, 0, 4) == 15) {
|
||||
return false;
|
||||
}
|
||||
|
||||
path = &play->pathList[this->actor.params & 0xF];
|
||||
path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)];
|
||||
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
|
||||
pointPos += this->unk_218;
|
||||
xDist = pointPos->x - this->actor.world.pos.x;
|
||||
|
@ -484,9 +488,9 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) {
|
|||
this->unk_218 = 0;
|
||||
}
|
||||
|
||||
if ((this->actor.params & 0xF0) != 0x00) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x00) {
|
||||
return true;
|
||||
} else if (Flags_GetSwitch(play, this->actor.params >> 8)) {
|
||||
} else if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8))) {
|
||||
return true;
|
||||
} else if (this->unk_218 >= this->actor.shape.rot.z) {
|
||||
this->unk_218 = 0;
|
||||
|
@ -502,10 +506,10 @@ s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) {
|
|||
Path* path;
|
||||
Vec3s* pointPos;
|
||||
|
||||
if ((this->actor.params & 0xF) == 0xF) {
|
||||
if (PARAMS_GET_U(this->actor.params, 0, 4) == 0xF) {
|
||||
return false;
|
||||
} else {
|
||||
path = &play->pathList[this->actor.params & 0xF];
|
||||
path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)];
|
||||
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
|
||||
pointPos += (path->count - 1);
|
||||
this->actor.world.pos.x = pointPos->x;
|
||||
|
@ -579,11 +583,11 @@ void func_80A3F908(EnGo* this, PlayState* play) {
|
|||
|
||||
interactRange = (this->collider.dim.radius + 30.0f);
|
||||
interactRange *= (this->actor.scale.x / 0.01f);
|
||||
if ((this->actor.params & 0xF0) == 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) {
|
||||
interactRange *= 4.8f;
|
||||
}
|
||||
|
||||
if ((this->actor.params & 0xF0) == 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) {
|
||||
dialogStarted = EnGo_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange,
|
||||
EnGo_GetTextID, EnGo_UpdateTalkState);
|
||||
} else {
|
||||
|
@ -591,7 +595,7 @@ void func_80A3F908(EnGo* this, PlayState* play) {
|
|||
EnGo_GetTextID, EnGo_UpdateTalkState);
|
||||
}
|
||||
|
||||
if (((this->actor.params & 0xF0) == 0x90) && (dialogStarted == true)) {
|
||||
if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) && (dialogStarted == true)) {
|
||||
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) {
|
||||
if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) {
|
||||
if (GET_INFTABLE(INFTABLE_B4)) {
|
||||
|
@ -634,7 +638,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ((this->actor.params & 0xF0) && ((this->actor.params & 0xF0) != 0x90)) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) && (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90)) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_4;
|
||||
this->actor.flags &= ~ACTOR_FLAG_5;
|
||||
}
|
||||
|
@ -644,7 +648,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) {
|
|||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
this->actor.gravity = -1.0f;
|
||||
|
||||
switch (this->actor.params & 0xF0) {
|
||||
switch (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4)) {
|
||||
case 0x00:
|
||||
Actor_SetScale(&this->actor, 0.008f);
|
||||
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
|
||||
|
@ -746,7 +750,7 @@ void func_80A4008C(EnGo* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) {
|
||||
if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, this->actor.params >> 8) &&
|
||||
if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) &&
|
||||
(this->unk_218 == 0)) {
|
||||
this->actor.speed = 0.0f;
|
||||
EnGo_SetupAction(this, func_80A4008C);
|
||||
|
@ -769,10 +773,10 @@ void EnGo_CurledUp(EnGo* this, PlayState* play) {
|
|||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
|
||||
this->skelAnime.playSpeed = 0.1f;
|
||||
this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f;
|
||||
this->skelAnime.playSpeed *= PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f;
|
||||
|
||||
EnGo_SetupAction(this, EnGo_WakeUp);
|
||||
if ((this->actor.params & 0xF0) == 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) {
|
||||
OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN);
|
||||
}
|
||||
}
|
||||
|
@ -782,8 +786,9 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) {
|
|||
f32 frame;
|
||||
|
||||
if (this->skelAnime.playSpeed != 0.0f) {
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * 0.5f, 0.1f,
|
||||
1000.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed,
|
||||
(PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * 0.5f, 0.1f, 1000.0f,
|
||||
0.1f);
|
||||
frame = this->skelAnime.curFrame;
|
||||
frame += this->skelAnime.playSpeed;
|
||||
|
||||
|
@ -792,7 +797,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) {
|
|||
} else {
|
||||
this->skelAnime.curFrame = 12.0f;
|
||||
this->skelAnime.playSpeed = 0.0f;
|
||||
if ((this->actor.params & 0xF0) != 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) {
|
||||
this->unk_212 = 30;
|
||||
return;
|
||||
}
|
||||
|
@ -813,8 +818,9 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) {
|
|||
void func_80A40494(EnGo* this, PlayState* play) {
|
||||
f32 frame;
|
||||
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f,
|
||||
1000.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed,
|
||||
(PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f, 1000.0f,
|
||||
0.1f);
|
||||
frame = this->skelAnime.curFrame;
|
||||
frame += this->skelAnime.playSpeed;
|
||||
|
||||
|
@ -835,8 +841,8 @@ void func_80A405CC(EnGo* this, PlayState* play) {
|
|||
f32 frame;
|
||||
|
||||
lastFrame = Animation_GetLastFrame(&gGoronAnim_004930);
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed, (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f, 0.1f, 1000.0f,
|
||||
0.1f);
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed, PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f,
|
||||
0.1f, 1000.0f, 0.1f);
|
||||
|
||||
frame = this->skelAnime.curFrame;
|
||||
frame += this->skelAnime.playSpeed;
|
||||
|
@ -845,7 +851,7 @@ void func_80A405CC(EnGo* this, PlayState* play) {
|
|||
this->skelAnime.curFrame = lastFrame;
|
||||
this->skelAnime.playSpeed = 0.0f;
|
||||
this->unk_212 = Rand_S16Offset(30, 30);
|
||||
if (((this->actor.params & 0xF0) == 0x40) && !GET_INFTABLE(INFTABLE_EB)) {
|
||||
if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x40) && !GET_INFTABLE(INFTABLE_EB)) {
|
||||
EnGo_SetupAction(this, func_80A40B1C);
|
||||
} else {
|
||||
EnGo_SetupAction(this, EnGo_BiggoronActionFunc);
|
||||
|
@ -854,7 +860,8 @@ void func_80A405CC(EnGo* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) {
|
||||
if (((this->actor.params & 0xF0) == 0x90) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) {
|
||||
if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) &&
|
||||
(this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) {
|
||||
if (gSaveContext.save.info.playerData.bgsFlag) {
|
||||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
} else {
|
||||
|
@ -873,7 +880,8 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) {
|
|||
EnGo_GetItem(this, play);
|
||||
}
|
||||
}
|
||||
} else if (((this->actor.params & 0xF0) == 0) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) {
|
||||
} else if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) &&
|
||||
(this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) {
|
||||
EnGo_SetupAction(this, EnGo_GetItem);
|
||||
play->msgCtx.stateTimer = 4;
|
||||
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
|
||||
|
@ -881,7 +889,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) {
|
|||
if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) {
|
||||
EnGo_ReverseAnimation(this);
|
||||
this->skelAnime.playSpeed = -0.1f;
|
||||
this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f;
|
||||
this->skelAnime.playSpeed *= PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f;
|
||||
EnGo_SetupAction(this, func_80A408D8);
|
||||
}
|
||||
}
|
||||
|
@ -891,8 +899,9 @@ void func_80A408D8(EnGo* this, PlayState* play) {
|
|||
f32 frame;
|
||||
|
||||
if (this->skelAnime.playSpeed != 0.0f) {
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -1.0f,
|
||||
0.1f, 1000.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->skelAnime.playSpeed,
|
||||
(PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * -1.0f, 0.1f, 1000.0f,
|
||||
0.1f);
|
||||
frame = this->skelAnime.curFrame;
|
||||
frame += this->skelAnime.playSpeed;
|
||||
if (frame >= 12.0f) {
|
||||
|
@ -900,7 +909,7 @@ void func_80A408D8(EnGo* this, PlayState* play) {
|
|||
} else {
|
||||
this->skelAnime.curFrame = 12.0f;
|
||||
this->skelAnime.playSpeed = 0.0f;
|
||||
if ((this->actor.params & 0xF0) != 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) {
|
||||
this->unk_212 = 30;
|
||||
return;
|
||||
}
|
||||
|
@ -951,7 +960,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) {
|
|||
EnGo_SetupAction(this, func_80A40C78);
|
||||
} else {
|
||||
this->unk_20C = 0;
|
||||
if ((this->actor.params & 0xF0) == 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) {
|
||||
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) {
|
||||
getItemId = GI_SWORD_BIGGORON;
|
||||
this->unk_20C = 1;
|
||||
|
@ -964,7 +973,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((this->actor.params & 0xF0) == 0) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) {
|
||||
getItemId = GI_TUNIC_GORON;
|
||||
}
|
||||
|
||||
|
@ -977,7 +986,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) {
|
|||
void func_80A40C78(EnGo* this, PlayState* play) {
|
||||
if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) {
|
||||
EnGo_SetupAction(this, EnGo_BiggoronActionFunc);
|
||||
if ((this->actor.params & 0xF0) != 0x90) {
|
||||
if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) {
|
||||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
} else if (this->unk_20C) {
|
||||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue