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

@ -100,9 +100,9 @@ void ObjLift_SpawnFragments(ObjLift* this, PlayState* play) {
OBJECT_D_LIFT, gCollapsingPlatformDL);
}
if (((this->dyna.actor.params >> 1) & 1) == 0) {
if (PARAMS_GET_U(this->dyna.actor.params, 1, 1) == 0) {
func_80033480(play, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1);
} else if (((this->dyna.actor.params >> 1) & 1) == 1) {
} else if (PARAMS_GET_U(this->dyna.actor.params, 1, 1) == 1) {
func_80033480(play, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1);
}
}
@ -112,12 +112,12 @@ void ObjLift_Init(Actor* thisx, PlayState* play) {
ObjLift_InitDynaPoly(this, play, &gCollapsingPlatformCol, DYNA_TRANSFORM_POS);
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F)) {
if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 2, 6))) {
Actor_Kill(&this->dyna.actor);
return;
}
Actor_SetScale(&this->dyna.actor, sScales[(this->dyna.actor.params >> 1) & 1]);
Actor_SetScale(&this->dyna.actor, sScales[PARAMS_GET_U(this->dyna.actor.params, 1, 1)]);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->shakeOrientation.x = Rand_ZeroOne() * 65535.5f;
this->shakeOrientation.y = Rand_ZeroOne() * 65535.5f;
@ -133,7 +133,7 @@ void ObjLift_Destroy(Actor* thisx, PlayState* play) {
}
void ObjLift_SetupWait(ObjLift* this) {
this->timer = sFallTimerDurations[(this->dyna.actor.params >> 8) & 7];
this->timer = sFallTimerDurations[PARAMS_GET_U(this->dyna.actor.params, 8, 3)];
ObjLift_SetupAction(this, ObjLift_Wait);
}
@ -143,7 +143,7 @@ void ObjLift_Wait(ObjLift* this, PlayState* play) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
if (this->timer <= 0) {
if (((this->dyna.actor.params >> 8) & 7) == 7) {
if (PARAMS_GET_U(this->dyna.actor.params, 8, 3) == 7) {
ObjLift_SetupFall(this);
} else {
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
@ -154,7 +154,7 @@ void ObjLift_Wait(ObjLift* this, PlayState* play) {
}
}
} else {
this->timer = sFallTimerDurations[(this->dyna.actor.params >> 8) & 7];
this->timer = sFallTimerDurations[PARAMS_GET_U(this->dyna.actor.params, 8, 3)];
}
}
@ -199,15 +199,15 @@ void ObjLift_Fall(ObjLift* this, PlayState* play) {
Actor_MoveXZGravity(&this->dyna.actor);
Math_Vec3f_Copy(&pos, &this->dyna.actor.prevPos);
pos.y += sMaxFallDistances[(this->dyna.actor.params >> 1) & 1];
pos.y += sMaxFallDistances[PARAMS_GET_U(this->dyna.actor.params, 1, 1)];
this->dyna.actor.floorHeight =
BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos);
if ((this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) >=
(sMaxFallDistances[(this->dyna.actor.params >> 1) & 1] - 0.001f)) {
(sMaxFallDistances[PARAMS_GET_U(this->dyna.actor.params, 1, 1)] - 0.001f)) {
ObjLift_SpawnFragments(this, play);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK);
Flags_SetSwitch(play, (this->dyna.actor.params >> 2) & 0x3F);
Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 2, 6));
Actor_Kill(&this->dyna.actor);
}
}