mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-25 09:45:02 +00:00
Fixup feetFloorFlags
doc and -> feetFloorFlag
This commit is contained in:
parent
3f784d0068
commit
c45b3611e7
3 changed files with 12 additions and 10 deletions
|
@ -96,7 +96,7 @@ typedef struct {
|
|||
/* 0x0C */ ActorShadowFunc shadowDraw; // Shadow draw function
|
||||
/* 0x10 */ f32 shadowScale; // Changes the size of the shadow
|
||||
/* 0x14 */ u8 shadowAlpha; // Default is 255
|
||||
/* 0x15 */ u8 feetFloorFlags; // Set if the actor's foot is clipped under the floor. & 1 is right foot, & 2 is left
|
||||
/* 0x15 */ u8 feetFloorFlag; // 0 if actor or feet aren't on ground, or 1 or 2 depending on feet positions
|
||||
/* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDraw
|
||||
} ActorShape; // size = 0x30
|
||||
|
||||
|
|
|
@ -137,18 +137,20 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx
|
|||
|
||||
POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C);
|
||||
|
||||
actor->shape.feetFloorFlags = 0;
|
||||
// feetFloorFlag is temporarily a bitfield where the bits are set if the foot is on ground
|
||||
// feetFloorFlag & 2 is left foot, feetFloorFlag & 1 is right foot
|
||||
actor->shape.feetFloorFlag = 0;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
feetPosPtr->y += 50.0f;
|
||||
*floorHeightPtr = func_800BFCB8(globalCtx, &floorMtx, feetPosPtr);
|
||||
feetPosPtr->y -= 50.0f;
|
||||
actor->shape.feetFloorFlags <<= 1;
|
||||
actor->shape.feetFloorFlag <<= 1;
|
||||
distToFloor = feetPosPtr->y - *floorHeightPtr;
|
||||
|
||||
if ((-1.0f <= distToFloor) && (distToFloor < 500.0f)) {
|
||||
if (distToFloor <= 0.0f) {
|
||||
actor->shape.feetFloorFlags++;
|
||||
actor->shape.feetFloorFlag++;
|
||||
}
|
||||
distToFloor = CLAMP_MAX(distToFloor, 30.0f);
|
||||
shadowAlpha = (f32)actor->shape.shadowAlpha * (1.0f - (distToFloor * (1.0f / 30.0f)));
|
||||
|
@ -189,14 +191,14 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx
|
|||
}
|
||||
|
||||
if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
|
||||
actor->shape.feetFloorFlags = 0;
|
||||
} else if (actor->shape.feetFloorFlags == 3) {
|
||||
actor->shape.feetFloorFlag = 0;
|
||||
} else if (actor->shape.feetFloorFlag == 3) {
|
||||
f32 footDistY = actor->shape.feetPos[FOOT_LEFT].y - actor->shape.feetPos[FOOT_RIGHT].y;
|
||||
|
||||
if ((floorHeight[0] + footDistY) < (floorHeight[1] - footDistY)) {
|
||||
actor->shape.feetFloorFlags = 2;
|
||||
if ((floorHeight[FOOT_LEFT] + footDistY) < (floorHeight[FOOT_RIGHT] - footDistY)) {
|
||||
actor->shape.feetFloorFlag = 2;
|
||||
} else {
|
||||
actor->shape.feetFloorFlags = 1;
|
||||
actor->shape.feetFloorFlag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10961,7 +10961,7 @@ void func_8084BBE4(Player* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) || (this->actor.shape.feetFloorFlags != 0)) {
|
||||
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) || (this->actor.shape.feetFloorFlag != 0)) {
|
||||
func_80837B60(this);
|
||||
if (this->unk_84F < 0) {
|
||||
this->linearVelocity = -0.8f;
|
||||
|
|
Loading…
Reference in a new issue