mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 23:36:22 +00:00
Document Pushing Player: Bg Conveyors and Climbing Slopes (#1103)
* Document pushing Player * Cleaner and better names * Tiny cleanup * Add enum to func * PR Feedback * Change conveyor to `IsFloorConveyor` * Small touchup * Attempt at better comments * Clarify comments * Clarify comment further * Fix formatting * PR Feedback
This commit is contained in:
parent
a9084ad65e
commit
04fb0ac1b1
8 changed files with 101 additions and 86 deletions
|
@ -660,7 +660,7 @@ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId)
|
||||||
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
s32 SurfaceType_IsConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||||
|
|
|
@ -608,8 +608,8 @@ typedef struct Player {
|
||||||
/* 0x08A2 */ s16 unk_8A2;
|
/* 0x08A2 */ s16 unk_8A2;
|
||||||
/* 0x08A4 */ f32 unk_8A4;
|
/* 0x08A4 */ f32 unk_8A4;
|
||||||
/* 0x08A8 */ f32 unk_8A8;
|
/* 0x08A8 */ f32 unk_8A8;
|
||||||
/* 0x08AC */ f32 windSpeed;
|
/* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces
|
||||||
/* 0x08B0 */ s16 windDirection;
|
/* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed
|
||||||
/* 0x08B4 */ WeaponInfo meleeWeaponInfo[3];
|
/* 0x08B4 */ WeaponInfo meleeWeaponInfo[3];
|
||||||
/* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX];
|
/* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX];
|
||||||
/* 0x09E0 */ MtxF mf_9E0;
|
/* 0x09E0 */ MtxF mf_9E0;
|
||||||
|
|
|
@ -4113,10 +4113,15 @@ s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly*
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CollisionPoly is conveyor enabled
|
* Checks if poly is a floor conveyor
|
||||||
* Returns true if `poly` is a conveyor surface, else false
|
*
|
||||||
|
* A conveyor surface is enabled with non-zero speed.
|
||||||
|
* When enabled, the conveyor will exhibit two types of behaviour depending on the return value:
|
||||||
|
*
|
||||||
|
* If true, then it is a floor conveyor and will push player only while being stood on
|
||||||
|
* If false, then it is a water conveyor and will push player only while in water
|
||||||
*/
|
*/
|
||||||
s32 SurfaceType_IsConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
if (BgCheck_GetCollisionHeader(colCtx, bgId) == NULL) {
|
if (BgCheck_GetCollisionHeader(colCtx, bgId) == NULL) {
|
||||||
|
|
|
@ -436,8 +436,8 @@ void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) {
|
||||||
|
|
||||||
if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) &&
|
if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) &&
|
||||||
(GET_PLAYER(globalCtx)->currentBoots != PLAYER_BOOTS_IRON)) {
|
(GET_PLAYER(globalCtx)->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||||
player->windSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f);
|
player->pushedSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f);
|
||||||
player->windDirection = this->dyna.actor.shape.rot.y;
|
player->pushedYaw = this->dyna.actor.shape.rot.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3442,7 +3442,7 @@ s32 EnHorse_UpdateConveyors(EnHorse* this, GlobalContext* globalCtx) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
conveyorDir = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId);
|
conveyorDir = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId);
|
||||||
conveyorDir = (conveyorDir << 10) - this->actor.world.rot.y;
|
conveyorDir = (conveyorDir * (0x10000 / 64)) - this->actor.world.rot.y;
|
||||||
if (conveyorDir > 800.0f) {
|
if (conveyorDir > 800.0f) {
|
||||||
this->actor.world.rot.y += 800.0f;
|
this->actor.world.rot.y += 800.0f;
|
||||||
} else if (conveyorDir < -800.0f) {
|
} else if (conveyorDir < -800.0f) {
|
||||||
|
|
|
@ -163,8 +163,8 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) {
|
||||||
Math_ApproachF(&this->appliedSpeed, this->targetAppliedSpeed, 1.0f, 0.1f);
|
Math_ApproachF(&this->appliedSpeed, this->targetAppliedSpeed, 1.0f, 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
player->windDirection = this->appliedYaw;
|
player->pushedYaw = this->appliedYaw;
|
||||||
player->windSpeed = this->appliedSpeed;
|
player->pushedSpeed = this->appliedSpeed;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this->applySpeed) {
|
if (this->applySpeed) {
|
||||||
|
|
|
@ -91,11 +91,11 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) {
|
||||||
if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) {
|
if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) {
|
||||||
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
|
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
|
||||||
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
|
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
|
||||||
player->windDirection = RADF_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
|
player->pushedYaw = RADF_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
|
||||||
if (xzDist > 3.0f) {
|
if (xzDist > 3.0f) {
|
||||||
Math_SmoothStepToF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f);
|
Math_SmoothStepToF(&player->pushedSpeed, 3.0f, 0.5f, xzDist, 0.0f);
|
||||||
} else {
|
} else {
|
||||||
player->windSpeed = 0.0f;
|
player->pushedSpeed = 0.0f;
|
||||||
Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 0.5f, 3.0f, 0.0f);
|
Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 0.5f, 3.0f, 0.0f);
|
||||||
Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 0.5f, 3.0f, 0.0f);
|
Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 0.5f, 3.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,9 +476,9 @@ static s32 D_808535E4 = 0;
|
||||||
static f32 D_808535E8 = 1.0f;
|
static f32 D_808535E8 = 1.0f;
|
||||||
static f32 D_808535EC = 1.0f;
|
static f32 D_808535EC = 1.0f;
|
||||||
static u32 D_808535F0 = 0;
|
static u32 D_808535F0 = 0;
|
||||||
static u32 D_808535F4 = 0;
|
static u32 sConveyorSpeedIndex = 0;
|
||||||
static s16 D_808535F8 = 0;
|
static s16 sIsFloorConveyor = false;
|
||||||
static s16 D_808535FC = 0;
|
static s16 sConveyorYaw = 0;
|
||||||
static f32 D_80853600 = 0.0f;
|
static f32 D_80853600 = 0.0f;
|
||||||
static s32 D_80853604 = 0;
|
static s32 D_80853604 = 0;
|
||||||
static s32 D_80853608 = 0;
|
static s32 D_80853608 = 0;
|
||||||
|
@ -4186,8 +4186,8 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u
|
||||||
gSaveContext.entranceSpeed = linearVel;
|
gSaveContext.entranceSpeed = linearVel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (D_808535F4 != 0) {
|
if (sConveyorSpeedIndex != 0) {
|
||||||
yaw = D_808535FC;
|
yaw = sConveyorYaw;
|
||||||
} else {
|
} else {
|
||||||
yaw = this->actor.world.rot.y;
|
yaw = this->actor.world.rot.y;
|
||||||
}
|
}
|
||||||
|
@ -5998,12 +5998,12 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_8083E298(CollisionPoly* arg0, Vec3f* arg1, s16* arg2) {
|
void Player_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* downwardSlopeYaw) {
|
||||||
arg1->x = COLPOLY_GET_NORMAL(arg0->normal.x);
|
slopeNormal->x = COLPOLY_GET_NORMAL(floorPoly->normal.x);
|
||||||
arg1->y = COLPOLY_GET_NORMAL(arg0->normal.y);
|
slopeNormal->y = COLPOLY_GET_NORMAL(floorPoly->normal.y);
|
||||||
arg1->z = COLPOLY_GET_NORMAL(arg0->normal.z);
|
slopeNormal->z = COLPOLY_GET_NORMAL(floorPoly->normal.z);
|
||||||
|
|
||||||
*arg2 = Math_Atan2S(arg1->z, arg1->x);
|
*downwardSlopeYaw = Math_Atan2S(slopeNormal->z, slopeNormal->x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LinkAnimationHeader* D_80854590[] = {
|
static LinkAnimationHeader* D_80854590[] = {
|
||||||
|
@ -6011,30 +6011,36 @@ static LinkAnimationHeader* D_80854590[] = {
|
||||||
&gPlayerAnim_0031D0,
|
&gPlayerAnim_0031D0,
|
||||||
};
|
};
|
||||||
|
|
||||||
s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) {
|
s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* floorPoly) {
|
||||||
s32 pad;
|
s32 pad;
|
||||||
s16 sp4A;
|
s16 playerVelYaw;
|
||||||
Vec3f sp3C;
|
Vec3f slopeNormal;
|
||||||
s16 sp3A;
|
s16 downwardSlopeYaw;
|
||||||
f32 temp1;
|
f32 slopeSlowdownSpeed;
|
||||||
f32 temp2;
|
f32 slopeSlowdownSpeedStep;
|
||||||
s16 temp3;
|
s16 velYawToDownwardSlope;
|
||||||
|
|
||||||
if (!Player_InBlockingCsMode(globalCtx, this) && (func_8084F390 != this->func_674) &&
|
if (!Player_InBlockingCsMode(globalCtx, this) && (func_8084F390 != this->func_674) &&
|
||||||
(SurfaceType_GetSlope(&globalCtx->colCtx, arg2, this->actor.floorBgId) == 1)) {
|
(SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) == 1)) {
|
||||||
sp4A = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
|
|
||||||
func_8083E298(arg2, &sp3C, &sp3A);
|
|
||||||
temp3 = sp3A - sp4A;
|
|
||||||
|
|
||||||
if (ABS(temp3) > 16000) {
|
// Get direction of movement relative to the downward direction of the slope
|
||||||
temp1 = (1.0f - sp3C.y) * 40.0f;
|
playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
|
||||||
temp2 = (temp1 * temp1) * 0.015f;
|
Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw);
|
||||||
if (temp2 < 1.2f) {
|
velYawToDownwardSlope = downwardSlopeYaw - playerVelYaw;
|
||||||
temp2 = 1.2f;
|
|
||||||
|
if (ABS(velYawToDownwardSlope) > 0x3E80) { // 87.9 degrees
|
||||||
|
// moving parallel or upwards on the slope, player does not slip but does slow down
|
||||||
|
slopeSlowdownSpeed = (1.0f - slopeNormal.y) * 40.0f;
|
||||||
|
slopeSlowdownSpeedStep = SQ(slopeSlowdownSpeed) * 0.015f;
|
||||||
|
if (slopeSlowdownSpeedStep < 1.2f) {
|
||||||
|
slopeSlowdownSpeedStep = 1.2f;
|
||||||
}
|
}
|
||||||
this->windDirection = sp3A;
|
|
||||||
Math_StepToF(&this->windSpeed, temp1, temp2);
|
// slows down speed as player is climbing a slope
|
||||||
|
this->pushedYaw = downwardSlopeYaw;
|
||||||
|
Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep);
|
||||||
} else {
|
} else {
|
||||||
|
// moving downward on the slope, causing player to slip
|
||||||
func_80835C58(globalCtx, this, func_8084F390, 0);
|
func_80835C58(globalCtx, this, func_8084F390, 0);
|
||||||
func_80832564(globalCtx, this);
|
func_80832564(globalCtx, this);
|
||||||
if (D_80853610 >= 0) {
|
if (D_80853610 >= 0) {
|
||||||
|
@ -6042,12 +6048,12 @@ s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) {
|
||||||
}
|
}
|
||||||
func_80832BE8(globalCtx, this, D_80854590[this->unk_84F]);
|
func_80832BE8(globalCtx, this, D_80854590[this->unk_84F]);
|
||||||
this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z));
|
this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z));
|
||||||
this->currentYaw = sp4A;
|
this->currentYaw = playerVelYaw;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unknown data (unused)
|
// unknown data (unused)
|
||||||
|
@ -8831,9 +8837,9 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) {
|
||||||
if (this->stateFlags1 & PLAYER_STATE1_0) {
|
if (this->stateFlags1 & PLAYER_STATE1_0) {
|
||||||
sp34 = gSaveContext.entranceSpeed;
|
sp34 = gSaveContext.entranceSpeed;
|
||||||
|
|
||||||
if (D_808535F4 != 0) {
|
if (sConveyorSpeedIndex != 0) {
|
||||||
this->unk_450.x = (Math_SinS(D_808535FC) * 400.0f) + this->actor.world.pos.x;
|
this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x;
|
||||||
this->unk_450.z = (Math_CosS(D_808535FC) * 400.0f) + this->actor.world.pos.z;
|
this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z;
|
||||||
}
|
}
|
||||||
} else if (this->unk_850 < 0) {
|
} else if (this->unk_850 < 0) {
|
||||||
this->unk_850++;
|
this->unk_850++;
|
||||||
|
@ -9642,7 +9648,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
D_80853600 = this->actor.world.pos.y - this->actor.floorHeight;
|
D_80853600 = this->actor.world.pos.y - this->actor.floorHeight;
|
||||||
D_808535F4 = 0;
|
sConveyorSpeedIndex = 0;
|
||||||
|
|
||||||
floorPoly = this->actor.floorPoly;
|
floorPoly = this->actor.floorPoly;
|
||||||
|
|
||||||
|
@ -9675,16 +9681,17 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
D_808535F4 = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
// This block extracts the conveyor properties from the floor poly
|
||||||
if (D_808535F4 != 0) {
|
sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
||||||
D_808535F8 = SurfaceType_IsConveyor(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
if (sConveyorSpeedIndex != 0) {
|
||||||
if (((D_808535F8 == 0) && (this->actor.yDistToWater > 20.0f) &&
|
sIsFloorConveyor = SurfaceType_IsFloorConveyor(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
||||||
|
if ((!sIsFloorConveyor && (this->actor.yDistToWater > 20.0f) &&
|
||||||
(this->currentBoots != PLAYER_BOOTS_IRON)) ||
|
(this->currentBoots != PLAYER_BOOTS_IRON)) ||
|
||||||
((D_808535F8 != 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) {
|
(sIsFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) {
|
||||||
D_808535FC = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, floorPoly, this->actor.floorBgId)
|
sConveyorYaw = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) *
|
||||||
<< 10;
|
(0x10000 / 64);
|
||||||
} else {
|
} else {
|
||||||
D_808535F4 = 0;
|
sConveyorSpeedIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10090,8 +10097,8 @@ static s8 D_808547C4[] = {
|
||||||
|
|
||||||
static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f };
|
static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f };
|
||||||
|
|
||||||
static f32 D_80854820[] = { 2.0f, 4.0f, 7.0f };
|
static f32 sWaterConveyorSpeeds[] = { 2.0f, 4.0f, 7.0f };
|
||||||
static f32 D_8085482C[] = { 0.5f, 1.0f, 3.0f };
|
static f32 sFloorConveyorSpeeds[] = { 0.5f, 1.0f, 3.0f };
|
||||||
|
|
||||||
void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
||||||
s32 pad;
|
s32 pad;
|
||||||
|
@ -10252,11 +10259,11 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
||||||
|
|
||||||
func_8002D868(&this->actor);
|
func_8002D868(&this->actor);
|
||||||
|
|
||||||
if ((this->windSpeed != 0.0f) && !Player_InCsMode(globalCtx) &&
|
if ((this->pushedSpeed != 0.0f) && !Player_InCsMode(globalCtx) &&
|
||||||
!(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) &&
|
!(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) &&
|
||||||
(func_80845668 != this->func_674) && (func_808507F4 != this->func_674)) {
|
(func_80845668 != this->func_674) && (func_808507F4 != this->func_674)) {
|
||||||
this->actor.velocity.x += this->windSpeed * Math_SinS(this->windDirection);
|
this->actor.velocity.x += this->pushedSpeed * Math_SinS(this->pushedYaw);
|
||||||
this->actor.velocity.z += this->windSpeed * Math_CosS(this->windDirection);
|
this->actor.velocity.z += this->pushedSpeed * Math_CosS(this->pushedYaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
func_8002D7EC(&this->actor);
|
func_8002D7EC(&this->actor);
|
||||||
|
@ -10287,31 +10294,33 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
D_808535F4 = 0;
|
sConveyorSpeedIndex = 0;
|
||||||
this->windSpeed = 0.0f;
|
this->pushedSpeed = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((D_808535F4 != 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) {
|
// This block applies the bg conveyor to pushedSpeed
|
||||||
f32 sp48;
|
if ((sConveyorSpeedIndex != 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||||
|
f32 conveyorSpeed;
|
||||||
|
|
||||||
D_808535F4--;
|
// converts 1-index to 0-index
|
||||||
|
sConveyorSpeedIndex--;
|
||||||
|
|
||||||
if (D_808535F8 == 0) {
|
if (!sIsFloorConveyor) {
|
||||||
sp48 = D_80854820[D_808535F4];
|
conveyorSpeed = sWaterConveyorSpeeds[sConveyorSpeedIndex];
|
||||||
|
|
||||||
if (!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
if (!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
||||||
sp48 *= 0.25f;
|
conveyorSpeed *= 0.25f;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sp48 = D_8085482C[D_808535F4];
|
conveyorSpeed = sFloorConveyorSpeeds[sConveyorSpeedIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
Math_StepToF(&this->windSpeed, sp48, sp48 * 0.1f);
|
Math_StepToF(&this->pushedSpeed, conveyorSpeed, conveyorSpeed * 0.1f);
|
||||||
|
|
||||||
Math_ScaledStepToS(&this->windDirection, D_808535FC,
|
Math_ScaledStepToS(&this->pushedYaw, sConveyorYaw,
|
||||||
((this->stateFlags1 & PLAYER_STATE1_27) ? 400.0f : 800.0f) * sp48);
|
((this->stateFlags1 & PLAYER_STATE1_27) ? 400.0f : 800.0f) * conveyorSpeed);
|
||||||
} else if (this->windSpeed != 0.0f) {
|
} else if (this->pushedSpeed != 0.0f) {
|
||||||
Math_StepToF(&this->windSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_27) ? 0.5f : 1.0f);
|
Math_StepToF(&this->pushedSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_27) ? 0.5f : 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Player_InBlockingCsMode(globalCtx, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) {
|
if (!Player_InBlockingCsMode(globalCtx, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) {
|
||||||
|
@ -12557,9 +12566,9 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
||||||
f32 sp50;
|
f32 sp50;
|
||||||
f32 sp4C;
|
f32 sp4C;
|
||||||
f32 sp48;
|
f32 sp48;
|
||||||
s16 sp46;
|
s16 downwardSlopeYaw;
|
||||||
s16 sp44;
|
s16 sp44;
|
||||||
Vec3f sp38;
|
Vec3f slopeNormal;
|
||||||
|
|
||||||
this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6;
|
this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6;
|
||||||
LinkAnimation_Update(globalCtx, &this->skelAnime);
|
LinkAnimation_Update(globalCtx, &this->skelAnime);
|
||||||
|
@ -12574,25 +12583,25 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
func_8083E298(floorPoly, &sp38, &sp46);
|
Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw);
|
||||||
|
|
||||||
sp44 = sp46;
|
sp44 = downwardSlopeYaw;
|
||||||
if (this->unk_84F != 0) {
|
if (this->unk_84F != 0) {
|
||||||
sp44 = sp46 + 0x8000;
|
sp44 = downwardSlopeYaw + 0x8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->linearVelocity < 0) {
|
if (this->linearVelocity < 0) {
|
||||||
sp46 += 0x8000;
|
downwardSlopeYaw += 0x8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp50 = (1.0f - sp38.y) * 40.0f;
|
sp50 = (1.0f - slopeNormal.y) * 40.0f;
|
||||||
sp50 = CLAMP(sp50, 0, 10.0f);
|
sp50 = CLAMP(sp50, 0, 10.0f);
|
||||||
sp4C = (sp50 * sp50) * 0.015f;
|
sp4C = (sp50 * sp50) * 0.015f;
|
||||||
sp48 = sp38.y * 0.01f;
|
sp48 = slopeNormal.y * 0.01f;
|
||||||
|
|
||||||
if (SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) != 1) {
|
if (SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) != 1) {
|
||||||
sp50 = 0;
|
sp50 = 0;
|
||||||
sp48 = sp38.y * 10.0f;
|
sp48 = slopeNormal.y * 10.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp4C < 1.0f) {
|
if (sp4C < 1.0f) {
|
||||||
|
@ -12601,6 +12610,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
||||||
|
|
||||||
if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
|
if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
|
||||||
LinkAnimationHeader* anim;
|
LinkAnimationHeader* anim;
|
||||||
|
|
||||||
if (this->unk_84F == 0) {
|
if (this->unk_84F == 0) {
|
||||||
anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_42, this->modelAnimType);
|
anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_42, this->modelAnimType);
|
||||||
} else {
|
} else {
|
||||||
|
@ -12609,7 +12619,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
||||||
func_8083A098(this, anim, globalCtx);
|
func_8083A098(this, anim, globalCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
Math_SmoothStepToS(&this->currentYaw, sp46, 10, 4000, 800);
|
Math_SmoothStepToS(&this->currentYaw, downwardSlopeYaw, 10, 4000, 800);
|
||||||
Math_ScaledStepToS(&this->actor.shape.rot.y, sp44, 2000);
|
Math_ScaledStepToS(&this->actor.shape.rot.y, sp44, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue