summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2022-11-13 23:47:25 +0100
committerGitHub <noreply@github.com>2022-11-13 23:47:25 +0100
commitabb4201e57ed2200b745a5dc067665818141ca3e (patch)
treeaeba77ca5ff46d9911437283693fb49064bd967a /src/code
parentefe485f01720034ea9e844b3f385e3352bb63b20 (diff)
Fix misc 18 (#1423)
* two more ABS * fixup item_name_static texs outnames * fixup CollisionCheck_SetOCvsOC docs * Cleanup int comments alignments * collsion -> collision * `SQ*` macros fixup * use `LERP` more * static -> `s` prefix * grammar: dont -> don't * 3
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_camera.c6
-rw-r--r--src/code/z_collision_check.c32
-rw-r--r--src/code/z_effect_soft_sprite_old_init.c2
3 files changed, 20 insertions, 20 deletions
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index 7a9ab5d65..4c69f5889 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -816,10 +816,10 @@ Vec3f* Camera_BGCheckCorner(Vec3f* dst, Vec3f* linePointA, Vec3f* linePointB, Ca
}
/**
- * Checks collision between at and eyeNext, if `checkEye` is set, if there is no collsion between
+ * Checks collision between at and eyeNext, if `checkEye` is set, if there is no collision between
* eyeNext->at, then eye->at is also checked.
* Returns:
- * 0 if no collsion is found between at->eyeNext
+ * 0 if no collision is found between at->eyeNext
* 2 if the angle between the polys is between 60 degrees and 120 degrees
* 3 ?
* 6 if the angle between the polys is greater than 120 degrees
@@ -2531,7 +2531,7 @@ s32 Camera_Jump2(Camera* camera) {
Camera_AddVecGeoToVec3f(&camBgChk.pos, at, &bgChkPara);
if (Camera_BGCheckInfo(camera, at, &camBgChk)) {
// Collision found between parallel at->eyeNext, set eye position to
- // first collsion point.
+ // first collision point.
*eye = bgChkPos;
} else {
// no collision found with the parallel at->eye, animate to be parallel
diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c
index fd7069761..6ac812d6b 100644
--- a/src/code/z_collision_check.c
+++ b/src/code/z_collision_check.c
@@ -2648,8 +2648,8 @@ void CollisionCheck_SetOCvsOC(Collider* left, ColliderInfo* leftInfo, Vec3f* lef
f32 zDelta;
Actor* leftActor = left->actor;
Actor* rightActor = right->actor;
- s32 leftMassType;
s32 rightMassType;
+ s32 leftMassType;
left->ocFlags1 |= OC1_HIT;
left->oc = rightActor;
@@ -2666,8 +2666,8 @@ void CollisionCheck_SetOCvsOC(Collider* left, ColliderInfo* leftInfo, Vec3f* lef
if (leftActor == NULL || rightActor == NULL || left->ocFlags1 & OC1_NO_PUSH || right->ocFlags1 & OC1_NO_PUSH) {
return;
}
- rightMassType = CollisionCheck_GetMassType(leftActor->colChkInfo.mass);
- leftMassType = CollisionCheck_GetMassType(rightActor->colChkInfo.mass);
+ leftMassType = CollisionCheck_GetMassType(leftActor->colChkInfo.mass);
+ rightMassType = CollisionCheck_GetMassType(rightActor->colChkInfo.mass);
leftMass = leftActor->colChkInfo.mass;
rightMass = rightActor->colChkInfo.mass;
totalMass = leftMass + rightMass;
@@ -2679,30 +2679,30 @@ void CollisionCheck_SetOCvsOC(Collider* left, ColliderInfo* leftInfo, Vec3f* lef
zDelta = rightPos->z - leftPos->z;
xzDist = sqrtf(SQ(xDelta) + SQ(zDelta));
- if (rightMassType == MASSTYPE_IMMOVABLE) {
- if (leftMassType == MASSTYPE_IMMOVABLE) {
+ if (leftMassType == MASSTYPE_IMMOVABLE) {
+ if (rightMassType == MASSTYPE_IMMOVABLE) {
return;
- } else { // leftMassType == MASS_HEAVY | MASS_NORMAL
+ } else { // rightMassType == MASSTYPE_HEAVY or MASSTYPE_NORMAL
leftDispRatio = 0;
rightDispRatio = 1;
}
- } else if (rightMassType == MASSTYPE_HEAVY) {
- if (leftMassType == MASSTYPE_IMMOVABLE) {
+ } else if (leftMassType == MASSTYPE_HEAVY) {
+ if (rightMassType == MASSTYPE_IMMOVABLE) {
leftDispRatio = 1;
rightDispRatio = 0;
- } else if (leftMassType == MASSTYPE_HEAVY) {
+ } else if (rightMassType == MASSTYPE_HEAVY) {
leftDispRatio = 0.5f;
rightDispRatio = 0.5f;
- } else { // leftMassType == MASS_NORMAL
+ } else { // rightMassType == MASSTYPE_NORMAL
leftDispRatio = 0;
rightDispRatio = 1;
}
- } else { // rightMassType == MASS_NORMAL
- if (leftMassType == MASSTYPE_NORMAL) {
+ } else { // leftMassType == MASSTYPE_NORMAL
+ if (rightMassType == MASSTYPE_NORMAL) {
inverseTotalMass = 1 / totalMass;
leftDispRatio = rightMass * inverseTotalMass;
rightDispRatio = leftMass * inverseTotalMass;
- } else { // leftMassType == MASS_HEAVY | MASS_IMMOVABLE
+ } else { // rightMassType == MASSTYPE_HEAVY or MASSTYPE_IMMOVABLE
leftDispRatio = 1;
rightDispRatio = 0;
}
@@ -3494,7 +3494,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
}
radSqDiff = SQXZ(actorToItem) - SQ(radius);
if (!IS_ZERO(SQXZ(itemStep))) {
- actorDotItemXZ = DOTXZ(2.0f * itemStep, actorToItem);
+ actorDotItemXZ = (2.0f * itemStep.x * actorToItem.x) + (2.0f * itemStep.z * actorToItem.z);
if (SQ(actorDotItemXZ) < (4.0f * SQXZ(itemStep) * radSqDiff)) {
return 0;
}
@@ -3511,10 +3511,10 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
if (intersect2 == true) {
frac2 = (-actorDotItemXZ - closeDist) / (2.0f * SQXZ(itemStep));
}
- } else if (!IS_ZERO(DOTXZ(2.0f * itemStep, actorToItem))) {
+ } else if (!IS_ZERO((2.0f * itemStep.x * actorToItem.x) + (2.0f * itemStep.z * actorToItem.z))) {
intersect1 = true;
intersect2 = false;
- frac1 = -radSqDiff / DOTXZ(2.0f * itemStep, actorToItem);
+ frac1 = -radSqDiff / ((2.0f * itemStep.x * actorToItem.x) + (2.0f * itemStep.z * actorToItem.z));
} else {
if (radSqDiff <= 0.0f) {
test1 = (0.0f < actorToItem.y) && (actorToItem.y < height);
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index 106fdee1a..1e30438d7 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -748,7 +748,7 @@ void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocit
* Spawn a shock effect
*
* param determines where the ligntning should go
- * 0: dont attach to any actor. spawns at the position specified by pos
+ * 0: don't attach to any actor. spawns at the position specified by pos
* 1: spawn at one of Player's body parts, chosen at random
* 2: spawn at one of Phantom Ganon's body parts, chosen at random
*/