1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-02 07:46:01 +00:00

Minor Cleanup (#2308)

* cleanup

* more

* fix floats
This commit is contained in:
engineer124 2024-12-01 23:55:50 +11:00 committed by GitHub
parent e0bd123312
commit 6199634ffb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 12 deletions

View file

@ -632,14 +632,14 @@ typedef enum PlayerStickDirection {
/* 3 */ PLAYER_STICK_DIR_RIGHT /* 3 */ PLAYER_STICK_DIR_RIGHT
} PlayerStickDirection; } PlayerStickDirection;
typedef enum { typedef enum PlayerKnockbackType {
/* 0 */ PLAYER_KNOCKBACK_NONE, // No knockback /* 0 */ PLAYER_KNOCKBACK_NONE, // No knockback
/* 1 */ PLAYER_KNOCKBACK_SMALL, // A small hop, remains standing up /* 1 */ PLAYER_KNOCKBACK_SMALL, // A small hop, remains standing up
/* 2 */ PLAYER_KNOCKBACK_LARGE, // Sent flying in the air and lands laying down on the floor /* 2 */ PLAYER_KNOCKBACK_LARGE, // Sent flying in the air and lands laying down on the floor
/* 3 */ PLAYER_KNOCKBACK_LARGE_SHOCK // Same as`PLAYER_KNOCKBACK_LARGE` with a shock effect /* 3 */ PLAYER_KNOCKBACK_LARGE_SHOCK // Same as`PLAYER_KNOCKBACK_LARGE` with a shock effect
} PlayerKnockbackType; } PlayerKnockbackType;
typedef enum { typedef enum PlayerDamageResponseType {
/* 0 */ PLAYER_HIT_RESPONSE_NONE, /* 0 */ PLAYER_HIT_RESPONSE_NONE,
/* 1 */ PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, /* 1 */ PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE,
/* 2 */ PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL, /* 2 */ PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL,
@ -703,7 +703,7 @@ typedef struct WeaponInfo {
#define PLAYER_STATE1_9 (1 << 9) #define PLAYER_STATE1_9 (1 << 9)
#define PLAYER_STATE1_10 (1 << 10) #define PLAYER_STATE1_10 (1 << 10)
#define PLAYER_STATE1_CARRYING_ACTOR (1 << 11) // Currently carrying an actor #define PLAYER_STATE1_CARRYING_ACTOR (1 << 11) // Currently carrying an actor
#define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12) // Currently charing a spin attack (by holding down the B button) #define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12) // Currently charging a spin attack (by holding down the B button)
#define PLAYER_STATE1_13 (1 << 13) #define PLAYER_STATE1_13 (1 << 13)
#define PLAYER_STATE1_14 (1 << 14) #define PLAYER_STATE1_14 (1 << 14)
#define PLAYER_STATE1_Z_TARGETING (1 << 15) // Either lock-on or parallel is active. This flag is never checked for and is practically unused. #define PLAYER_STATE1_Z_TARGETING (1 << 15) // Either lock-on or parallel is active. This flag is never checked for and is practically unused.
@ -899,7 +899,7 @@ typedef struct Player {
/* 0x084F */ union { /* 0x084F */ union {
s8 actionVar1; s8 actionVar1;
s8 startedAnim; // Player_Action_EndTimeTravel: Started playing the animation that was previously frozen s8 startedAnim; // Player_Action_TimeTravelEnd: Started playing the animation that was previously frozen
s8 facingUpSlope; // Player_Action_SlideOnSlope: Facing uphill when sliding on a slope s8 facingUpSlope; // Player_Action_SlideOnSlope: Facing uphill when sliding on a slope
s8 isLakeHyliaCs; // Player_Action_BlueWarpArrive: In Lake Hylia CS after Water Temple. Floating down is delayed until a specific point in the cutscene. s8 isLakeHyliaCs; // Player_Action_BlueWarpArrive: In Lake Hylia CS after Water Temple. Floating down is delayed until a specific point in the cutscene.
s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle
@ -909,7 +909,7 @@ typedef struct Player {
s16 actionVar2; s16 actionVar2;
s16 fallDamageStunTimer; // Player_Action_Idle: Prevents any movement and shakes model up and down quickly to indicate fall damage stun s16 fallDamageStunTimer; // Player_Action_Idle: Prevents any movement and shakes model up and down quickly to indicate fall damage stun
s16 bonked; // Player_Action_Roll: Set to true after bonking into a wall or an actor s16 bonked; // Player_Action_Roll: Set to true after bonking into a wall or an actor
s16 animDelayTimer; // Player_Action_EndTimeTravel: Delays playing animation until finished counting down s16 animDelayTimer; // Player_Action_TimeTravelEnd: Delays playing animation until finished counting down
s16 startedTextbox; // Player_Action_SwingBottle: set to true when the textbox is started s16 startedTextbox; // Player_Action_SwingBottle: set to true when the textbox is started
s16 inWater; // Player_Action_SwingBottle: True if a bottle is swung in water. Used to determine which bottle swing animation to use. s16 inWater; // Player_Action_SwingBottle: True if a bottle is swung in water. Used to determine which bottle swing animation to use.
s16 csDelayTimer; // Player_Action_WaitForCutscene: Number of frames to wait before responding to a cutscene s16 csDelayTimer; // Player_Action_WaitForCutscene: Number of frames to wait before responding to a cutscene

View file

@ -618,7 +618,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) {
} }
} }
this->actor.colChkInfo.damage = 0; this->actor.colChkInfo.damage = 0;
this->knockbackDamage = PLAYER_KNOCKBACK_NONE; this->knockbackDamage = 0;
} }
// Handles being frozen by a deku nut // Handles being frozen by a deku nut

View file

@ -7254,7 +7254,7 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly)
if (sFloorShapePitch >= 0) { if (sFloorShapePitch >= 0) {
this->av1.facingUpSlope = true; this->av1.facingUpSlope = true;
} }
Player_AnimChangeLoopMorph(play, this, sSlopeSlideAnims[this->av1.actionVar1]); Player_AnimChangeLoopMorph(play, this, sSlopeSlideAnims[this->av1.facingUpSlope]);
this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z));
this->yaw = playerVelYaw; this->yaw = playerVelYaw;
return true; return true;
@ -14244,17 +14244,17 @@ void Player_Action_SlideOnSlope(Player* this, PlayState* play) {
shapeYawTarget = downwardSlopeYaw + 0x8000; shapeYawTarget = downwardSlopeYaw + 0x8000;
} }
if (this->speedXZ < 0) { if (this->speedXZ < 0.0f) {
downwardSlopeYaw += 0x8000; downwardSlopeYaw += 0x8000;
} }
xzSpeedTarget = (1.0f - slopeNormal.y) * 40.0f; xzSpeedTarget = (1.0f - slopeNormal.y) * 40.0f;
xzSpeedTarget = CLAMP(xzSpeedTarget, 0, 10.0f); xzSpeedTarget = CLAMP(xzSpeedTarget, 0.0f, 10.0f);
xzSpeedIncrStep = SQ(xzSpeedTarget) * 0.015f; xzSpeedIncrStep = SQ(xzSpeedTarget) * 0.015f;
xzSpeedDecrStep = slopeNormal.y * 0.01f; xzSpeedDecrStep = slopeNormal.y * 0.01f;
if (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1) { if (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1) {
xzSpeedTarget = 0; xzSpeedTarget = 0.0f;
xzSpeedDecrStep = slopeNormal.y * 10.0f; xzSpeedDecrStep = slopeNormal.y * 10.0f;
} }
@ -14262,7 +14262,8 @@ void Player_Action_SlideOnSlope(Player* this, PlayState* play) {
xzSpeedIncrStep = 1.0f; xzSpeedIncrStep = 1.0f;
} }
if (Math_AsymStepToF(&this->speedXZ, xzSpeedTarget, xzSpeedIncrStep, xzSpeedDecrStep) && (xzSpeedTarget == 0)) { if (Math_AsymStepToF(&this->speedXZ, xzSpeedTarget, xzSpeedIncrStep, xzSpeedDecrStep) &&
(xzSpeedTarget == 0.0f)) {
LinkAnimationHeader* slideAnimation; LinkAnimationHeader* slideAnimation;
if (!this->av1.facingUpSlope) { if (!this->av1.facingUpSlope) {
@ -14315,7 +14316,7 @@ void Player_Action_BlueWarpArrive(Player* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f;
Player_PlayLandingSfx(this); Player_PlayLandingSfx(this);
this->av2.actionVar2 = 1; this->av2.playedLandingSfx = true;
} }
} else { } else {
if ((play->sceneId == SCENE_KOKIRI_FOREST) && Player_StartCsAction(play, this)) { if ((play->sceneId == SCENE_KOKIRI_FOREST) && Player_StartCsAction(play, this)) {