summaryrefslogtreecommitdiff
path: root/src/overlays/effects
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-04-18 18:14:36 -0400
committerGitHub <noreply@github.com>2023-04-18 18:14:36 -0400
commit38d21bbe9753568ff3c708ec602d037aca6a0f27 (patch)
treebe399fb71b38c8f1974ab10f332a8632da924453 /src/overlays/effects
parent4647ebb91b9646d92d85929814815e48fa6e44ac (diff)
Name some `SurfaceType_` functions (#1155)
* enums * renaming functions * fixes * SurfaceType_IsSoft * type fixing * format * Update src/code/z_bgcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_bgcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * review Co-authored-by: engineer124 <engineer124engineer124@gmail.com> * SurfaceType_GetFloorEffect Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * format * bss * cleanups * extra material docs * cleanup * cleanups * Remove Bg prefix * minor fixes * Remove BG_ * SURFACE_MATERIAL_DIRT_SHALLOW * format * bss * bss * review Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * format * format again * bug * format * namefixer * bss * bss * bss * review --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: engineer124 <engineer124engineer124@gmail.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Diffstat (limited to 'src/overlays/effects')
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
index a3d203992..681aac01d 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
@@ -22,7 +22,11 @@ EffectSsInit Effect_Ss_Bubble_InitVars = {
EffectSsBubble_Init,
};
-static f32 sVecAdjMaximums[] = { 291.0f, 582.0f, 1600.0f };
+static f32 sVecAdjMaximums[] = {
+ 291.0f, // CONVEYOR_SPEED_SLOW
+ 582.0f, // CONVEYOR_SPEED_MEDIUM
+ 1600.0f, // CONVEYOR_SPEED_FAST
+};
u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsBubbleInitParams* initParams = (EffectSsBubbleInitParams*)initParamsx;
@@ -85,17 +89,18 @@ void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this) {
}
if (((play->gameplayFrames + index) % 8) == 0) {
CollisionPoly* colPoly;
- u32 speed;
- s16 direction;
+ ConveyorSpeed conveyorSpeed;
+ s16 conveyorDir;
f32 rVecAdjMax;
BgCheck_EntityRaycastFloor2_1(play, &play->colCtx, &colPoly, &this->pos);
- speed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE);
- if ((speed != 0) && !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) {
- direction = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 0xA;
- rVecAdjMax = sVecAdjMaximums[speed - 1];
- this->rVecAdjX = Math_SinS(direction) * rVecAdjMax;
- this->rVecAdjZ = Math_CosS(direction) * rVecAdjMax;
+ conveyorSpeed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE);
+ if ((conveyorSpeed != CONVEYOR_SPEED_DISABLED) &&
+ !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) {
+ conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 10;
+ rVecAdjMax = sVecAdjMaximums[conveyorSpeed - 1];
+ this->rVecAdjX = Math_SinS(conveyorDir) * rVecAdjMax;
+ this->rVecAdjZ = Math_CosS(conveyorDir) * rVecAdjMax;
}
}
this->vec.x += this->rVecAdjX / 100.0f;