From ee76c410406bcfdcd22a4a414c8e58eac1a3832b Mon Sep 17 00:00:00 2001 From: Steven Casper Date: Mon, 1 Sep 2025 01:40:23 -0700 Subject: [PATCH] Remove xsqrt declaration from xBound.h --- src/SB/Core/x/xBound.h | 1 - src/SB/Core/x/xCamera.h | 1 - src/SB/Core/x/xEntDrive.cpp | 1 + src/SB/Core/x/xVolume.cpp | 6 +- src/SB/Game/zDiscoFloor.cpp | 1 + src/SB/Game/zEntPickup.cpp | 1 + src/SB/Game/zEntPlayerBungeeState.cpp | 1 - src/SB/Game/zLOD.cpp | 6 +- src/SB/Game/zLasso.cpp | 27 ++- src/SB/Game/zNPCSupport.cpp | 1 - src/SB/Game/zNPCTypeAmbient.cpp | 1 - src/SB/Game/zNPCTypeCommon.cpp | 1 - src/SB/Game/zParCmd.cpp | 1 + src/SB/Game/zShrapnel.cpp | 304 ++++++++++++++------------ 14 files changed, 193 insertions(+), 160 deletions(-) diff --git a/src/SB/Core/x/xBound.h b/src/SB/Core/x/xBound.h index e6a3416f3..1bfd58463 100644 --- a/src/SB/Core/x/xBound.h +++ b/src/SB/Core/x/xBound.h @@ -37,7 +37,6 @@ void xBoundHitsBound(const xBound* a, const xBound* b, xCollis* c); void xRayHitsBound(const xRay3* r, const xBound* b, xCollis* c); void xSphereHitsBound(const xSphere* o, const xBound* b, xCollis* c); void xVecHitsBound(const xVec3* v, const xBound* b, xCollis* c); -F32 xsqrt(F32 x); inline xVec3* xBoundCenter(xBound* bound) { diff --git a/src/SB/Core/x/xCamera.h b/src/SB/Core/x/xCamera.h index ba85e32af..c484885f8 100644 --- a/src/SB/Core/x/xCamera.h +++ b/src/SB/Core/x/xCamera.h @@ -67,7 +67,6 @@ extern xMat4x3 sCameraFXMatOld; extern cameraFX sCameraFX[10]; extern cameraFXTableEntry sCameraFXTable[3]; - struct xScene; enum _tagTransType diff --git a/src/SB/Core/x/xEntDrive.cpp b/src/SB/Core/x/xEntDrive.cpp index 03ca31091..712f54025 100644 --- a/src/SB/Core/x/xEntDrive.cpp +++ b/src/SB/Core/x/xEntDrive.cpp @@ -1,6 +1,7 @@ #include "xEntDrive.h" #include "xMath.h" +#include "xMathInlines.h" #include diff --git a/src/SB/Core/x/xVolume.cpp b/src/SB/Core/x/xVolume.cpp index 06acc9ff1..f6d94e1cb 100644 --- a/src/SB/Core/x/xVolume.cpp +++ b/src/SB/Core/x/xVolume.cpp @@ -1,9 +1,7 @@ -#include - -#include "xBound.h" -#include "xLinkAsset.h" #include "xVolume.h" +#include + void xVolume::Init(xVolumeAsset* asset) { xBaseInit(this, asset); diff --git a/src/SB/Game/zDiscoFloor.cpp b/src/SB/Game/zDiscoFloor.cpp index 81a4e343c..a884b1cdc 100644 --- a/src/SB/Game/zDiscoFloor.cpp +++ b/src/SB/Game/zDiscoFloor.cpp @@ -10,6 +10,7 @@ #include "xString.h" #include "xDebug.h" #include "xMath.h" +#include "xMathInlines.h" #include "iModel.h" #include "iMath.h" diff --git a/src/SB/Game/zEntPickup.cpp b/src/SB/Game/zEntPickup.cpp index dea9392e1..8d2cfba9e 100644 --- a/src/SB/Game/zEntPickup.cpp +++ b/src/SB/Game/zEntPickup.cpp @@ -10,6 +10,7 @@ #include "zUI.h" #include "xMath.h" +#include "xMathInlines.h" #include "xFX.h" #include "xstransvc.h" #include "iAnim.h" diff --git a/src/SB/Game/zEntPlayerBungeeState.cpp b/src/SB/Game/zEntPlayerBungeeState.cpp index d5ba45371..600a4084a 100644 --- a/src/SB/Game/zEntPlayerBungeeState.cpp +++ b/src/SB/Game/zEntPlayerBungeeState.cpp @@ -1,7 +1,6 @@ #include "zEntPlayerBungeeState.h" #include "iScrFX.h" -#include "xBound.h" #include "xCamera.h" #include "xDebug.h" #include "xFX.h" diff --git a/src/SB/Game/zLOD.cpp b/src/SB/Game/zLOD.cpp index 876eb7d5f..a5ae7f9ee 100644 --- a/src/SB/Game/zLOD.cpp +++ b/src/SB/Game/zLOD.cpp @@ -1,8 +1,10 @@ #include "zLOD.h" #include -#include <../Core/x/xEnt.h> -#include <../Core/x/xBound.h> + +#include "xEnt.h" +#include "xMathInlines.h" + #include "zBase.h" #include "zEntDestructObj.h" diff --git a/src/SB/Game/zLasso.cpp b/src/SB/Game/zLasso.cpp index a742412a4..48254a872 100644 --- a/src/SB/Game/zLasso.cpp +++ b/src/SB/Game/zLasso.cpp @@ -1,5 +1,7 @@ #include "zLasso.h" +#include "xMathInlines.h" + #include "iModel.h" #include @@ -30,8 +32,10 @@ void zLasso_SetGuide(xEnt* ent, xAnimState* lassoAnim) var_r5 = sGuideList; u32 guideListIdx = 0; - for (u32 i = sNumGuideLists; i > 0; i--) { - if (var_r5->target == ent) { + for (u32 i = sNumGuideLists; i > 0; i--) + { + if (var_r5->target == ent) + { break; } @@ -83,25 +87,28 @@ void zLasso_InterpToGuide(zLasso* lasso) xVec3Init(&lasso->tgCenter, 0.0f, 0.0f, 0.0f); S32 vertMapIdx = 0; - for (S32 i = 0; i < currentGuideNumTris; i++) { - xVec3AddTo(&lasso->tgCenter, (xVec3*) morphTargetVector + sCurrentGuide->vertMap[vertMapIdx]); + for (S32 i = 0; i < currentGuideNumTris; i++) + { + xVec3AddTo(&lasso->tgCenter, + (xVec3*)morphTargetVector + sCurrentGuide->vertMap[vertMapIdx]); vertMapIdx += 1; } - xVec3SMul(&lasso->tgCenter, &lasso->tgCenter, 1.0f / (f32) currentGuideNumTris); - xVec3Sub(&sp14, (xVec3*) morphTargetVector + sCurrentGuide->vertMap[0], &lasso->tgCenter); - xVec3Sub(&sp8, (xVec3*) morphTargetVector + sCurrentGuide->vertMap[1], &lasso->tgCenter); + xVec3SMul(&lasso->tgCenter, &lasso->tgCenter, 1.0f / (f32)currentGuideNumTris); + xVec3Sub(&sp14, (xVec3*)morphTargetVector + sCurrentGuide->vertMap[0], &lasso->tgCenter); + xVec3Sub(&sp8, (xVec3*)morphTargetVector + sCurrentGuide->vertMap[1], &lasso->tgCenter); lasso->tgRadius = xVec3Normalize(&sp14, &sp14); - + xVec3Cross(&lasso->tgNormal, &sp14, &sp8); xVec3Normalize(&lasso->tgNormal, &lasso->tgNormal); - if (lasso->tgNormal.y < 0.0f) { + if (lasso->tgNormal.y < 0.0f) + { xVec3Inv(&lasso->tgNormal, &lasso->tgNormal); } - xMat4x3Toworld(&lasso->tgCenter, (xMat4x3*) sCurrentGuide->poly->Mat, &lasso->tgCenter); + xMat4x3Toworld(&lasso->tgCenter, (xMat4x3*)sCurrentGuide->poly->Mat, &lasso->tgCenter); } } diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 7e8fdc0fc..5d4cc5c14 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -15,7 +15,6 @@ #include "xMathInlines.h" #include "xMath3.h" #include "xUtil.h" -#include "xBound.h" #include "xQuickCull.h" #include "xCollide.h" diff --git a/src/SB/Game/zNPCTypeAmbient.cpp b/src/SB/Game/zNPCTypeAmbient.cpp index d0a9017da..c1660ba48 100644 --- a/src/SB/Game/zNPCTypeAmbient.cpp +++ b/src/SB/Game/zNPCTypeAmbient.cpp @@ -1,7 +1,6 @@ #include #include "xVec3.h" -#include "xBound.h" #include "xMath3.h" #include "zGlobals.h" diff --git a/src/SB/Game/zNPCTypeCommon.cpp b/src/SB/Game/zNPCTypeCommon.cpp index feb5b013f..39cabea94 100644 --- a/src/SB/Game/zNPCTypeCommon.cpp +++ b/src/SB/Game/zNPCTypeCommon.cpp @@ -17,7 +17,6 @@ #include "xString.h" #include "xDebug.h" -#include "xBound.h" // Finish porting code from bfbbpc repo diff --git a/src/SB/Game/zParCmd.cpp b/src/SB/Game/zParCmd.cpp index b73c572c3..dd1269a54 100644 --- a/src/SB/Game/zParCmd.cpp +++ b/src/SB/Game/zParCmd.cpp @@ -6,6 +6,7 @@ #include "xParCmd.h" #include "xMath.h" +#include "xMathInlines.h" #include "xString.h" #include "zGlobals.h" diff --git a/src/SB/Game/zShrapnel.cpp b/src/SB/Game/zShrapnel.cpp index 3e1657251..9e08c04aa 100644 --- a/src/SB/Game/zShrapnel.cpp +++ b/src/SB/Game/zShrapnel.cpp @@ -2,6 +2,7 @@ #include "iModel.h" #include "xColor.h" +#include "xMathInlines.h" #include "xSnd.h" #include "xstransvc.h" @@ -22,33 +23,36 @@ static zFragProjectileAsset sCinProj; static S32 sNumActiveFrags; static RpAtomic* sCinModel; -static void(*sCinCB)(zFrag*, zFragAsset*); +static void (*sCinCB)(zFrag*, zFragAsset*); static zFrag* sCinFrag; -static void zShrapnel_DestructObjInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initOffset, void(*cb)(zFrag*, zFragAsset*)); -static void zShrapnel_BB03FloorInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initOffset, void(*cb)(zFrag*, zFragAsset*)); -static void zShrapnel_BB03FloorChildInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initOffset, void(*cb)(zFrag*, zFragAsset*)); -static void zShrapnel_GlobalRobotInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initOffset, void(*cb)(zFrag*, zFragAsset*)); -static void zShrapnel_SpongebobInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initOffset, void(*cb)(zFrag*, zFragAsset*)); - -static zShrapnelInitTable sShrapnelTable[6] = -{ - { "destruct_obj_shrapnel", zShrapnel_DestructObjInit, 0}, - { "bb03_floor_shrapnel", zShrapnel_BB03FloorInit, 0}, - { "bb03_floor_child_shrapnel", zShrapnel_BB03FloorChildInit, 0}, - { "allrobots_shrapnel", zShrapnel_GlobalRobotInit, 0}, - { "spongebob_shrapnel", zShrapnel_SpongebobInit, 0}, - { NULL, NULL, 0} +static void zShrapnel_DestructObjInit(zShrapnelAsset* shrap, xModelInstance* parent, + xVec3* initOffset, void (*cb)(zFrag*, zFragAsset*)); +static void zShrapnel_BB03FloorInit(zShrapnelAsset* shrap, xModelInstance* parent, + xVec3* initOffset, void (*cb)(zFrag*, zFragAsset*)); +static void zShrapnel_BB03FloorChildInit(zShrapnelAsset* shrap, xModelInstance* parent, + xVec3* initOffset, void (*cb)(zFrag*, zFragAsset*)); +static void zShrapnel_GlobalRobotInit(zShrapnelAsset* shrap, xModelInstance* parent, + xVec3* initOffset, void (*cb)(zFrag*, zFragAsset*)); +static void zShrapnel_SpongebobInit(zShrapnelAsset* shrap, xModelInstance* parent, + xVec3* initOffset, void (*cb)(zFrag*, zFragAsset*)); + +static zShrapnelInitTable sShrapnelTable[6] = { + { "destruct_obj_shrapnel", zShrapnel_DestructObjInit, 0 }, + { "bb03_floor_shrapnel", zShrapnel_BB03FloorInit, 0 }, + { "bb03_floor_child_shrapnel", zShrapnel_BB03FloorChildInit, 0 }, + { "allrobots_shrapnel", zShrapnel_GlobalRobotInit, 0 }, + { "spongebob_shrapnel", zShrapnel_SpongebobInit, 0 }, + { NULL, NULL, 0 } }; - zFrag* zFrag_Alloc(zFragType type) { if (sNumActiveFrags == 150) { return NULL; } - + zFrag* result = sFirstFreeFrag.next; if (result->prev != NULL) { @@ -128,7 +132,7 @@ void zShrapnel_GameInit() sLightningAddInfo.arc_height = 0.1f; sCinProj.type = eFragProjectile; - sCinProj.id = 0; + sCinProj.id = 0; sCinProj.parentID[0] = 0; sCinProj.parentID[1] = 0; sCinProj.lifetime = 0.0f; @@ -151,7 +155,6 @@ void zShrapnel_GameInit() sCinProj.scaleCurveID = 0; sCinProj.scaleCurve = NULL; sCinProj.gravity = 0.0f; - } void zShrapnel_ProjectileSceneInit(zFragProjectileAsset* asset) @@ -184,7 +187,7 @@ void zShrapnel_ParticleSceneInit(zFragParticleAsset* asset) void zShrapnel_SetShrapnelAssetInitCB(zShrapnelAsset* sasset) { sasset->initCB = zShrapnel_DefaultInit; - zShrapnelInitTable* curr = sShrapnelTable; + zShrapnelInitTable* curr = sShrapnelTable; while (curr->name != NULL) { @@ -240,7 +243,6 @@ void zShrapnel_Update(F32 dt) { zFrag_SoundManager(dt); } - } void zShrapnel_Reset() @@ -286,7 +288,8 @@ static void CinFragCB(zFrag* frag, zFragAsset* asset) } // equivalent -void zShrapnel_CinematicInit(zShrapnelAsset* shrap, RpAtomic* cinModel, RwMatrixTag* animMat, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)) +void zShrapnel_CinematicInit(zShrapnelAsset* shrap, RpAtomic* cinModel, RwMatrixTag* animMat, + xVec3* initVel, void (*cb)(zFrag*, zFragAsset*)) { if (cinModel == NULL || shrap == NULL || animMat == NULL) return; @@ -306,7 +309,7 @@ void zShrapnel_CinematicInit(zShrapnelAsset* shrap, RpAtomic* cinModel, RwMatrix else { model->Data = sCinModel; - xMat3x3Copy((xMat4x3*)model->Mat, &g_I3); + xMat3x3Copy((xMat4x3*)model->Mat, &g_I3); xVec3Copy((xVec3*)&model->Mat->pos, (xVec3*)&animMat->pos); for (S32 i = 1; i < model->BoneCount; i++) @@ -327,7 +330,8 @@ void zFragLoc_Setup(zFragLocation* loc, xModelInstance* parent) { if ((S32)(loc->type & 0xfffffffe) == 4) { - iModelTagSetup(&loc->info.tag, parent->Data, loc->info.tag.v.x, loc->info.tag.v.y, loc->info.tag.v.z); + iModelTagSetup(&loc->info.tag, parent->Data, loc->info.tag.v.x, loc->info.tag.v.y, + loc->info.tag.v.z); } } @@ -335,31 +339,31 @@ void zFragLoc_InitDir(zFragLocation* loc, xVec3* vec, xModelInstance* parent) { switch ((loc->type) & 0xfffffffe) { - case eFragLocBone: - xMat3x3RMulVec(vec, (xMat3x3*)parent->Mat, &loc->info.bone.offset); - break; - case eFragLocBoneLocal: - S32 index = loc->info.bone.index; - if (index >= parent->BoneCount) - { - index = 0; - } + case eFragLocBone: + xMat3x3RMulVec(vec, (xMat3x3*)parent->Mat, &loc->info.bone.offset); + break; + case eFragLocBoneLocal: + S32 index = loc->info.bone.index; + if (index >= parent->BoneCount) + { + index = 0; + } - if (index == 0) - { - xMat4x3Copy(&tmpMat, (xMat4x3*)parent->Mat); - xMat3x3RMulVec(vec, (xMat3x3*)parent->Mat, &loc->info.bone.offset); - } - else - { - xMat4x3 tmpMat; - xMat4x3Mul(&tmpMat, (xMat4x3*)(parent->Mat + index), (xMat4x3*)parent->Mat); - xMat3x3RMulVec(vec, (xMat3x3*)&tmpMat, &loc->info.bone.offset); - } - break; - case eFragLocTag: - iModelTagEval(parent->Data, &loc->info.tag, parent->Mat, vec); - break; + if (index == 0) + { + xMat4x3Copy(&tmpMat, (xMat4x3*)parent->Mat); + xMat3x3RMulVec(vec, (xMat3x3*)parent->Mat, &loc->info.bone.offset); + } + else + { + xMat4x3 tmpMat; + xMat4x3Mul(&tmpMat, (xMat4x3*)(parent->Mat + index), (xMat4x3*)parent->Mat); + xMat3x3RMulVec(vec, (xMat3x3*)&tmpMat, &loc->info.bone.offset); + } + break; + case eFragLocTag: + iModelTagEval(parent->Data, &loc->info.tag, parent->Mat, vec); + break; } } @@ -371,84 +375,84 @@ void zFrag_DefaultInit(zFrag* frag, zFragAsset* fasset) switch (fasset->type) { - case eFragProjectile: - zFragProjectileAsset* passet = (zFragProjectileAsset*)fasset; + case eFragProjectile: + zFragProjectileAsset* passet = (zFragProjectileAsset*)fasset; - frag->info.projectile.fasset = passet; - frag->update = zFrag_DefaultProjectileUpdate; + frag->info.projectile.fasset = passet; + frag->update = zFrag_DefaultProjectileUpdate; - if (passet->modelFile != NULL) + if (passet->modelFile != NULL) + { + frag->info.projectile.model = xModelInstanceAlloc(passet->modelFile, NULL, 0, 0, NULL); + } + else + { + frag->info.projectile.model = NULL; + } + + if (frag->info.projectile.model == NULL) + { + zFrag_Free(frag); + } + else if (frag->info.projectile.model != NULL) + { + if (frag->parent[0] != NULL && (passet->flags & 0x10) == 0) { - frag->info.projectile.model = xModelInstanceAlloc(passet->modelFile, NULL, 0, 0, NULL); + zFrag_ProjectileSetupPath(frag, passet); } - else + + frag->info.projectile.model->LightKit = globals.player.ent.lightKit; + frag->info.projectile.alpha = 1.0f; + frag->info.projectile.numBounces = 0; + frag->info.projectile.scale = passet->minScale; + + if (passet->scaleCurve != NULL) { - frag->info.projectile.model = NULL; + frag->info.projectile.scale *= xCurveAssetEvaluate(passet->scaleCurve, 0.0f); } + } + break; - if (frag->info.projectile.model == NULL) - { - zFrag_Free(frag); - } - else if (frag->info.projectile.model != NULL) - { - if (frag->parent[0] != NULL && (passet->flags & 0x10) == 0) - { - zFrag_ProjectileSetupPath(frag, passet); - } + case eFragLightning: + zFragLightningAsset* lasset = (zFragLightningAsset*)fasset; - frag->info.projectile.model->LightKit = globals.player.ent.lightKit; - frag->info.projectile.alpha = 1.0f; - frag->info.projectile.numBounces = 0; - frag->info.projectile.scale = passet->minScale; + frag->info.lightning.fasset = lasset; + frag->update = zFrag_DefaultLightningUpdate; - if (passet->scaleCurve != NULL) - { - frag->info.projectile.scale *= xCurveAssetEvaluate(passet->scaleCurve, 0.0f); - } - } - break; - - case eFragLightning: - zFragLightningAsset* lasset = (zFragLightningAsset*)fasset; - - frag->info.lightning.fasset = lasset; - frag->update = zFrag_DefaultLightningUpdate; - - if (frag->parent[0] != NULL && frag->parent[1] != NULL) - { - zFragLoc_Setup(&lasset->start, frag->parent[0]); - zFragLoc_Setup(&lasset->end, frag->parent[1]); - } - break; + if (frag->parent[0] != NULL && frag->parent[1] != NULL) + { + zFragLoc_Setup(&lasset->start, frag->parent[0]); + zFragLoc_Setup(&lasset->end, frag->parent[1]); + } + break; - case eFragParticle: - zFragParticleAsset* prasset = (zFragParticleAsset*)fasset; + case eFragParticle: + zFragParticleAsset* prasset = (zFragParticleAsset*)fasset; - frag->info.particle.fasset = prasset; - frag->update = zFrag_DefaultParticleUpdate; + frag->info.particle.fasset = prasset; + frag->update = zFrag_DefaultParticleUpdate; - if (frag->parent[0] != NULL) - { - zFragLoc_Setup(&prasset->source, frag->parent[0]); - zFragLoc_Setup(&prasset->vel, frag->parent[0]); - } - break; + if (frag->parent[0] != NULL) + { + zFragLoc_Setup(&prasset->source, frag->parent[0]); + zFragLoc_Setup(&prasset->vel, frag->parent[0]); + } + break; - case eFragSound: - zFragSoundAsset* sasset = (zFragSoundAsset*)fasset; + case eFragSound: + zFragSoundAsset* sasset = (zFragSoundAsset*)fasset; - frag->info.sound.fasset = sasset; - frag->update = zFrag_DefaultSoundUpdate; + frag->info.sound.fasset = sasset; + frag->update = zFrag_DefaultSoundUpdate; - if (frag->parent[0] != NULL) - { - zFragLoc_Setup(&sasset->source, frag->parent[0]); - zFragLoc_InitVec(&sasset->source, &frag->info.sound.location, frag->parent[0]); - } - break; - case eFragShockwave: - break; + if (frag->parent[0] != NULL) + { + zFragLoc_Setup(&sasset->source, frag->parent[0]); + zFragLoc_InitVec(&sasset->source, &frag->info.sound.location, frag->parent[0]); + } + break; + case eFragShockwave: + break; } } @@ -525,9 +529,11 @@ void zFrag_ParticleManager(F32 dt) void zFrag_ProjectileCollData(zFrag* frag) { xCollis colls; - + frag->info.projectile.tColl = 1e38f; - frag->info.projectile.path.initPos.y -= frag->info.projectile.model->Data->boundingSphere.radius * frag->info.projectile.parentScale; + frag->info.projectile.path.initPos.y -= + frag->info.projectile.model->Data->boundingSphere.radius * + frag->info.projectile.parentScale; xParabolaHitsEnv(&frag->info.projectile.path, globals.sceneCur->env, &colls); if ((colls.flags & 1) != 0) @@ -539,7 +545,9 @@ void zFrag_ProjectileCollData(zFrag* frag) { frag->info.projectile.tColl = 1e38f; } - frag->info.projectile.path.initPos.y += frag->info.projectile.model->Data->boundingSphere.radius * frag->info.projectile.parentScale; + frag->info.projectile.path.initPos.y += + frag->info.projectile.model->Data->boundingSphere.radius * + frag->info.projectile.parentScale; } void zFrag_DeleteProjectile(zFrag* frag) @@ -588,7 +596,7 @@ void zFrag_ProjectileManager(F32 dt) { frag->info.projectile.t = frag->info.projectile.t + dt; S32 killed = FALSE; - + if ((frag->info.projectile.fasset->flags & 1) != 0) { if (frag->info.projectile.t > frag->info.projectile.tColl) @@ -606,28 +614,35 @@ void zFrag_ProjectileManager(F32 dt) { xParabolaRecenter(&frag->info.projectile.path, frag->info.projectile.tColl); - percent = xVec3Dot(&frag->info.projectile.N, &frag->info.projectile.path.initVel); - xVec3AddScaled(&frag->info.projectile.path.initVel, &frag->info.projectile.N, + percent = + xVec3Dot(&frag->info.projectile.N, &frag->info.projectile.path.initVel); + xVec3AddScaled(&frag->info.projectile.path.initVel, + &frag->info.projectile.N, -(1.0f + frag->info.projectile.fasset->bounce) * percent); - xVec3AddScaled(&frag->info.projectile.path.initPos, &frag->info.projectile.path.initVel, + xVec3AddScaled(&frag->info.projectile.path.initPos, + &frag->info.projectile.path.initVel, frag->info.projectile.t - frag->info.projectile.tColl); frag->info.projectile.path.minTime = 0.0f; frag->info.projectile.path.maxTime = frag->lifetime; if ((frag->info.projectile.fasset->flags & 0x20) == 0) { - xVec3Cross(&frag->info.projectile.axis, &frag->info.projectile.N, &frag->info.projectile.path.initVel); - xVec3Normalize(&frag->info.projectile.axis, &frag->info.projectile.axis); + xVec3Cross(&frag->info.projectile.axis, &frag->info.projectile.N, + &frag->info.projectile.path.initVel); + xVec3Normalize(&frag->info.projectile.axis, + &frag->info.projectile.axis); xVec3Copy(&tanVel, &frag->info.projectile.path.initVel); - xVec3AddScaled(&tanVel, &frag->info.projectile.N, percent * frag->info.projectile.fasset->bounce); + xVec3AddScaled(&tanVel, &frag->info.projectile.N, + percent * frag->info.projectile.fasset->bounce); percent = xVec3Length(&tanVel); - frag->info.projectile.angVel = (percent / (frag->info.projectile.model->Data->boundingSphere.radius * - frag->info.projectile.parentScale)); + frag->info.projectile.angVel = + (percent / + (frag->info.projectile.model->Data->boundingSphere.radius * + frag->info.projectile.parentScale)); } zFrag_ProjectileCollData(frag); frag->info.projectile.t = 0.0f; - } } else if (frag->info.projectile.t > frag->info.projectile.path.maxTime) @@ -663,10 +678,13 @@ void zFrag_ProjectileManager(F32 dt) } xVec3Copy(&oldPos, (xVec3*)&frag->info.projectile.model->Mat->pos); - xVec3Copy((xVec3*)&frag->info.projectile.model->Mat->pos, &frag->info.projectile.path.initPos); - xVec3AddScaled((xVec3*)&frag->info.projectile.model->Mat->pos, &frag->info.projectile.path.initVel, frag->info.projectile.t); + xVec3Copy((xVec3*)&frag->info.projectile.model->Mat->pos, + &frag->info.projectile.path.initPos); + xVec3AddScaled((xVec3*)&frag->info.projectile.model->Mat->pos, + &frag->info.projectile.path.initVel, frag->info.projectile.t); frag->info.projectile.model->Mat->pos.y -= - frag->info.projectile.t * ((0.5f * frag->info.projectile.path.gravity) * frag->info.projectile.t); + frag->info.projectile.t * + ((0.5f * frag->info.projectile.path.gravity) * frag->info.projectile.t); if ((frag->info.projectile.fasset->flags & 0x20) != 0) { @@ -684,8 +702,10 @@ void zFrag_ProjectileManager(F32 dt) } else { - xMat3x3Rot(&spin, &frag->info.projectile.axis, dt * frag->info.projectile.angVel); - xMat3x3Mul((xMat3x3*)frag->info.projectile.model->Mat, (xMat3x3*)frag->info.projectile.model->Mat, &spin); + xMat3x3Rot(&spin, &frag->info.projectile.axis, + dt * frag->info.projectile.angVel); + xMat3x3Mul((xMat3x3*)frag->info.projectile.model->Mat, + (xMat3x3*)frag->info.projectile.model->Mat, &spin); } if ((frag->info.projectile.fasset->flags & 2) != 0) @@ -698,7 +718,8 @@ void zFrag_ProjectileManager(F32 dt) numBubbles = 1; } - zFX_SpawnBubbleTrail((xVec3*)&frag->info.projectile.model->Mat->pos, numBubbles); + zFX_SpawnBubbleTrail((xVec3*)&frag->info.projectile.model->Mat->pos, + numBubbles); } } } @@ -766,7 +787,8 @@ void zFrag_LightningManager(F32 dt) } else { - if ((lasset->start.type & eFragLocBoneUpdated) != 0 || (lasset->end.type & eFragLocBoneUpdated) != 0) + if ((lasset->start.type & eFragLocBoneUpdated) != 0 || + (lasset->end.type & eFragLocBoneUpdated) != 0) { if ((lasset->start.type & eFragLocBoneUpdated) != 0) { @@ -801,8 +823,9 @@ void zFrag_DefaultSoundUpdate(zFrag* frag, F32 param_2) zFragLoc_InitVec(&sasset->source, &frag->info.sound.location, frag->parent[0]); } - frag->info.sound.soundID = xSndPlay3D(sasset->assetID, 0.77f * sasset->volume, 0.0f, 0, 0, - &frag->info.sound.location, sasset->innerRadius, sasset->outerRadius, SND_CAT_GAME, 0.0f); + frag->info.sound.soundID = + xSndPlay3D(sasset->assetID, 0.77f * sasset->volume, 0.0f, 0, 0, &frag->info.sound.location, + sasset->innerRadius, sasset->outerRadius, SND_CAT_GAME, 0.0f); if (frag->prev != NULL) { @@ -856,12 +879,14 @@ void zFrag_ProjectileRenderer() // TODO } -static void zShrapnel_DestructObjInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)) +static void zShrapnel_DestructObjInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, + void (*cb)(zFrag*, zFragAsset*)) { // TODO } -static void zShrapnel_BB03FloorInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)) +static void zShrapnel_BB03FloorInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, + void (*cb)(zFrag*, zFragAsset*)) { // TODO } @@ -871,17 +896,20 @@ static void BB03FloorChildCB(zFrag* frag, zFragAsset* fasset) // TODO } -static void zShrapnel_BB03FloorChildInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)) +static void zShrapnel_BB03FloorChildInit(zShrapnelAsset* shrap, xModelInstance* parent, + xVec3* initVel, void (*cb)(zFrag*, zFragAsset*)) { zShrapnel_DefaultInit(shrap, parent, initVel, BB03FloorChildCB); } -static void zShrapnel_GlobalRobotInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)) +static void zShrapnel_GlobalRobotInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, + void (*cb)(zFrag*, zFragAsset*)) { // TODO } -static void zShrapnel_SpongebobInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)) +static void zShrapnel_SpongebobInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, + void (*cb)(zFrag*, zFragAsset*)) { // TODO }