diff --git a/.clang-format b/.clang-format index b0decf271..dedf1fd4a 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,4 @@ --- -Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveMacros: false diff --git a/src/SB/Core/gc/.clang-format b/src/SB/Core/gc/.clang-format new file mode 100644 index 000000000..1a0a0c028 --- /dev/null +++ b/src/SB/Core/gc/.clang-format @@ -0,0 +1,26 @@ +--- +BasedOnStyle: InheritParentConfig +IncludeBlocks: Regroup +SortIncludes: CaseSensitive +IncludeCategories: + # Hardware-specific core code + - Regex: '^"i' + Priority: 1 + # Core code + - Regex: '^"(x|containers)' + Priority: 2 + # Game code + - Regex: '^"z' + Priority: 3 + # RenderWare + - Regex: "^<(rw|rt|rp|world)" + Priority: 4 + # Dolphin SDK + - Regex: "^ #include +#include static U8 scratchBuffer[9120]; @@ -36,9 +35,9 @@ U32 iAnimBoneCount(void* RawData) } // non-matching: incorrect instruction order and regalloc -void iAnimBlend(F32 BlendFactor, F32 BlendRecip, U16* BlendTimeOffset, - F32* BoneTable, U32 BoneCount, xVec3* Tran1, xQuat* Quat1, xVec3* Tran2, - xQuat* Quat2, xVec3* TranDest, xQuat* QuatDest) +void iAnimBlend(F32 BlendFactor, F32 BlendRecip, U16* BlendTimeOffset, F32* BoneTable, + U32 BoneCount, xVec3* Tran1, xQuat* Quat1, xVec3* Tran2, xQuat* Quat2, + xVec3* TranDest, xQuat* QuatDest) { U32 i; U32 invert = 0; diff --git a/src/SB/Core/gc/iAnimSKB.cpp b/src/SB/Core/gc/iAnimSKB.cpp index 8dace6ef4..3abcc1a3b 100644 --- a/src/SB/Core/gc/iAnimSKB.cpp +++ b/src/SB/Core/gc/iAnimSKB.cpp @@ -1,7 +1,7 @@ #include "iAnimSKB.h" -#include #include +#include #include diff --git a/src/SB/Core/gc/iCollide.cpp b/src/SB/Core/gc/iCollide.cpp index 41f431106..2b40b9e58 100644 --- a/src/SB/Core/gc/iCollide.cpp +++ b/src/SB/Core/gc/iCollide.cpp @@ -1,11 +1,11 @@ #include "iCollide.h" -#include - #include "xMathInlines.h" #include + #include +#include static S32 sCollidingJSP = 0; static F32 cbath = 0; diff --git a/src/SB/Core/gc/iCollide.h b/src/SB/Core/gc/iCollide.h index 0db5cbe2f..2017a846d 100644 --- a/src/SB/Core/gc/iCollide.h +++ b/src/SB/Core/gc/iCollide.h @@ -1,10 +1,10 @@ #ifndef ICOLLIDE_H #define ICOLLIDE_H +#include "xCollide.h" +#include "xEnv.h" #include "xMath3.h" #include "xModel.h" -#include "xEnv.h" -#include "xCollide.h" void iBoxForModelLocal(xBox* o, const xModelInstance* m); void iBoxForModel(xBox* o, const xModelInstance* m); diff --git a/src/SB/Core/gc/iCollideFast.cpp b/src/SB/Core/gc/iCollideFast.cpp index 945d8caad..d00998a4f 100644 --- a/src/SB/Core/gc/iCollideFast.cpp +++ b/src/SB/Core/gc/iCollideFast.cpp @@ -3,4 +3,4 @@ void iCollideFastInit(xScene* sc) { return; -} \ No newline at end of file +} diff --git a/src/SB/Core/gc/iColor.h b/src/SB/Core/gc/iColor.h index c6e985c38..c798709cb 100644 --- a/src/SB/Core/gc/iColor.h +++ b/src/SB/Core/gc/iColor.h @@ -1,8 +1,9 @@ #ifndef ICOLOR_H #define ICOLOR_H +#include "xHud.h" + #include -#include struct iColor_tag { diff --git a/src/SB/Core/gc/iCutscene.cpp b/src/SB/Core/gc/iCutscene.cpp index 79011b3f0..1b53d9db8 100644 --- a/src/SB/Core/gc/iCutscene.cpp +++ b/src/SB/Core/gc/iCutscene.cpp @@ -1,12 +1,13 @@ #include "iCutscene.h" +#include "iModel.h" + +#include "xMath.h" #include "xpkrsvc.h" #include "xstransvc.h" -#include "xMath.h" - -#include "iModel.h" #include + #include U32 read_sizzze = 0; diff --git a/src/SB/Core/gc/iDraw.cpp b/src/SB/Core/gc/iDraw.cpp index cffc6a899..51d6a9c43 100644 --- a/src/SB/Core/gc/iDraw.cpp +++ b/src/SB/Core/gc/iDraw.cpp @@ -1,6 +1,7 @@ #include "iDraw.h" #include + #include void iDrawSetFBMSK(U32 abgr) diff --git a/src/SB/Core/gc/iEnv.cpp b/src/SB/Core/gc/iEnv.cpp index f377f2e15..399a92c7e 100644 --- a/src/SB/Core/gc/iEnv.cpp +++ b/src/SB/Core/gc/iEnv.cpp @@ -1,8 +1,8 @@ #include "iEnv.h" +#include "iCamera.h" #include "iModel.h" -#include "iCamera.h" #include "xMemMgr.h" static S32 sBeginDrawFX; diff --git a/src/SB/Core/gc/iEnv.h b/src/SB/Core/gc/iEnv.h index 94e4d5ace..bb090288e 100644 --- a/src/SB/Core/gc/iEnv.h +++ b/src/SB/Core/gc/iEnv.h @@ -3,8 +3,8 @@ #include "xJSP.h" -#include #include +#include struct iEnv { diff --git a/src/SB/Core/gc/iFMV.cpp b/src/SB/Core/gc/iFMV.cpp index 9838215ab..3d829b97e 100644 --- a/src/SB/Core/gc/iFMV.cpp +++ b/src/SB/Core/gc/iFMV.cpp @@ -8,10 +8,11 @@ #include "xFile.h" #include "xPar.h" -#include #include "zGlobals.h" +#include + // #include // FIXME: These should be in a RW header somewhere diff --git a/src/SB/Core/gc/iFMV.h b/src/SB/Core/gc/iFMV.h index e2e57bf4b..90d31027f 100644 --- a/src/SB/Core/gc/iFMV.h +++ b/src/SB/Core/gc/iFMV.h @@ -1,10 +1,10 @@ #ifndef IFMV_H #define IFMV_H -#include #include #include -#include +#include +#include #ifdef __cplusplus diff --git a/src/SB/Core/gc/iFX.h b/src/SB/Core/gc/iFX.h index 3f6f0fbcb..24291b39c 100644 --- a/src/SB/Core/gc/iFX.h +++ b/src/SB/Core/gc/iFX.h @@ -1,9 +1,10 @@ #ifndef IFX_H #define IFX_H -#include "types.h" #include +#include + RxPipeline* iFXanimUVCreatePipe(); #endif diff --git a/src/SB/Core/gc/iFile.h b/src/SB/Core/gc/iFile.h index 3958f7f74..0ec68805a 100644 --- a/src/SB/Core/gc/iFile.h +++ b/src/SB/Core/gc/iFile.h @@ -1,9 +1,10 @@ #ifndef IFILE_H #define IFILE_H -#include #include +#include + enum IFILE_READSECTOR_STATUS { IFILE_RDSTAT_NOOP, @@ -57,7 +58,7 @@ U32 iFileOpen(const char* name, S32 flags, tag_xFile* file); S32 iFileSeek(tag_xFile* file, S32 offset, S32 whence); U32 iFileRead(tag_xFile* file, void* buf, U32 size); S32 iFileReadAsync(tag_xFile* file, void* buf, U32 aSize, void (*callback)(tag_xFile*), - S32 priority); + S32 priority); IFILE_READSECTOR_STATUS iFileReadAsyncStatus(S32 key, S32* amtToFar); U32 iFileClose(tag_xFile* file); U32 iFileGetSize(tag_xFile* file); diff --git a/src/SB/Core/gc/iLight.h b/src/SB/Core/gc/iLight.h index d19b54df7..4c3453e2a 100644 --- a/src/SB/Core/gc/iLight.h +++ b/src/SB/Core/gc/iLight.h @@ -4,8 +4,8 @@ #include "xFColor.h" #include "xMath3.h" -#include #include +#include #define ILIGHT_TYPE_NONE 0 #define ILIGHT_TYPE_POINT 1 diff --git a/src/SB/Core/gc/iMath.cpp b/src/SB/Core/gc/iMath.cpp index 286d856ec..b2a2d7efa 100644 --- a/src/SB/Core/gc/iMath.cpp +++ b/src/SB/Core/gc/iMath.cpp @@ -1,6 +1,6 @@ #include "iMath.h" -#include +#include F32 isin(F32 x) { diff --git a/src/SB/Core/gc/iMath.h b/src/SB/Core/gc/iMath.h index d90af3582..5f8d8493a 100644 --- a/src/SB/Core/gc/iMath.h +++ b/src/SB/Core/gc/iMath.h @@ -1,8 +1,8 @@ #ifndef IMATH_H #define IMATH_H -#include #include +#include #ifdef __MWERKS__ #define iabs(x) (float)(__fabs((float)x)) diff --git a/src/SB/Core/gc/iMath3.h b/src/SB/Core/gc/iMath3.h index e69caf2b8..83c5deb1a 100644 --- a/src/SB/Core/gc/iMath3.h +++ b/src/SB/Core/gc/iMath3.h @@ -1,8 +1,6 @@ #ifndef IMATH3_H #define IMATH3_H -#include "xMath3.h" -#include "xIsect.h" #include "xRay3.h" #include diff --git a/src/SB/Core/gc/iMemMgr.cpp b/src/SB/Core/gc/iMemMgr.cpp index 7772094ba..edfa24b8c 100644 --- a/src/SB/Core/gc/iMemMgr.cpp +++ b/src/SB/Core/gc/iMemMgr.cpp @@ -1,11 +1,14 @@ #include "iMemMgr.h" + #include "iSystem.h" + #include "xMemMgr.h" -#include -#include #include +#include +#include + U32 mem_top_alloc; U32 mem_base_alloc; volatile OSHeapHandle the_heap; diff --git a/src/SB/Core/gc/iMemMgr.h b/src/SB/Core/gc/iMemMgr.h index fc67cea9f..64e3e781a 100644 --- a/src/SB/Core/gc/iMemMgr.h +++ b/src/SB/Core/gc/iMemMgr.h @@ -1,7 +1,8 @@ #ifndef IMEMMGR_H #define IMEMMGR_H -#include "dolphin/os/OSAlloc.h" +#include + #include extern U32 mem_base_alloc; diff --git a/src/SB/Core/gc/iMix.c b/src/SB/Core/gc/iMix.c index 3b8a4870b..a2d5b6bdd 100644 --- a/src/SB/Core/gc/iMix.c +++ b/src/SB/Core/gc/iMix.c @@ -1,6 +1,5 @@ -#include - #include +#include #include static MIXChannel __MIXChannel[64]; @@ -9,6 +8,7 @@ static int __MIXDvdStreamAttenCurrent; static int __MIXDvdStreamAttenUser; static u32 __MIXSoundMode; +// clang-format off u16 __MIXVolumeTable[] = { 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, @@ -206,8 +206,8 @@ S8 __MIXAIVolumeTable[] = 0x24, 0x28, 0x2D, 0x32, 0x39, 0x40, 0x47, 0x50, 0x5A, 0x65, 0x71, 0x7F, 0x8F, 0xA0, 0xB4, 0xCA, 0xE3, 0xFF - }; +// clang-format on static u16 __MIXGetVolume(int index) { @@ -224,26 +224,26 @@ static u16 __MIXGetVolume(int index) static void __MIXSetPan(MIXChannel* chan) { - int l = chan->pan; + int l = chan->pan; int b = chan->span; int r = 0x7f - l; int f = 0x7f - b; if (__MIXSoundMode == 3) { - chan->l = __MIX_DPL2_front[l]; - chan->r = __MIX_DPL2_front[r]; - chan->f = __MIX_DPL2_front[f]; - chan->b = __MIX_DPL2_front[b]; + chan->l = __MIX_DPL2_front[l]; + chan->r = __MIX_DPL2_front[r]; + chan->f = __MIX_DPL2_front[f]; + chan->b = __MIX_DPL2_front[b]; chan->l1 = __MIX_DPL2_rear[r]; chan->r1 = __MIX_DPL2_rear[l]; } else { - chan->l = __MIXPanTable[l]; - chan->r = __MIXPanTable[r]; - chan->f = __MIXPanTable[f]; - chan->b = __MIXPanTable[b]; + chan->l = __MIXPanTable[l]; + chan->r = __MIXPanTable[r]; + chan->f = __MIXPanTable[f]; + chan->b = __MIXPanTable[b]; } } @@ -298,20 +298,19 @@ void MIXInit() __MIXSoundMode = OSGetSoundMode(); } -void MIXInitChannel(AXVPB* p, u32 mode, int input, int auxA, int auxB, int pan, - int span, int fader) +void MIXInitChannel(AXVPB* p, u32 mode, int input, int auxA, int auxB, int pan, int span, int fader) { MIXChannel* chan = &__MIXChannel[p->index]; u16 mixerCtrl; chan->axvpb = p; - chan->mode = mode & 7; + chan->mode = mode & 7; chan->input = input; - chan->auxA = auxA; - chan->auxB = auxB; - chan->pan = pan; - chan->span = span; + chan->auxA = auxA; + chan->auxB = auxB; + chan->pan = pan; + chan->span = span; chan->fader = fader; __MIXSetPan(chan); @@ -330,9 +329,9 @@ void MIXInitChannel(AXVPB* p, u32 mode, int input, int auxA, int auxB, int pan, switch (__MIXSoundMode) { case 0: - chan->vL = __MIXGetVolume(chan->fader + chan->f); - chan->vR = __MIXGetVolume(chan->fader + chan->f); - chan->vS = __MIXGetVolume(chan->fader + chan->b); + chan->vL = __MIXGetVolume(chan->fader + chan->f); + chan->vR = __MIXGetVolume(chan->fader + chan->f); + chan->vS = __MIXGetVolume(chan->fader + chan->b); if (chan->mode & 1) { chan->vAL = __MIXGetVolume(chan->auxA + chan->f); @@ -394,8 +393,8 @@ void MIXInitChannel(AXVPB* p, u32 mode, int input, int auxA, int auxB, int pan, break; case 3: - chan->vL = __MIXGetVolume(chan->fader + chan->l + chan->f); - chan->vR = __MIXGetVolume(chan->fader + chan->r + chan->f); + chan->vL = __MIXGetVolume(chan->fader + chan->l + chan->f); + chan->vR = __MIXGetVolume(chan->fader + chan->r + chan->f); chan->vBL = __MIXGetVolume(chan->fader + chan->l1 + chan->b); chan->vBR = __MIXGetVolume(chan->fader + chan->r1 + chan->b); @@ -421,7 +420,7 @@ void MIXInitChannel(AXVPB* p, u32 mode, int input, int auxA, int auxB, int pan, int enabled = OSDisableInterrupts(); p->pb.ve.currentVolume = chan->v; - p->pb.ve.currentDelta = 0; + p->pb.ve.currentDelta = 0; if (p->pb.mix.vL = chan->vL) { @@ -574,9 +573,9 @@ void MIXUpdateSettings() if (__MIXChannel[i].mode & 0x80000000) { cond1 = 1; - __MIXChannel[i].vL = __MIXChannel[i].vL1; - __MIXChannel[i].vR = __MIXChannel[i].vR1; - __MIXChannel[i].vS = __MIXChannel[i].vS1; + __MIXChannel[i].vL = __MIXChannel[i].vL1; + __MIXChannel[i].vR = __MIXChannel[i].vR1; + __MIXChannel[i].vS = __MIXChannel[i].vS1; __MIXChannel[i].vAL = __MIXChannel[i].vAL1; __MIXChannel[i].vAR = __MIXChannel[i].vAR1; __MIXChannel[i].vAS = __MIXChannel[i].vAS1; @@ -768,7 +767,7 @@ void MIXUpdateSettings() axvpb->sync |= 0x12; } - if ( __MIXDvdStreamAttenUser > __MIXDvdStreamAttenCurrent) + if (__MIXDvdStreamAttenUser > __MIXDvdStreamAttenCurrent) { __MIXDvdStreamAttenCurrent++; AISetStreamVolLeft(__MIXAIVolumeTable[*((volatile int*)(&__MIXDvdStreamAttenCurrent))]); @@ -780,4 +779,4 @@ void MIXUpdateSettings() AISetStreamVolLeft(__MIXAIVolumeTable[*((volatile int*)(&__MIXDvdStreamAttenCurrent))]); AISetStreamVolRight(__MIXAIVolumeTable[__MIXDvdStreamAttenCurrent]); } -} \ No newline at end of file +} diff --git a/src/SB/Core/gc/iModel.cpp b/src/SB/Core/gc/iModel.cpp index 96f588e44..787607655 100644 --- a/src/SB/Core/gc/iModel.cpp +++ b/src/SB/Core/gc/iModel.cpp @@ -1,16 +1,18 @@ #include "iModel.h" -#include -#include -#include +#include "iAnim.h" +#include "iCamera.h" + +#include "xMathInlines.h" + #include +#include #include -#include #include -#include "iCamera.h" -#include "iAnim.h" -#include "xMathInlines.h" +#include +#include +#include #define MAX2(a, b) ((a) >= (b) ? (a) : (b)) #define MAX3(a, b, c) (MAX2((a), MAX2((b), (c)))) diff --git a/src/SB/Core/gc/iModel.h b/src/SB/Core/gc/iModel.h index 30f8fd80c..6e03eca6e 100644 --- a/src/SB/Core/gc/iModel.h +++ b/src/SB/Core/gc/iModel.h @@ -1,12 +1,11 @@ #ifndef IMODEL_H #define IMODEL_H -#include "xMath3.h" #include "xModel.h" -#include -#include #include +#include +#include void iModelInit(); static RpAtomic* FindAndInstanceAtomicCallback(RpAtomic* model, void* data); diff --git a/src/SB/Core/gc/iMorph.cpp b/src/SB/Core/gc/iMorph.cpp index 503d65ca4..b8e579d9d 100644 --- a/src/SB/Core/gc/iMorph.cpp +++ b/src/SB/Core/gc/iMorph.cpp @@ -1,7 +1,9 @@ #include "iMorph.h" + #include "iModel.h" -#include "rpusrdat.h" +#include + #include #include diff --git a/src/SB/Core/gc/iMorph.h b/src/SB/Core/gc/iMorph.h index 356071a94..0806fc1e3 100644 --- a/src/SB/Core/gc/iMorph.h +++ b/src/SB/Core/gc/iMorph.h @@ -1,10 +1,10 @@ #ifndef IMORPH_H #define IMORPH_H -#include "types.h" - -#include #include +#include + +#include struct DirtyMorph // total size: 0x20 { diff --git a/src/SB/Core/gc/iPad.cpp b/src/SB/Core/gc/iPad.cpp index 39b66ff5f..cacb27db6 100644 --- a/src/SB/Core/gc/iPad.cpp +++ b/src/SB/Core/gc/iPad.cpp @@ -1,10 +1,11 @@ -#include -#include - #include "xTRC.h" + #include "zGlobals.h" -#include +#include +#include + +#include extern xGlobals* xglobals; extern zGlobals globals; diff --git a/src/SB/Core/gc/iParMgr.cpp b/src/SB/Core/gc/iParMgr.cpp index bd79a77f0..5eb706d9b 100644 --- a/src/SB/Core/gc/iParMgr.cpp +++ b/src/SB/Core/gc/iParMgr.cpp @@ -1,10 +1,13 @@ #include "iParMgr.h" + +#include "xstransvc.h" + #include "zGlobals.h" -#include -#include #include +#include + tagiRenderArrays gRenderArr; tagiRenderInput gRenderBuffer; @@ -22,7 +25,7 @@ void iParMgrRender() void iRenderInit() { gRenderBuffer.m_mode = 0; - gRenderBuffer.m_indexCount = 0; + gRenderBuffer.m_indexCount = 0; gRenderBuffer.m_vertexCount = 0; gRenderBuffer.m_vertexTypeSize = 0x24; gRenderBuffer.m_index = &gRenderArr.m_index[0]; @@ -34,7 +37,7 @@ void iRenderSetCameraViewMatrix(xMat4x3* m) { if ((m == NULL) && (globals.camera.lo_cam != NULL)) { - gRenderBuffer.m_camViewMatrix = *(xMat4x3 *)(*(int *)(*(int*)RwEngineInstance + 4) + 0x10); + gRenderBuffer.m_camViewMatrix = *(xMat4x3*)(*(int*)(*(int*)RwEngineInstance + 4) + 0x10); } else { @@ -48,16 +51,19 @@ void iRenderFlush() { if (gRenderBuffer.m_vertexCount > 0) { - iRenderTrianglesImmediate(gRenderBuffer.m_vertexType, gRenderBuffer.m_vertexTypeSize, gRenderBuffer.m_vertex, gRenderBuffer.m_vertexCount, gRenderBuffer.m_index, gRenderBuffer.m_indexCount); + iRenderTrianglesImmediate(gRenderBuffer.m_vertexType, gRenderBuffer.m_vertexTypeSize, + gRenderBuffer.m_vertex, gRenderBuffer.m_vertexCount, + gRenderBuffer.m_index, gRenderBuffer.m_indexCount); } - gRenderBuffer.m_indexCount = 0; + gRenderBuffer.m_indexCount = 0; gRenderBuffer.m_vertexCount = 0; } -void iRenderTrianglesImmediate(S32 vertType, S32 vertTypeSize, void* data, S32 dataSize, U16* index, S32 indexSize) +void iRenderTrianglesImmediate(S32 vertType, S32 vertTypeSize, void* data, S32 dataSize, U16* index, + S32 indexSize) { - if (RwIm3DTransform((RwIm3DVertex *)data, dataSize, NULL, 1) != NULL) + if (RwIm3DTransform((RwIm3DVertex*)data, dataSize, NULL, 1) != NULL) { if (indexSize != 0) { @@ -69,7 +75,6 @@ void iRenderTrianglesImmediate(S32 vertType, S32 vertTypeSize, void* data, S32 d } RwIm3DEnd(); } - } static void iRenderPushFlat(xPar* p, xParCmdTex* tex); @@ -78,7 +83,7 @@ void iParMgrRenderParSys_QuadStreak(void* data, xParGroup* ps) { xPar* idx = ps->m_root; iRenderSetCameraViewMatrix(NULL); - RwTexture* texture = (RwTexture *)xSTFindAsset(*(U32 *)(*(S32 *)((S32)data + 0x10) + 0x10), NULL); + RwTexture* texture = (RwTexture*)xSTFindAsset(*(U32*)(*(S32*)((S32)data + 0x10) + 0x10), NULL); if (texture != NULL) { RwRaster* raster = texture->raster; @@ -94,18 +99,20 @@ void iParMgrRenderParSys_QuadStreak(void* data, xParGroup* ps) for (; idx != NULL; idx = idx->m_next) { - iRenderPushFlat(idx, *(xParCmdTex **)((S32)ps + 0x20)); + iRenderPushFlat(idx, *(xParCmdTex**)((S32)ps + 0x20)); } iRenderFlush(); } -void iParMgrRenderParSys_Static(void*, xParGroup*) { } +void iParMgrRenderParSys_Static(void*, xParGroup*) +{ +} void iParMgrRenderParSys_Flat(void* data, xParGroup* ps) { xPar* idx = ps->m_root; iRenderSetCameraViewMatrix(NULL); - RwTexture* texture = (RwTexture *)xSTFindAsset(*(U32 *)(*(S32 *)((S32)data + 0x10) + 0x10), NULL); + RwTexture* texture = (RwTexture*)xSTFindAsset(*(U32*)(*(S32*)((S32)data + 0x10) + 0x10), NULL); if (texture != NULL) { RwRaster* raster = texture->raster; @@ -116,7 +123,7 @@ void iParMgrRenderParSys_Flat(void* data, xParGroup* ps) } for (; idx != NULL; idx = idx->m_next) { - iRenderPushFlat(idx, *(xParCmdTex **)((S32)ps + 0x20)); + iRenderPushFlat(idx, *(xParCmdTex**)((S32)ps + 0x20)); } iRenderFlush(); -} \ No newline at end of file +} diff --git a/src/SB/Core/gc/iParMgr.h b/src/SB/Core/gc/iParMgr.h index ce6920843..4428d2964 100644 --- a/src/SB/Core/gc/iParMgr.h +++ b/src/SB/Core/gc/iParMgr.h @@ -1,7 +1,6 @@ #ifndef IPARMGR_H #define IPARMGR_H -#include "xMath3.h" #include "xParGroup.h" #include @@ -17,7 +16,7 @@ struct tagiRenderArrays struct tagiRenderInput { // total size: 0x80 - public: +public: U16* m_index; // offset 0x0, size 0x4 RxObjSpace3DVertex* m_vertex; // offset 0x4, size 0x4 F32* m_vertexTZ; // offset 0x8, size 0x4 diff --git a/src/SB/Core/gc/iScrFX.cpp b/src/SB/Core/gc/iScrFX.cpp index e3e415c60..82f7bfe26 100644 --- a/src/SB/Core/gc/iScrFX.cpp +++ b/src/SB/Core/gc/iScrFX.cpp @@ -1,6 +1,7 @@ #include "iScrFX.h" -#include "rwplcore.h" +#include + #include static U32 sMotionBlurEnabled; diff --git a/src/SB/Core/gc/iScrFX.h b/src/SB/Core/gc/iScrFX.h index 8eb6d3695..c8a68634f 100644 --- a/src/SB/Core/gc/iScrFX.h +++ b/src/SB/Core/gc/iScrFX.h @@ -1,9 +1,10 @@ #ifndef ISCRFX_H #define ISCRFX_H -#include #include +#include + struct _iMotionBlurData { S32 motionBlurAlpha; diff --git a/src/SB/Core/gc/iSnd.cpp b/src/SB/Core/gc/iSnd.cpp index 642ab8c0c..c417eb483 100644 --- a/src/SB/Core/gc/iSnd.cpp +++ b/src/SB/Core/gc/iSnd.cpp @@ -1,21 +1,23 @@ #include "iSnd.h" -#include "dolphin/ai.h" -#include "dolphin/os.h" -#include "dolphin/os/OSAlloc.h" -#include "dolphin/os/OSCache.h" #include "iMemMgr.h" #include "iTRC.h" + +#include "xMath.h" #include "xSnd.h" #include "xstransvc.h" -#include "xMath.h" +#include #include #include #include #include +#include +#include +#include #include +#include #include u32 aram_array[40]; @@ -613,16 +615,20 @@ bool iSndIsPlaying(U32 assetID) { if (gSnd.voice[i].assetID == assetID) { - if(streams[i].vinf.flags & 0xC000 && (streams[i].vinf.flags & 0x82) == 0) { + if (streams[i].vinf.flags & 0xC000 && (streams[i].vinf.flags & 0x82) == 0) + { return true; } return false; } } - for(S32 i = 0; i < 0x3a; i++) { - if(gSnd.voice[i+6].assetID == assetID) { - if(voices[i].flags & 0x4 && (voices[i].flags & 0x8) == 0) { + for (S32 i = 0; i < 0x3a; i++) + { + if (gSnd.voice[i + 6].assetID == assetID) + { + if (voices[i].flags & 0x4 && (voices[i].flags & 0x8) == 0) + { return true; } return false; @@ -633,10 +639,12 @@ bool iSndIsPlaying(U32 assetID) bool iSndIsPlaying(U32 assetID, U32 parid) { - for(U32 i = 0; i < 0x40; i++) { - if((assetID == 0 || gSnd.voice[i].assetID == assetID) && gSnd.voice[i].parentID == parid) + for (U32 i = 0; i < 0x40; i++) + { + if ((assetID == 0 || gSnd.voice[i].assetID == assetID) && gSnd.voice[i].parentID == parid) { - if(iSndIsPlaying(gSnd.voice[i].assetID)) { + if (iSndIsPlaying(gSnd.voice[i].assetID)) + { return true; }; } @@ -646,7 +654,6 @@ bool iSndIsPlaying(U32 assetID, U32 parid) bool iSndIsPlayingByHandle(U32 handle) { - if (handle == 0) { return false; @@ -656,17 +663,18 @@ bool iSndIsPlayingByHandle(U32 handle) { if (gSnd.voice[i].sndID == handle) { - return (streams[i].vinf.flags & 0xC000 && (streams[i].vinf.flags & 0x82) == 0); + return (streams[i].vinf.flags & 0xC000 && (streams[i].vinf.flags & 0x82) == 0); } } - for(S32 i = 0; i < 0x3a; i++) { - if(gSnd.voice[i+6].sndID == handle) { + for (S32 i = 0; i < 0x3a; i++) + { + if (gSnd.voice[i + 6].sndID == handle) + { return (voices[i].flags & 0x4 && (voices[i].flags & 0x8) == 0); } } return false; - } U32 iVolFromX(F32 param1) diff --git a/src/SB/Core/gc/iSystem.cpp b/src/SB/Core/gc/iSystem.cpp index 4f5274cb6..aaef37fd5 100644 --- a/src/SB/Core/gc/iSystem.cpp +++ b/src/SB/Core/gc/iSystem.cpp @@ -1,24 +1,24 @@ #include "iSystem.h" -#include - -#include - -#include "rpmatfx.h" -#include "rpptank.h" -#include "rpskin.h" -#include "rpusrdat.h" +#include "iFMV.h" +#include "iMemMgr.h" +#include "iTRC.h" #include "xDebug.h" -#include "xSnd.h" #include "xFX.h" +#include "xFile.h" #include "xShadow.h" +#include "xSnd.h" #include "xstransvc.h" -#include "iMemMgr.h" -#include "iSystem.h" -#include "iFMV.h" -#include "iTRC.h" +#include +#include +#include +#include +#include + +#include +#include // .bss static RwMemoryFunctions MemoryFunctions; diff --git a/src/SB/Core/gc/iSystem.h b/src/SB/Core/gc/iSystem.h index 3e1b567e8..a63708ab0 100644 --- a/src/SB/Core/gc/iSystem.h +++ b/src/SB/Core/gc/iSystem.h @@ -1,9 +1,10 @@ #ifndef ISYSTEM_H #define ISYSTEM_H +#include + #include "rwplcore.h" #include -#include extern "C" { void* malloc(U32 __size); diff --git a/src/SB/Core/gc/iTRC.cpp b/src/SB/Core/gc/iTRC.cpp index 826e6c07f..277b5476d 100644 --- a/src/SB/Core/gc/iTRC.cpp +++ b/src/SB/Core/gc/iTRC.cpp @@ -1,19 +1,20 @@ #include "iTRC.h" -#include -#include #include #include #include +#include #include #include +#include #include #include -#include -#include #include -#include #include +#include + +#include +#include #define FONT_MATRIX_ID 0x1E #define TEXTBOX_MAX_TEXT_LENGTH 256 diff --git a/src/SB/Core/gc/iTRC.h b/src/SB/Core/gc/iTRC.h index 245fa57d3..8027b7bbe 100644 --- a/src/SB/Core/gc/iTRC.h +++ b/src/SB/Core/gc/iTRC.h @@ -1,18 +1,19 @@ #ifndef ITRC_H #define ITRC_H -#include -#include +#include "xPad.h" + +#include +#include +#include #include #include #include #include -#include -#include -#include #include +#include -#include "xPad.h" +#include struct _tagiTRCPadInfo { diff --git a/src/SB/Core/gc/iTime.cpp b/src/SB/Core/gc/iTime.cpp index 0035caf89..ed74a21b9 100644 --- a/src/SB/Core/gc/iTime.cpp +++ b/src/SB/Core/gc/iTime.cpp @@ -1,9 +1,11 @@ #include "iTime.h" + #include "iSystem.h" -#include #include +#include + static iTime sStartupTime; static F32 sGameTime; diff --git a/src/SB/Core/gc/isavegame.cpp b/src/SB/Core/gc/isavegame.cpp index cfdab72b2..d8b380aba 100644 --- a/src/SB/Core/gc/isavegame.cpp +++ b/src/SB/Core/gc/isavegame.cpp @@ -1,15 +1,16 @@ #include "isavegame.h" -#include "zGlobals.h" +#include "iFile.h" +#include "iSystem.h" +#include "iTRC.h" #include "xMemMgr.h" #include "xSnd.h" -#include "iFile.h" -#include "iSystem.h" -#include "iTRC.h" +#include "zGlobals.h" #include + #include #include #include diff --git a/src/SB/Core/gc/isavegame.h b/src/SB/Core/gc/isavegame.h index e18c5d46f..9c2e813f8 100644 --- a/src/SB/Core/gc/isavegame.h +++ b/src/SB/Core/gc/isavegame.h @@ -1,10 +1,10 @@ #ifndef ISAVEGAME_H #define ISAVEGAME_H -#include - #include +#include + enum en_ISG_IOMODE { ISG_IOMODE_READ = 0x1, diff --git a/src/SB/Core/gc/ngcrad3d.c b/src/SB/Core/gc/ngcrad3d.c index b891c4d23..d1cf51660 100644 --- a/src/SB/Core/gc/ngcrad3d.c +++ b/src/SB/Core/gc/ngcrad3d.c @@ -1,7 +1,9 @@ #include "ngcrad3d.h" -#include #include "iFMV.h" + +#include + #include static int D3D_surface_type[5]; diff --git a/src/SB/Core/x/.clang-format b/src/SB/Core/x/.clang-format new file mode 100644 index 000000000..c842a5322 --- /dev/null +++ b/src/SB/Core/x/.clang-format @@ -0,0 +1,26 @@ +--- +BasedOnStyle: InheritParentConfig +IncludeBlocks: Regroup +SortIncludes: CaseSensitive +IncludeCategories: + # Core code + - Regex: '^"(x|containers)' + Priority: 1 + # Hardware-specific core code + - Regex: '^"i' + Priority: 2 + # Game code + - Regex: '^"z' + Priority: 3 + # RenderWare + - Regex: "^<(rw|rt|rp|world)" + Priority: 4 + # Dolphin SDK + - Regex: "^ #include "xMemMgr.h" +#include + struct tier_queue_allocator { struct block_data diff --git a/src/SB/Core/x/iCamera.cpp b/src/SB/Core/x/iCamera.cpp index b147d1295..66b5cd5bc 100644 --- a/src/SB/Core/x/iCamera.cpp +++ b/src/SB/Core/x/iCamera.cpp @@ -2,8 +2,8 @@ #include "xShadow.h" -#include "iScrFX.h" #include "iMath.h" +#include "iScrFX.h" #include "zGlobals.h" diff --git a/src/SB/Core/x/iCamera.h b/src/SB/Core/x/iCamera.h index 7a701dbc1..8e717e128 100644 --- a/src/SB/Core/x/iCamera.h +++ b/src/SB/Core/x/iCamera.h @@ -1,13 +1,15 @@ #ifndef ICAMERA_H #define ICAMERA_H -#include -#include - #include "xMath3.h" + #include "iEnv.h" #include "iTime.h" +#include + +#include + struct iFogParams { RwFogType type; diff --git a/src/SB/Core/x/xAnim.cpp b/src/SB/Core/x/xAnim.cpp index 198549529..8a6137b17 100644 --- a/src/SB/Core/x/xAnim.cpp +++ b/src/SB/Core/x/xAnim.cpp @@ -1,21 +1,21 @@ #include "xAnim.h" -#include "iAnim.h" -#include "iModel.h" - -#include "xMemMgr.h" #include "xMath.h" +#include "xMemMgr.h" #include "xModel.h" #include "xMorph.h" #include "xString.h" -#include -#include -#include -#include +#include "iAnim.h" +#include "iModel.h" #include + +#include #include +#include +#include +#include static xMemPool sxAnimTempTranPool; @@ -2093,7 +2093,7 @@ void xAnimPoolCB(xMemPool* pool, void* data) clone->Pool = pool; } -#define ADD_4_BITS(x) (((x)&1) + (((x) >> 1) & 1) + (((x) >> 2) & 1) + (((x) >> 3) & 1)) +#define ADD_4_BITS(x) (((x) & 1) + (((x) >> 1) & 1) + (((x) >> 2) & 1) + (((x) >> 3) & 1)) void xAnimPoolInit(xMemPool* pool, U32 count, U32 singles, U32 blendFlags, U32 effectMax) { effectMax += effectMax & 1; diff --git a/src/SB/Core/x/xAnim.h b/src/SB/Core/x/xAnim.h index 6ce266d36..700536baa 100644 --- a/src/SB/Core/x/xAnim.h +++ b/src/SB/Core/x/xAnim.h @@ -1,11 +1,11 @@ #ifndef XANIM_H #define XANIM_H -#include - #include "xMath3.h" #include "xMemMgr.h" +#include + typedef struct xAnimState; typedef struct xAnimTransition; typedef struct xAnimTransitionList; @@ -231,7 +231,11 @@ inline F32 xAnimFileRawTime(xAnimFile* data, float time) return data->TimeOffset + time; } -#define xAnimTableNewStateDefault(table, name, flags, userFlags) xAnimTableNewState((table), (name), (flags), (userFlags), 1.0f, NULL, NULL, 0.0f, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL) -#define xAnimTableNewTransitionDefault(table, source, dest, priority, blendRecip) xAnimTableNewTransition((table), (source), (dest), NULL, NULL, 0x10, 0, 0.0f, 0.0f, (priority), 0, (blendRecip), NULL) +#define xAnimTableNewStateDefault(table, name, flags, userFlags) \ + xAnimTableNewState((table), (name), (flags), (userFlags), 1.0f, NULL, NULL, 0.0f, NULL, NULL, \ + xAnimDefaultBeforeEnter, NULL, NULL) +#define xAnimTableNewTransitionDefault(table, source, dest, priority, blendRecip) \ + xAnimTableNewTransition((table), (source), (dest), NULL, NULL, 0x10, 0, 0.0f, 0.0f, \ + (priority), 0, (blendRecip), NULL) #endif diff --git a/src/SB/Core/x/xBehaveGoalSimple.h b/src/SB/Core/x/xBehaveGoalSimple.h index 860e26345..c377ad40c 100644 --- a/src/SB/Core/x/xBehaveGoalSimple.h +++ b/src/SB/Core/x/xBehaveGoalSimple.h @@ -1,8 +1,6 @@ #ifndef XBEHAVEGOALSIMPLE_H #define XBEHAVEGOALSIMPLE_H -#include "xFactory.h" -#include "xRMemData.h" #include "xBehaviour.h" struct xGoalEmpty : xGoal diff --git a/src/SB/Core/x/xBehaveMgr.cpp b/src/SB/Core/x/xBehaveMgr.cpp index 7d3abcf20..4326d2e02 100644 --- a/src/SB/Core/x/xBehaveMgr.cpp +++ b/src/SB/Core/x/xBehaveMgr.cpp @@ -1,7 +1,10 @@ #include "xBehaveMgr.h" + #include "xBehaveGoalSimple.h" #include "xutil.h" +#include + static S32 g_modinit; static xBehaveMgr* g_behavmgr; diff --git a/src/SB/Core/x/xBehaviour.h b/src/SB/Core/x/xBehaviour.h index 30cbd8011..eea844076 100644 --- a/src/SB/Core/x/xBehaviour.h +++ b/src/SB/Core/x/xBehaviour.h @@ -1,9 +1,8 @@ #ifndef XBEHAVIOUR_H #define XBEHAVIOUR_H -#include "xBase.h" -#include "xListItem.h" #include "xFactory.h" +#include "xListItem.h" #include "xScene.h" enum en_GOALSTATE diff --git a/src/SB/Core/x/xBound.cpp b/src/SB/Core/x/xBound.cpp index bbb98c891..b21b6c20a 100644 --- a/src/SB/Core/x/xBound.cpp +++ b/src/SB/Core/x/xBound.cpp @@ -1,8 +1,8 @@ #include "xBound.h" +#include "xDraw.h" #include "xMath.h" #include "xMathInlines.h" -#include "xDraw.h" #include "iMath.h" diff --git a/src/SB/Core/x/xBound.h b/src/SB/Core/x/xBound.h index 1bfd58463..d2ebb1e9d 100644 --- a/src/SB/Core/x/xBound.h +++ b/src/SB/Core/x/xBound.h @@ -1,8 +1,6 @@ #ifndef XBOUND_H #define XBOUND_H -#include "xQuickCull.h" -#include "xMath3.h" #include "xCollide.h" // Size: 0x4C diff --git a/src/SB/Core/x/xCM.cpp b/src/SB/Core/x/xCM.cpp index 58b9970b2..18d13b5bf 100644 --- a/src/SB/Core/x/xCM.cpp +++ b/src/SB/Core/x/xCM.cpp @@ -1,11 +1,13 @@ #include "xCM.h" + +#include "xDebug.h" #include "xEvent.h" #include "xFont.h" -#include "xstransvc.h" -#include "xDebug.h" #include "xVec3.h" +#include "xstransvc.h" #include + #include #include diff --git a/src/SB/Core/x/xCM.h b/src/SB/Core/x/xCM.h index a136991d5..9bd88f8bb 100644 --- a/src/SB/Core/x/xCM.h +++ b/src/SB/Core/x/xCM.h @@ -1,9 +1,7 @@ #ifndef XCM_H #define XCM_H -#include #include "xColor.h" -#include "xBase.h" struct xCreditsData { diff --git a/src/SB/Core/x/xCamera.cpp b/src/SB/Core/x/xCamera.cpp index ca929d706..b85a68549 100644 --- a/src/SB/Core/x/xCamera.cpp +++ b/src/SB/Core/x/xCamera.cpp @@ -1,18 +1,19 @@ #include "xCamera.h" -#include "xstransvc.h" +#include "xCollideFast.h" #include "xMath.h" #include "xMathInlines.h" #include "xScene.h" -#include "xCollideFast.h" #include "xScrFx.h" -#include "zGlobals.h" -#include "zGrid.h" +#include "xstransvc.h" #include "iMath.h" -#include -#include +#include "zGlobals.h" +#include "zGrid.h" + +#include +#include #define CAMERAFX_ZOOM_MODE_0 0 #define CAMERAFX_ZOOM_MODE_1 1 diff --git a/src/SB/Core/x/xCamera.h b/src/SB/Core/x/xCamera.h index a1e72caf3..ec1f53147 100644 --- a/src/SB/Core/x/xCamera.h +++ b/src/SB/Core/x/xCamera.h @@ -1,12 +1,7 @@ #ifndef XCAMERA_H #define XCAMERA_H -#include "iCamera.h" - -#include "xBase.h" -#include "xMath3.h" #include "xBound.h" -#include "xMath2.h" #include diff --git a/src/SB/Core/x/xClimate.cpp b/src/SB/Core/x/xClimate.cpp index 4b42249c5..d46e58ad0 100644 --- a/src/SB/Core/x/xClimate.cpp +++ b/src/SB/Core/x/xClimate.cpp @@ -1,15 +1,17 @@ #include "xClimate.h" -#include -#include #include "xMath.h" #include "xMath3.h" #include "xString.h" #include "xVec3.h" + #include "zGlobals.h" #include "zParEmitter.h" #include "zParPTank.h" +#include +#include + _tagClimate* sClimate; const float snow_life = 3.0f; diff --git a/src/SB/Core/x/xClimate.h b/src/SB/Core/x/xClimate.h index abcfe981b..9f517f192 100644 --- a/src/SB/Core/x/xClimate.h +++ b/src/SB/Core/x/xClimate.h @@ -1,8 +1,6 @@ #ifndef XCLIMATE_H #define XCLIMATE_H -#include -#include "xVec3.h" #include "zParEmitter.h" struct xEnvAsset; diff --git a/src/SB/Core/x/xClumpColl.cpp b/src/SB/Core/x/xClumpColl.cpp index c319f0697..07d20d740 100644 --- a/src/SB/Core/x/xClumpColl.cpp +++ b/src/SB/Core/x/xClumpColl.cpp @@ -817,73 +817,73 @@ xClumpCollBSPTree* xClumpColl_ForAllIntersections(xClumpCollBSPTree* tree, switch (intersection->type) { - case rpINTERSECTPOINT: - return NULL; - case rpINTERSECTLINE: - { - PolyLineTestParam isData; - RwLine* line = &intersection->t.line; - F32 recip; + case rpINTERSECTPOINT: + return NULL; + case rpINTERSECTLINE: + { + PolyLineTestParam isData; + RwLine* line = &intersection->t.line; + F32 recip; - isData.start = line->start; - RwV3dSubMacro(&isData.delta, &line->end, &line->start); - isData.cbParam = &cbParam; - isData.line = *line; + isData.start = line->start; + RwV3dSubMacro(&isData.delta, &line->end, &line->start); + isData.cbParam = &cbParam; + isData.line = *line; - recip = (isData.delta.x != 0.0f) ? (1.0f / isData.delta.x) : 0.0f; - isData.grad.dydx = isData.delta.y * recip; - isData.grad.dzdx = isData.delta.z * recip; + recip = (isData.delta.x != 0.0f) ? (1.0f / isData.delta.x) : 0.0f; + isData.grad.dydx = isData.delta.y * recip; + isData.grad.dzdx = isData.delta.z * recip; - recip = (isData.delta.y != 0.0f) ? (1.0f / isData.delta.y) : 0.0f; - isData.grad.dxdy = isData.delta.x * recip; - isData.grad.dzdy = isData.delta.z * recip; + recip = (isData.delta.y != 0.0f) ? (1.0f / isData.delta.y) : 0.0f; + isData.grad.dxdy = isData.delta.x * recip; + isData.grad.dzdy = isData.delta.z * recip; - recip = (isData.delta.z != 0.0f) ? (1.0f / isData.delta.z) : 0.0f; - isData.grad.dxdz = isData.delta.x * recip; - isData.grad.dydz = isData.delta.y * recip; + recip = (isData.delta.z != 0.0f) ? (1.0f / isData.delta.z) : 0.0f; + isData.grad.dxdz = isData.delta.x * recip; + isData.grad.dydz = isData.delta.y * recip; - xClumpColl_ForAllLineLeafNodeIntersections(tree, line, &isData.grad, - LeafNodeLinePolyIntersect, &isData); + xClumpColl_ForAllLineLeafNodeIntersections(tree, line, &isData.grad, + LeafNodeLinePolyIntersect, &isData); - return tree; - } - case rpINTERSECTSPHERE: - { - PolyTestParam isData; - TestSphere testSphere; + return tree; + } + case rpINTERSECTSPHERE: + { + PolyTestParam isData; + TestSphere testSphere; - isData.bbox.inf = isData.bbox.sup = intersection->t.sphere.center; - isData.bbox.inf.x -= intersection->t.sphere.radius; - isData.bbox.inf.y -= intersection->t.sphere.radius; - isData.bbox.inf.z -= intersection->t.sphere.radius; - isData.bbox.sup.x += intersection->t.sphere.radius; - isData.bbox.sup.y += intersection->t.sphere.radius; - isData.bbox.sup.z += intersection->t.sphere.radius; + isData.bbox.inf = isData.bbox.sup = intersection->t.sphere.center; + isData.bbox.inf.x -= intersection->t.sphere.radius; + isData.bbox.inf.y -= intersection->t.sphere.radius; + isData.bbox.inf.z -= intersection->t.sphere.radius; + isData.bbox.sup.x += intersection->t.sphere.radius; + isData.bbox.sup.y += intersection->t.sphere.radius; + isData.bbox.sup.z += intersection->t.sphere.radius; - testSphere.sphere = &intersection->t.sphere; + testSphere.sphere = &intersection->t.sphere; - isData.leafTestData = &testSphere; - isData.cbParam = &cbParam; + isData.leafTestData = &testSphere; + isData.cbParam = &cbParam; - testSphere.recipRadius = 1.0f / testSphere.sphere->radius; + testSphere.recipRadius = 1.0f / testSphere.sphere->radius; - xClumpColl_ForAllBoxLeafNodeIntersections(tree, &isData.bbox, LeafNodeSpherePolyIntersect, - &isData); + xClumpColl_ForAllBoxLeafNodeIntersections(tree, &isData.bbox, LeafNodeSpherePolyIntersect, + &isData); - return tree; - } - case rpINTERSECTBOX: - { - PolyTestParam isData; + return tree; + } + case rpINTERSECTBOX: + { + PolyTestParam isData; - isData.bbox = intersection->t.box; - isData.cbParam = &cbParam; + isData.bbox = intersection->t.box; + isData.cbParam = &cbParam; - xClumpColl_ForAllBoxLeafNodeIntersections(tree, &isData.bbox, LeafNodeBoxPolyIntersect, - &isData); + xClumpColl_ForAllBoxLeafNodeIntersections(tree, &isData.bbox, LeafNodeBoxPolyIntersect, + &isData); - return tree; - } + return tree; + } } return NULL; diff --git a/src/SB/Core/x/xClumpColl.h b/src/SB/Core/x/xClumpColl.h index 01edc9c90..35c894d6a 100644 --- a/src/SB/Core/x/xClumpColl.h +++ b/src/SB/Core/x/xClumpColl.h @@ -1,12 +1,12 @@ #ifndef XCLUMPCOLL_H #define XCLUMPCOLL_H -#include - -#include -#include #include +#include #include +#include + +#include struct xClumpCollBSPBranchNode { diff --git a/src/SB/Core/x/xCollide.cpp b/src/SB/Core/x/xCollide.cpp index af85f0772..54f9571fc 100644 --- a/src/SB/Core/x/xCollide.cpp +++ b/src/SB/Core/x/xCollide.cpp @@ -1,14 +1,18 @@ #include "xCollide.h" + #include "xCollideFast.h" -#include "zSurface.h" -#include "iCollide.h" -#include "iMath3.h" -#include "rpcollis.h" -#include "rpcollbsptree.h" -#include "rpworld.h" #include "xMathInlines.h" #include "xScene.h" + +#include "iCollide.h" +#include "iMath3.h" + #include "zGrid.h" +#include "zSurface.h" + +#include +#include +#include #include #include diff --git a/src/SB/Core/x/xCollide.h b/src/SB/Core/x/xCollide.h index 3805878bd..f605a4f75 100644 --- a/src/SB/Core/x/xCollide.h +++ b/src/SB/Core/x/xCollide.h @@ -4,6 +4,7 @@ #include "xEnv.h" #include "xModel.h" #include "xQuickCull.h" + #include "iMath3.h" #define k_HIT_IT ((U32)(1 << 0)) diff --git a/src/SB/Core/x/xCollideFast.cpp b/src/SB/Core/x/xCollideFast.cpp index 32b6f97d3..2043a8711 100644 --- a/src/SB/Core/x/xCollideFast.cpp +++ b/src/SB/Core/x/xCollideFast.cpp @@ -1,7 +1,9 @@ #include "xCollideFast.h" -#include "iCollideFast.h" + #include "xMath.h" +#include "iCollideFast.h" + #include void xCollideFastInit(xScene* sc) diff --git a/src/SB/Core/x/xCollideFast.h b/src/SB/Core/x/xCollideFast.h index 46867a6f2..c4f6e161f 100644 --- a/src/SB/Core/x/xCollideFast.h +++ b/src/SB/Core/x/xCollideFast.h @@ -1,8 +1,6 @@ #ifndef XCOLLIDEFAST_H #define XCOLLIDEFAST_H -#include "xMath3.h" -#include "xRay3.h" #include "xScene.h" void xCollideFastInit(xScene* sc); diff --git a/src/SB/Core/x/xCutscene.cpp b/src/SB/Core/x/xCutscene.cpp index 107ded1dd..8cf93883f 100644 --- a/src/SB/Core/x/xCutscene.cpp +++ b/src/SB/Core/x/xCutscene.cpp @@ -1,19 +1,20 @@ #include "xCutscene.h" -#include "xSnd.h" + #include "xAnim.h" #include "xDebug.h" #include "xModelBucket.h" #include "xSnd.h" +#include "iAnim.h" #include "iCutscene.h" #include "iModel.h" + #include "zCamera.h" #include "zGlobals.h" -#include "iAnim.h" -#include +#include #include -#include +#include xCutscene sActiveCutscene; U32 sCutTocCount; @@ -345,9 +346,10 @@ void xCutscene_SetCamera(xCutscene* csn, xCamera* cam) U32 count; - F32 camFOV = 114.59155f * - std::atan((12.7f * (keys[0].aperture[0] * lerp + keys[1].aperture[0] * invlerp)) / - (keys[0].focal * lerp + keys[1].focal * invlerp)); + F32 camFOV = + 114.59155f * + std::atan((12.7f * (keys[0].aperture[0] * lerp + keys[1].aperture[0] * invlerp)) / + (keys[0].focal * lerp + keys[1].focal * invlerp)); cam->mat = camMat; gCameraLastFov = 0.0f; xCameraSetFOV(&xglobals->camera, camFOV); diff --git a/src/SB/Core/x/xCutscene.h b/src/SB/Core/x/xCutscene.h index b16597c58..4e37aa8d5 100644 --- a/src/SB/Core/x/xCutscene.h +++ b/src/SB/Core/x/xCutscene.h @@ -1,9 +1,8 @@ #ifndef XCUTSCENE_H #define XCUTSCENE_H -#include "xFile.h" -#include "rpworld.h" #include "xCamera.h" +#include "xFile.h" #define XCUTSCENEDATA_TYPE_RW_MODEL 1 #define XCUTSCENEDATA_TYPE_ANIMATION 2 @@ -13,7 +12,8 @@ #define XCUTSCENEDATA_TYPE_JDELTAMODEL 6 #define XCUTSCENEDATA_TYPE_JDELTAANIM 7 -struct xCutsceneAnimHdr { +struct xCutsceneAnimHdr +{ U32 RootIndex; F32 Translate[3]; }; diff --git a/src/SB/Core/x/xCutsceneMgr.h b/src/SB/Core/x/xCutsceneMgr.h index 922b87b63..c22e2335d 100644 --- a/src/SB/Core/x/xCutsceneMgr.h +++ b/src/SB/Core/x/xCutsceneMgr.h @@ -1,7 +1,6 @@ #ifndef XCUTSCENEMGR_H #define XCUTSCENEMGR_H -#include "xBase.h" #include "xCutscene.h" struct xCutsceneMgrAsset : xBaseAsset diff --git a/src/SB/Core/x/xDebug.cpp b/src/SB/Core/x/xDebug.cpp index 416cc1db6..4d24c463a 100644 --- a/src/SB/Core/x/xDebug.cpp +++ b/src/SB/Core/x/xDebug.cpp @@ -46,7 +46,7 @@ void __deadstripped_xDebug(F32 f, iColor_tag col) F32 x = NSCREENX(f); F32 y = NSCREENY(f); - + xfont font; font = xfont::create(0, f, f, f, col, r1); xtextbox textbox = xtextbox::create(font, r1, 0, f, f, f, f); diff --git a/src/SB/Core/x/xDebug.h b/src/SB/Core/x/xDebug.h index 97923ccf9..54fa80b07 100644 --- a/src/SB/Core/x/xDebug.h +++ b/src/SB/Core/x/xDebug.h @@ -91,7 +91,7 @@ struct tweak_callback }; void xprintf(const char* msg, ...); -S32 xDebugModeAdd(const char* mode, void(*debugFunc)()); +S32 xDebugModeAdd(const char* mode, void (*debugFunc)()); void xDebugInit(); void xDebugUpdate(); void xDebugExit(); @@ -119,13 +119,12 @@ inline void xDebugAddTweak(const char*, const char*, const tweak_callback*, void { } - inline void xDebugAddFlagTweak(const char*, U32*, U32, const tweak_callback*, void*, U32) { } -inline void xDebugAddSelectTweak(const char*, U32*, const char**, const U32*, U32, const tweak_callback*, - void*, U32) +inline void xDebugAddSelectTweak(const char*, U32*, const char**, const U32*, U32, + const tweak_callback*, void*, U32) { } diff --git a/src/SB/Core/x/xDecal.cpp b/src/SB/Core/x/xDecal.cpp index 10038c3f6..0e5660202 100644 --- a/src/SB/Core/x/xDecal.cpp +++ b/src/SB/Core/x/xDecal.cpp @@ -1,15 +1,16 @@ #include "xDecal.h" -#include - +#include "containers.h" #include "xString.h" #include "xstransvc.h" + #include "zGlobals.h" -#include "containers.h" -namespace +#include + +namespace { - static xDecalEmitter * active_emitters[32]; + static xDecalEmitter* active_emitters[32]; static U32 active_emitters_size; void register_emitter(xDecalEmitter* emitter) @@ -22,7 +23,7 @@ namespace } F32 choose_greatest(F32 a, F32 b, F32 c); -} // end of anonymous namespace +} // end of anonymous namespace void xDecalInit() { @@ -67,7 +68,6 @@ void xDecalEmitter::set_texture(const char* name) set_texture(xStrHash(name)); } - void xDecalEmitter::set_texture(U32 id) { RwTexture* tex; @@ -107,15 +107,19 @@ void xDecalEmitter::refresh_config() { this->cfg.texture.cols = 1; } - + this->cfg.texture.uv[0].x = range_limit(this->cfg.texture.uv[0].x, 0.0f, 0.99f); this->cfg.texture.uv[0].y = range_limit(this->cfg.texture.uv[0].y, 0.0f, 0.99f); - this->cfg.texture.uv[1].x = range_limit(this->cfg.texture.uv[1].x, 0.01f + this->cfg.texture.uv[0].x, 1.0f); - this->cfg.texture.uv[1].y = range_limit(this->cfg.texture.uv[1].y, 0.01f + this->cfg.texture.uv[0].y, 1.0f); + this->cfg.texture.uv[1].x = + range_limit(this->cfg.texture.uv[1].x, 0.01f + this->cfg.texture.uv[0].x, 1.0f); + this->cfg.texture.uv[1].y = + range_limit(this->cfg.texture.uv[1].y, 0.01f + this->cfg.texture.uv[0].y, 1.0f); this->texture.units = this->cfg.texture.rows * this->cfg.texture.cols; - this->texture.size.x = (this->cfg.texture.uv[1].x - this->cfg.texture.uv[0].x) / this->cfg.texture.cols; - this->texture.size.y = (this->cfg.texture.uv[1].y - this->cfg.texture.uv[0].y) / this->cfg.texture.rows; + this->texture.size.x = + (this->cfg.texture.uv[1].x - this->cfg.texture.uv[0].x) / this->cfg.texture.cols; + this->texture.size.y = + (this->cfg.texture.uv[1].y - this->cfg.texture.uv[0].y) / this->cfg.texture.rows; this->texture.isize.assign(1.0f / this->texture.size.x, 1.0f / this->texture.size.y); } @@ -148,7 +152,8 @@ void xDecalEmitter::emit(const xMat4x3& mat, S32 texture_index) else { udata.mat = mat; - F32 greatest_length = choose_greatest(udata.mat.right.length(), udata.mat.up.length(), udata.mat.at.length()); + F32 greatest_length = + choose_greatest(udata.mat.right.length(), udata.mat.up.length(), udata.mat.at.length()); udata.cull_size = greatest_length * 0.5f; } @@ -156,7 +161,7 @@ void xDecalEmitter::emit(const xMat4x3& mat, S32 texture_index) { texture_index = this->select_texture_unit(); } - + udata.u = texture_index % this->cfg.texture.rows; udata.v = texture_index / this->cfg.texture.rows; } @@ -176,7 +181,7 @@ namespace } return greatest; } -} // end of anonymous namespace +} // end of anonymous namespace void xDecalEmitter::emit(const xMat4x3& mat, const xVec3& scale, S32 texture_index) { @@ -201,14 +206,15 @@ void xDecalEmitter::emit(const xMat4x3& mat, const xVec3& scale, S32 texture_ind udata.mat.right *= scale.x; udata.mat.up *= scale.y; udata.mat.at *= scale.z; - udata.cull_size = 0.5f * choose_greatest(udata.mat.right.length(), udata.mat.up.length(), udata.mat.at.length()); + udata.cull_size = 0.5f * choose_greatest(udata.mat.right.length(), udata.mat.up.length(), + udata.mat.at.length()); } if (texture_index < 0 || texture_index > (S32)this->texture.units) { texture_index = this->select_texture_unit(); } - + udata.u = texture_index % this->cfg.texture.rows; udata.v = texture_index / this->cfg.texture.rows; } @@ -218,44 +224,44 @@ namespace void lerp(iColor_tag& out, F32 t, const iColor_tag& a, const iColor_tag& b); void lerp(U8& out, F32 t, U8 a, U8 b); void lerp(F32& out, F32 t, F32 a, F32 b); -} // end of anonymous namespace +} // end of anonymous namespace void xDecalEmitter::update(F32 dt) { // Unused from DWARF // xVec4* _loc; // r2 // F32 par_dist; // r1 - + debug_update(dt); F32 dage = dt * this->ilife; - + ptank_pool__color_mat_uv2 pool; pool.reset(); - + pool.rs.texture = this->texture.asset; pool.rs.src_blend = this->cfg.blend_src; pool.rs.dst_blend = this->cfg.blend_dst; pool.rs.flags = this->cfg.flags & 0x1; this->curve_index = 0; - + static_queue::iterator it = this->units.begin(); while (it != this->units.end()) { unit_data& unit = *it; unit.age += dage; - + if (unit.age >= 1.0f) { break; } - + update_frac(unit); curve_node& node0 = this->curve[unit.curve_index]; - curve_node& node1 = this->curve[unit.curve_index+1]; - + curve_node& node1 = this->curve[unit.curve_index + 1]; + F32 scale; lerp(scale, unit.frac, node0.scale, node1.scale); - + *((F32*)&unit.mat.pos.z + 1) = unit.cull_size * scale; pool.next(); if (!pool.valid()) @@ -278,7 +284,7 @@ namespace { out = a + (b - a) * t; } -} +} // namespace void xDecalEmitter::update_frac(xDecalEmitter::unit_data& unit) { @@ -299,9 +305,11 @@ void xDecalEmitter::update_frac(xDecalEmitter::unit_data& unit) unit.frac = (1.0f / this->curve[this->curve_index + 1].time) * (unit.age - curve_time); } -void xDecalEmitter::get_render_data(const xDecalEmitter::unit_data& unit, F32 scale, iColor_tag& color, xMat4x3& mat, xVec2& uv0, xVec2& uv1) +void xDecalEmitter::get_render_data(const xDecalEmitter::unit_data& unit, F32 scale, + iColor_tag& color, xMat4x3& mat, xVec2& uv0, xVec2& uv1) { - lerp(color, unit.frac, this->curve[unit.curve_index].color, this->curve[unit.curve_index + 1].color); + lerp(color, unit.frac, this->curve[unit.curve_index].color, + this->curve[unit.curve_index + 1].color); if (this->cfg.flags & 0x2) { @@ -341,7 +349,7 @@ namespace { out = ((F32)a + ((F32)b - (F32)a) * t) + 0.5f; } -} +} // namespace S32 xDecalEmitter::select_texture_unit() { @@ -356,5 +364,5 @@ S32 xDecalEmitter::select_texture_unit() case TM_DEFAULT: default: return 0; - } + } } diff --git a/src/SB/Core/x/xDecal.h b/src/SB/Core/x/xDecal.h index 4ea98f23d..5ca258e4a 100644 --- a/src/SB/Core/x/xDecal.h +++ b/src/SB/Core/x/xDecal.h @@ -1,15 +1,17 @@ #ifndef XDECAL_H #define XDECAL_H +#include "containers.h" #include "xMath2.h" #include "xMath3.h" -#include "containers.h" -#include "iColor.h" #include "xPtankPool.h" -#include +#include "iColor.h" + #include +#include + struct xDecalEmitter { enum texture_mode @@ -81,7 +83,8 @@ struct xDecalEmitter void emit(const xMat4x3& mat, const xVec3& scale, S32 texture_index); void update(F32 dt); void update_frac(xDecalEmitter::unit_data& unit); - void get_render_data(const xDecalEmitter::unit_data& unit, F32 scale, iColor_tag& color, xMat4x3& mat, xVec2& uv0, xVec2& uv1); + void get_render_data(const xDecalEmitter::unit_data& unit, F32 scale, iColor_tag& color, + xMat4x3& mat, xVec2& uv0, xVec2& uv1); S32 select_texture_unit(); bool need_update() const diff --git a/src/SB/Core/x/xDraw.h b/src/SB/Core/x/xDraw.h index d2b23cbb2..9e608c51d 100644 --- a/src/SB/Core/x/xDraw.h +++ b/src/SB/Core/x/xDraw.h @@ -1,9 +1,10 @@ #ifndef XDRAW_H #define XDRAW_H -#include "iColor.h" #include "xMath3.h" +#include "iColor.h" + void xDrawSetColor(iColor_tag); inline void xDrawLine(const xVec3* a, const xVec3* b) { diff --git a/src/SB/Core/x/xEnt.cpp b/src/SB/Core/x/xEnt.cpp index 903687ac4..9a6ae9d1b 100644 --- a/src/SB/Core/x/xEnt.cpp +++ b/src/SB/Core/x/xEnt.cpp @@ -1,26 +1,26 @@ #include "xEnt.h" #include "xEvent.h" -#include "xString.h" -#include "xGroup.h" -#include "xstransvc.h" #include "xFX.h" -#include "xShadow.h" -#include "xMathInlines.h" +#include "xGroup.h" #include "xMath.h" +#include "xMathInlines.h" +#include "xShadow.h" +#include "xString.h" +#include "xstransvc.h" + +#include "iCollide.h" +#include "iMath.h" +#include "iMath3.h" +#include "iModel.h" #include "zBase.h" -#include "zPlatform.h" -#include "zEntDestructObj.h" #include "zCollGeom.h" -#include "zSurface.h" -#include "zLight.h" +#include "zEntDestructObj.h" #include "zGrid.h" - -#include "iMath3.h" -#include "iCollide.h" -#include "iModel.h" -#include "iMath.h" +#include "zLight.h" +#include "zPlatform.h" +#include "zSurface.h" #include diff --git a/src/SB/Core/x/xEnt.h b/src/SB/Core/x/xEnt.h index 8c029551e..82299fff7 100644 --- a/src/SB/Core/x/xEnt.h +++ b/src/SB/Core/x/xEnt.h @@ -1,18 +1,8 @@ #ifndef XENT_H #define XENT_H -#include -#include -#include - -#include "xBase.h" -#include "xMath3.h" -#include "xModel.h" -#include "xLightKit.h" -#include "xGrid.h" -#include "xBound.h" #include "xFFX.h" -#include "xCollide.h" +#include "xGrid.h" struct xEntAsset : xBaseAsset { diff --git a/src/SB/Core/x/xEntBoulder.cpp b/src/SB/Core/x/xEntBoulder.cpp index e4a5288d1..5dac77841 100644 --- a/src/SB/Core/x/xEntBoulder.cpp +++ b/src/SB/Core/x/xEntBoulder.cpp @@ -1,10 +1,11 @@ -#include "xCollide.h" #include "xEntBoulder.h" + +#include "xCollide.h" #include "xFX.h" #include "xGroup.h" #include "xMarkerAsset.h" -#include "xMathInlines.h" #include "xMath3.h" +#include "xMathInlines.h" #include "xNPCBasic.h" #include "xShadow.h" #include "xVec3.h" @@ -18,6 +19,7 @@ #include "zPlatform.h" #include "zSurface.h" +#include #include static U32 sBubbleStreakID = 0xDEAD; diff --git a/src/SB/Core/x/xEntBoulder.h b/src/SB/Core/x/xEntBoulder.h index ed667f88c..b79c051ee 100644 --- a/src/SB/Core/x/xEntBoulder.h +++ b/src/SB/Core/x/xEntBoulder.h @@ -1,7 +1,6 @@ #ifndef XENTBOULDER_H #define XENTBOULDER_H -#include "xEnt.h" #include "xDynAsset.h" #include "xShadowSimple.h" diff --git a/src/SB/Core/x/xEntDrive.cpp b/src/SB/Core/x/xEntDrive.cpp index 712f54025..67323a033 100644 --- a/src/SB/Core/x/xEntDrive.cpp +++ b/src/SB/Core/x/xEntDrive.cpp @@ -1,5 +1,6 @@ #include "xEntDrive.h" +#include "xEnt.h" #include "xMath.h" #include "xMathInlines.h" diff --git a/src/SB/Core/x/xEntDrive.h b/src/SB/Core/x/xEntDrive.h index bd9c14663..82b8c9033 100644 --- a/src/SB/Core/x/xEntDrive.h +++ b/src/SB/Core/x/xEntDrive.h @@ -1,7 +1,6 @@ #ifndef XENTDRIVE_H #define XENTDRIVE_H -#include "xEnt.h" #include "xCollide.h" struct xEntDrive diff --git a/src/SB/Core/x/xEntMotion.cpp b/src/SB/Core/x/xEntMotion.cpp index a7bada0b9..5b0740106 100644 --- a/src/SB/Core/x/xEntMotion.cpp +++ b/src/SB/Core/x/xEntMotion.cpp @@ -1,11 +1,12 @@ +#include "xEntMotion.h" + +#include "xColor.h" #include "xDebug.h" #include "xDraw.h" -#include "xEntMotion.h" #include "xEntMotionAsset.h" #include "xMath.h" #include "xMath3.h" #include "xMathInlines.h" - #include "xPad.h" #include "xScene.h" #include "xSpline.h" diff --git a/src/SB/Core/x/xEntMotion.h b/src/SB/Core/x/xEntMotion.h index d8371c887..2f9f93e56 100644 --- a/src/SB/Core/x/xEntMotion.h +++ b/src/SB/Core/x/xEntMotion.h @@ -4,7 +4,6 @@ #include "xEnt.h" #include "xEntMotionAsset.h" #include "xMovePoint.h" -#include "xColor.h" #define XENTMOTION_TYPE_ER 0 // Extend / Retract #define XENTMOTION_TYPE_ORB 1 // Orbital diff --git a/src/SB/Core/x/xEntMotionAsset.h b/src/SB/Core/x/xEntMotionAsset.h index 24f84b531..008ba1208 100644 --- a/src/SB/Core/x/xEntMotionAsset.h +++ b/src/SB/Core/x/xEntMotionAsset.h @@ -1,7 +1,5 @@ #pragma once -#include "xVec3.h" - enum { k_XENTMOTIONMECH_SLIDE, diff --git a/src/SB/Core/x/xEnv.h b/src/SB/Core/x/xEnv.h index 0fc4dee11..03b1f8b09 100644 --- a/src/SB/Core/x/xEnv.h +++ b/src/SB/Core/x/xEnv.h @@ -1,9 +1,10 @@ #ifndef XENV_H #define XENV_H -#include "iEnv.h" -#include "xLightKit.h" #include "xBase.h" +#include "xLightKit.h" + +#include "iEnv.h" struct xEnv { diff --git a/src/SB/Core/x/xEvent.cpp b/src/SB/Core/x/xEvent.cpp index e1b07c7fb..70623de9c 100644 --- a/src/SB/Core/x/xEvent.cpp +++ b/src/SB/Core/x/xEvent.cpp @@ -1,11 +1,12 @@ -#include - #include "xEvent.h" + #include "xString.h" #include "xstransvc.h" #include "zScene.h" +#include + char zEventLogBuf[256][20]; void zEntEvent(char* to, U32 toEvent) @@ -29,8 +30,7 @@ void zEntEvent(U32 toID, U32 toEvent) } } -void zEntEvent(U32 toID, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, - F32 toParam3) +void zEntEvent(U32 toID, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, F32 toParam3) { xBase* sendTo; F32 toParam[4]; @@ -53,8 +53,7 @@ void zEntEvent(xBase* to, U32 toEvent) zEntEvent(NULL, 0, to, toEvent, NULL, NULL, 0); } -void zEntEvent(xBase* to, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, - F32 toParam3) +void zEntEvent(xBase* to, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, F32 toParam3) { F32 toParam[4]; diff --git a/src/SB/Core/x/xEvent.h b/src/SB/Core/x/xEvent.h index 87b739b34..84303ffd9 100644 --- a/src/SB/Core/x/xEvent.h +++ b/src/SB/Core/x/xEvent.h @@ -552,11 +552,9 @@ enum en_xEventTags // Oddly, all the zEntEvent functions are in xEvent, not zEvent void zEntEvent(char* to, U32 toEvent); void zEntEvent(U32 toID, U32 toEvent); -void zEntEvent(U32 toID, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, - F32 toParam3); +void zEntEvent(U32 toID, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, F32 toParam3); void zEntEvent(xBase* to, U32 toEvent); -void zEntEvent(xBase* to, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, - F32 toParam3); +void zEntEvent(xBase* to, U32 toEvent, F32 toParam0, F32 toParam1, F32 toParam2, F32 toParam3); void zEntEvent(xBase* to, U32 toEvent, const F32* toParam); void zEntEvent(xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget); void zEntEvent(xBase* from, xBase* to, U32 toEvent); diff --git a/src/SB/Core/x/xFFX.cpp b/src/SB/Core/x/xFFX.cpp index 8179d65eb..68d52eaad 100644 --- a/src/SB/Core/x/xFFX.cpp +++ b/src/SB/Core/x/xFFX.cpp @@ -1,7 +1,8 @@ #include "xFFX.h" + #include "xEnt.h" -#include "xMemMgr.h" #include "xMathInlines.h" +#include "xMemMgr.h" #include diff --git a/src/SB/Core/x/xFX.cpp b/src/SB/Core/x/xFX.cpp index 370538b4e..f02226c7a 100644 --- a/src/SB/Core/x/xFX.cpp +++ b/src/SB/Core/x/xFX.cpp @@ -1,23 +1,25 @@ #include "xFX.h" -#include "iFX.h" -#include "iMath.h" - #include "xDebug.h" -#include "xstransvc.h" #include "xScrFx.h" +#include "xstransvc.h" + +#include "iDraw.h" +#include "iFX.h" +#include "iMath.h" #include "zEntPickup.h" -#include "zParEmitter.h" -#include "zSurface.h" #include "zFX.h" #include "zGlobals.h" +#include "zParEmitter.h" #include "zRumble.h" +#include "zSurface.h" -#include #include -#include #include +#include + +#include // no clue why this file is so out of order diff --git a/src/SB/Core/x/xFX.h b/src/SB/Core/x/xFX.h index 009740fb8..5f4fd21c8 100644 --- a/src/SB/Core/x/xFX.h +++ b/src/SB/Core/x/xFX.h @@ -1,14 +1,14 @@ #ifndef XFX_H #define XFX_H -#include "xMath3.h" #include "containers.h" +#include "xMath3.h" + #include "iColor.h" -#include "iDraw.h" #include "iModel.h" -#include #include +#include class xModelInstance; diff --git a/src/SB/Core/x/xFactory.cpp b/src/SB/Core/x/xFactory.cpp index a98ec731d..b9a501cfe 100644 --- a/src/SB/Core/x/xFactory.cpp +++ b/src/SB/Core/x/xFactory.cpp @@ -1,8 +1,9 @@ #include "xFactory.h" + #include "xMemMgr.h" -#include #include +#include xFactory::xFactory(S32 maxTypes) { diff --git a/src/SB/Core/x/xFactory.h b/src/SB/Core/x/xFactory.h index b3ed128c4..07630acd8 100644 --- a/src/SB/Core/x/xFactory.h +++ b/src/SB/Core/x/xFactory.h @@ -1,10 +1,9 @@ #ifndef XFACTORY_H #define XFACTORY_H -#include - #include "xRMemData.h" -#include "xordarray.h" + +#include struct xFactoryInst : RyzMemData { diff --git a/src/SB/Core/x/xFog.cpp b/src/SB/Core/x/xFog.cpp index e0a2f4417..3482e7548 100644 --- a/src/SB/Core/x/xFog.cpp +++ b/src/SB/Core/x/xFog.cpp @@ -1,4 +1,5 @@ #include "xFog.h" + #include "xEvent.h" #include "iCamera.h" diff --git a/src/SB/Core/x/xFog.h b/src/SB/Core/x/xFog.h index d7fd9f17f..4b46a4958 100644 --- a/src/SB/Core/x/xFog.h +++ b/src/SB/Core/x/xFog.h @@ -2,7 +2,6 @@ #define XFOG_H #include "xEnt.h" -#include "xBase.h" #include diff --git a/src/SB/Core/x/xFont.cpp b/src/SB/Core/x/xFont.cpp index 81f125c22..b99c3e2b1 100644 --- a/src/SB/Core/x/xFont.cpp +++ b/src/SB/Core/x/xFont.cpp @@ -1,19 +1,20 @@ #include "xFont.h" +#include "xColor.h" #include "xMath.h" -#include "xstransvc.h" #include "xModel.h" -#include "xColor.h" -#include "xTimer.h" -#include "xTextAsset.h" #include "xModelBucket.h" +#include "xTextAsset.h" +#include "xTimer.h" +#include "xstransvc.h" #include "iTime.h" + #include "zScene.h" -#include +#include #include -#include +#include /* xtextbox flags */ diff --git a/src/SB/Core/x/xFont.h b/src/SB/Core/x/xFont.h index d6a35a50c..b089a66db 100644 --- a/src/SB/Core/x/xFont.h +++ b/src/SB/Core/x/xFont.h @@ -1,10 +1,10 @@ #ifndef XFONT_H #define XFONT_H -#include "xMath2.h" -#include "iColor.h" #include "xString.h" +#include "iColor.h" + #include struct xfont diff --git a/src/SB/Core/x/xGlobals.h b/src/SB/Core/x/xGlobals.h index 7370ccc9b..08a18888b 100644 --- a/src/SB/Core/x/xGlobals.h +++ b/src/SB/Core/x/xGlobals.h @@ -4,11 +4,12 @@ #include "xCamera.h" #include "xPad.h" #include "xUpdateCull.h" + #include "iCamera.h" #include "iTime.h" -#include #include +#include struct xGlobals { diff --git a/src/SB/Core/x/xGrid.cpp b/src/SB/Core/x/xGrid.cpp index b83196b29..f4ddc3e15 100644 --- a/src/SB/Core/x/xGrid.cpp +++ b/src/SB/Core/x/xGrid.cpp @@ -1,10 +1,10 @@ #include "xGrid.h" -#include "string.h" - +#include "xEnt.h" #include "xMath.h" #include "xMemMgr.h" -#include "xEnt.h" + +#include "string.h" volatile S32 gGridIterActive = 0; diff --git a/src/SB/Core/x/xGrid.h b/src/SB/Core/x/xGrid.h index ae8da34e0..7d272af41 100644 --- a/src/SB/Core/x/xGrid.h +++ b/src/SB/Core/x/xGrid.h @@ -1,11 +1,10 @@ #ifndef XGRID_H #define XGRID_H -#include - +#include "xBound.h" #include "xMath3.h" -#include "xBound.h" +#include struct xEnt; struct xQCData; diff --git a/src/SB/Core/x/xGroup.cpp b/src/SB/Core/x/xGroup.cpp index f907d8d0c..3189dedfb 100644 --- a/src/SB/Core/x/xGroup.cpp +++ b/src/SB/Core/x/xGroup.cpp @@ -2,6 +2,7 @@ #include "xMath.h" #include "xMemMgr.h" + #include "zScene.h" #include @@ -21,8 +22,8 @@ void xGroupInit(xBase* b, xGroupAsset* asset) if (b->linkCount) { // Seek to then end of the xGroupAsset header and then seek to the end of the subsequent array of IDs - b->link = (xLinkAsset*)((U8*)(t->asset) + sizeof(xGroupAsset) + - asset->itemCount * sizeof(U32)); + b->link = + (xLinkAsset*)((U8*)(t->asset) + sizeof(xGroupAsset) + asset->itemCount * sizeof(U32)); } else { @@ -77,8 +78,7 @@ void xGroupReset(xGroup* ent) ent->last_index = 0; } -S32 xGroupEventCB(xBase* to, xBase* from, U32 toEvent, const F32* toParam, - xBase* toParamWidget) +S32 xGroupEventCB(xBase* to, xBase* from, U32 toEvent, const F32* toParam, xBase* toParamWidget) { xGroup* g = (xGroup*)from; switch (toEvent) diff --git a/src/SB/Core/x/xGroup.h b/src/SB/Core/x/xGroup.h index f067ebc31..3ddb904fc 100644 --- a/src/SB/Core/x/xGroup.h +++ b/src/SB/Core/x/xGroup.h @@ -25,8 +25,7 @@ void xGroupSetup(xGroup* g); void xGroupSave(xGroup* ent, xSerial* s); void xGroupLoad(xGroup* ent, xSerial* s); void xGroupReset(xGroup* ent); -S32 xGroupEventCB(xBase* to, xBase* from, U32 toEvent, const F32* toParam, - xBase* toParamWidget); +S32 xGroupEventCB(xBase* to, xBase* from, U32 toEvent, const F32* toParam, xBase* toParamWidget); U32 xGroupGetCount(xGroup* g); xBase* xGroupGetItemPtr(xGroup* g, U32 index); xBase* xGroupFindItemPtr(xGroup* g, U32 index); diff --git a/src/SB/Core/x/xHud.cpp b/src/SB/Core/x/xHud.cpp index e08a37e6a..176d41036 100644 --- a/src/SB/Core/x/xHud.cpp +++ b/src/SB/Core/x/xHud.cpp @@ -1,15 +1,16 @@ #include "xHud.h" + #include "xDebug.h" #include "xEvent.h" +#include "xHudText.h" #include "xMath.h" #include "xMathInlines.h" #include "xstransvc.h" -#include "zGlobals.h" -#include "xHudText.h" #include "zEnt.h" +#include "zGlobals.h" -#include +#include #include #define lengthof(x) (sizeof(x) / sizeof((x)[0])) diff --git a/src/SB/Core/x/xHud.h b/src/SB/Core/x/xHud.h index f7c3828d8..3d8a34183 100644 --- a/src/SB/Core/x/xHud.h +++ b/src/SB/Core/x/xHud.h @@ -2,9 +2,9 @@ #define XHUD_H #include "xBase.h" -#include "xVec3.h" #include "xDynAsset.h" #include "xModel.h" +#include "xVec3.h" typedef struct asset; typedef struct widget; @@ -81,13 +81,25 @@ namespace xhud MAX_ACT } activity; - virtual void destroy() {} + virtual void destroy() + { + } virtual U32 type() const; virtual bool is(U32 id) const; - virtual void init() {} - virtual void setup() { presetup(); } - virtual void update(F32 dt) { updater(dt); } - virtual void render() {} + virtual void init() + { + } + virtual void setup() + { + presetup(); + } + virtual void update(F32 dt) + { + updater(dt); + } + virtual void render() + { + } virtual void dispatch(xBase* b1, U32 event, const F32* toParam, xBase* b2); motive_node* _motive_top; @@ -109,7 +121,6 @@ namespace xhud void updater(F32 dt); void dispatcher(xBase*, U32, const F32*, xBase*); - void disable() { flag.enabled = 0; @@ -117,7 +128,6 @@ namespace xhud void add_tweaks() { - } void enable() @@ -154,7 +164,7 @@ namespace xhud static block_allocator* motive_allocator(); }; - typedef bool (motive_proc)(widget&, motive&, F32); + typedef bool(motive_proc)(widget&, motive&, F32); struct motive { @@ -168,7 +178,8 @@ namespace xhud void* context; U8 inverse; - motive(F32* value, F32 delta, F32 max_offset, F32 accel, bool (*fp_update)(xhud::widget&, motive&, F32), void* context) + motive(F32* value, F32 delta, F32 max_offset, F32 accel, + bool (*fp_update)(xhud::widget&, motive&, F32), void* context) { this->value = value; this->delta = delta; diff --git a/src/SB/Core/x/xHudFontMeter.cpp b/src/SB/Core/x/xHudFontMeter.cpp index e16a14a7e..fa78d9373 100644 --- a/src/SB/Core/x/xHudFontMeter.cpp +++ b/src/SB/Core/x/xHudFontMeter.cpp @@ -1,9 +1,10 @@ #include "xHudFontMeter.h" +#include "xMath2.h" + +#include +#include #include -#include -#include -#include void xhud::font_meter_widget::load(xBase& data, xDynAsset& asset, u32 size_t) { diff --git a/src/SB/Core/x/xHudFontMeter.h b/src/SB/Core/x/xHudFontMeter.h index a851e82d5..73fba9da1 100644 --- a/src/SB/Core/x/xHudFontMeter.h +++ b/src/SB/Core/x/xHudFontMeter.h @@ -1,8 +1,8 @@ #ifndef XHUDFONTMETER_H #define XHUDFONTMETER_H -#include "xHudMeter.h" #include "xFont.h" +#include "xHudMeter.h" namespace xhud { diff --git a/src/SB/Core/x/xHudMeter.cpp b/src/SB/Core/x/xHudMeter.cpp index 9fa21340a..d285d062d 100644 --- a/src/SB/Core/x/xHudMeter.cpp +++ b/src/SB/Core/x/xHudMeter.cpp @@ -1,10 +1,10 @@ #include "xHudMeter.h" -#include - -#include "xString.h" #include "xMathInlines.h" -#include "PowerPC_EABI_Support\MSL_C\MSL_Common\printf.h" +#include "xString.h" + +#include +#include namespace xhud { diff --git a/src/SB/Core/x/xHudModel.cpp b/src/SB/Core/x/xHudModel.cpp index a1199e149..eddec0e23 100644 --- a/src/SB/Core/x/xHudModel.cpp +++ b/src/SB/Core/x/xHudModel.cpp @@ -1,8 +1,9 @@ #include "xHudModel.h" + #include "xHud.h" #include "xString.h" -#include +#include #include xAnimTable* XHUD_AnimTable_Idle() diff --git a/src/SB/Core/x/xHudText.cpp b/src/SB/Core/x/xHudText.cpp index 547b38d40..c29551438 100644 --- a/src/SB/Core/x/xHudText.cpp +++ b/src/SB/Core/x/xHudText.cpp @@ -1,11 +1,13 @@ #include "xHudText.h" -#include "xstransvc.h" + #include "xTextAsset.h" +#include "xstransvc.h" + #include "zScene.h" #include "zTextBox.h" -#include #include +#include #include void xhud::text_widget::load(xBase& data, xDynAsset& asset, size_t) diff --git a/src/SB/Core/x/xHudText.h b/src/SB/Core/x/xHudText.h index 19c2e931a..56571e787 100644 --- a/src/SB/Core/x/xHudText.h +++ b/src/SB/Core/x/xHudText.h @@ -1,8 +1,8 @@ #ifndef XHUDTEXT_H #define XHUDTEXT_H -#include "xHud.h" #include "xFont.h" +#include "xHud.h" namespace xhud { diff --git a/src/SB/Core/x/xHudUnitMeter.cpp b/src/SB/Core/x/xHudUnitMeter.cpp index 7aecb8fb9..81079c2fd 100644 --- a/src/SB/Core/x/xHudUnitMeter.cpp +++ b/src/SB/Core/x/xHudUnitMeter.cpp @@ -1,17 +1,19 @@ #include "xHudUnitMeter.h" -#include "xString.h" -#include "xMathInlines.h" + #include "xDebug.h" +#include "xMathInlines.h" +#include "xString.h" #include #include namespace xhud { - namespace { + namespace + { F32 tweak_anim_time_delta = 0.1; } -} +} // namespace xhud void xhud::unit_meter_widget::load(xBase& data, xDynAsset& asset, size_t arg2) { @@ -25,8 +27,8 @@ xhud::unit_meter_widget::unit_meter_widget(const xhud::unit_meter_asset& a) : me S32 i, j; // for (i = 0; i < 18; i++) // { - res.id = a.id; - res.baseType = a.baseType; + res.id = a.id; + res.baseType = a.baseType; // } anim_time = 0.0f; @@ -43,7 +45,8 @@ xhud::unit_meter_widget::unit_meter_widget(const xhud::unit_meter_asset& a) : me if (!registered) { registered = true; - xDebugAddTweak("Temp|HUD Unit Anim Delta", &tweak_anim_time_delta, 0.0f, 10.0f, NULL, NULL, 0); + xDebugAddTweak("Temp|HUD Unit Anim Delta", &tweak_anim_time_delta, 0.0f, 10.0f, NULL, NULL, + 0); } } @@ -68,7 +71,7 @@ bool xhud::unit_meter_widget::is(U32 id) const bool isType = false; if (unit_meter_widget::type() == id || meter_widget::is(id)) { - isType = true; + isType = true; } return isType; @@ -96,19 +99,21 @@ void xhud::unit_meter_widget::update(F32 dt) units = 6; } - for (S32 i = 0; i < units; i++) { + for (S32 i = 0; i < units; i++) + { S32 which = 0; if ((res.fill_forward && value >= i + 1) || (!res.fill_forward && value >= units - i)) { which = 1; } - + xModelInstance* m = model[i][which]; if (m != NULL && m->Anim != NULL && !(m->Anim->Single->State->Data->Duration <= 0.0f)) { // TODO: Float ops aren't quite right F32 duration = i * 0.1f + anim_time; - if (duration > m->Anim->Single->State->Data->Duration) { + if (duration > m->Anim->Single->State->Data->Duration) + { duration = xfmod(duration, m->Anim->Single->State->Data->Duration); } @@ -121,7 +126,7 @@ void xhud::unit_meter_widget::update(F32 dt) void xhud::unit_meter_widget::render() { render_context unitrc = this->rc; - + S32 units = 0.5f + max_value; if (units > 6) { diff --git a/src/SB/Core/x/xIni.cpp b/src/SB/Core/x/xIni.cpp index 90c0e45a2..06afcec43 100644 --- a/src/SB/Core/x/xIni.cpp +++ b/src/SB/Core/x/xIni.cpp @@ -1,10 +1,12 @@ #include "xIni.h" + #include "xString.h" + #include +#include +#include #include -#include -#include char* TrimWhitespace(char* string) { diff --git a/src/SB/Core/x/xIsect.h b/src/SB/Core/x/xIsect.h index 64524d816..6dcc1ce2f 100644 --- a/src/SB/Core/x/xIsect.h +++ b/src/SB/Core/x/xIsect.h @@ -1,7 +1,7 @@ #ifndef XISECT_H #define XISECT_H -#include "xMath3.h" +#include "xVec3.h" struct xIsect { diff --git a/src/SB/Core/x/xJSP.cpp b/src/SB/Core/x/xJSP.cpp index 533b6bdff..bd7fb9f70 100644 --- a/src/SB/Core/x/xJSP.cpp +++ b/src/SB/Core/x/xJSP.cpp @@ -1,14 +1,14 @@ #include "xJSP.h" + #include "zGlobals.h" -#include #include +#include static RwV3d* sCurrVert; static S32 sAtomicStartCount; static RwV3d** sAtomicStartVert; - static RpAtomic* CountAtomicCB(RpAtomic* atomic, void* data) { sAtomicStartCount++; @@ -19,7 +19,8 @@ static RpAtomic* CountAtomicCB(RpAtomic* atomic, void* data) static RpMesh* AddMeshCB(RpMesh* mesh, RpMeshHeader*, void* pData) { RwV3d** stripVert = (RwV3d**)pData; - for (U32 i = 0; i < mesh->numIndices; i++) { + for (U32 i = 0; i < mesh->numIndices; i++) + { **stripVert = sCurrVert[mesh->indices[i]]; (*stripVert)++; } diff --git a/src/SB/Core/x/xJSP.h b/src/SB/Core/x/xJSP.h index 0161cf6e8..7d62769cb 100644 --- a/src/SB/Core/x/xJSP.h +++ b/src/SB/Core/x/xJSP.h @@ -1,11 +1,13 @@ #ifndef XJSP_H #define XJSP_H -#include -#include -#include #include "xClumpColl.h" +#include +#include + +#include + struct __rwMark { U32 type; diff --git a/src/SB/Core/x/xJaw.cpp b/src/SB/Core/x/xJaw.cpp index 4c04d9545..304d993a7 100644 --- a/src/SB/Core/x/xJaw.cpp +++ b/src/SB/Core/x/xJaw.cpp @@ -2,7 +2,7 @@ #include "xstransvc.h" -#include +#include struct xJawDataTable { diff --git a/src/SB/Core/x/xLaserBolt.cpp b/src/SB/Core/x/xLaserBolt.cpp index 446af2aad..7ededb70c 100644 --- a/src/SB/Core/x/xLaserBolt.cpp +++ b/src/SB/Core/x/xLaserBolt.cpp @@ -1,13 +1,17 @@ #include "xLaserBolt.h" + +#include "containers.h" #include "xString.h" #include "xstransvc.h" + #include "iParMgr.h" -#include "zEvent.h" + #include "zBase.h" -#include "zNPCTypeCommon.h" #include "zEntDestructObj.h" -#include "containers.h" +#include "zEvent.h" +#include "zNPCTypeCommon.h" +#include #include void xLaserBoltEmitter::init(u32 max_bolts, const char* texture_name) @@ -18,7 +22,6 @@ void xLaserBoltEmitter::init(u32 max_bolts, const char* texture_name) debug_init(texture_name); } - void xLaserBoltEmitter::set_texture(const char* name) { set_texture(xStrHash(name)); @@ -60,7 +63,7 @@ void xLaserBoltEmitter::reset() emit_fx(*itfx, b, b.hit_dist, b.hit_dist, (1.0f / 60.0f)); itfx++; } - + ++it; } @@ -130,11 +133,9 @@ void xLaserBoltEmitter::update(F32 dt) if (start_collide) { - } else { - } static_queue::iterator it; @@ -149,7 +150,7 @@ void xLaserBoltEmitter::update(F32 dt) effect_data* itfx; effect_data* endfx; // effect_data* itfx; - // effect_data* endfx; + // effect_data* endfx; } } @@ -173,7 +174,7 @@ void xLaserBoltEmitter::render() render(*it, v); ++it; } - + if (v != vert) { flush_verts(v, vert - v); @@ -210,7 +211,7 @@ void xLaserBoltEmitter::pre_collide(bolt& b) void xLaserBoltEmitter::collide_update(bolt& b) { xScene& scene = *globals.sceneCur; - + // TODO: Investigate float regalloc mismatch xRay3 ray; ray.origin = b.origin; @@ -218,12 +219,12 @@ void xLaserBoltEmitter::collide_update(bolt& b) ray.min_t = b.prev_check_dist - this->cfg.length; ray.max_t = b.dist; ray.flags = 0xC00; - + if (ray.max_t < this->cfg.safe_dist) { ray.min_t = ray.max_t; } - + xCollis player_coll; player_coll.flags = 0x300; xRayHitsBound(&ray, &globals.player.ent.bound, &player_coll); @@ -255,9 +256,9 @@ void xLaserBoltEmitter::collide_update(bolt& b) log_collide_dynamics(scene_coll.flags & 0x1 || player_coll.flags & 0x1); } -RxObjSpace3DVertex* xLaserBoltEmitter::render(bolt& b, RxObjSpace3DVertex *vert) -{ - F32 dist0 = b.prev_dist - this->cfg.length; +RxObjSpace3DVertex* xLaserBoltEmitter::render(bolt& b, RxObjSpace3DVertex* vert) +{ + F32 dist0 = b.prev_dist - this->cfg.length; if (dist0 < 0.0f) { dist0 = 0.0f; @@ -276,12 +277,11 @@ RxObjSpace3DVertex* xLaserBoltEmitter::render(bolt& b, RxObjSpace3DVertex *vert) xVec3 loc0 = b.origin + b.dir * dist0; xVec3 loc1 = b.dir * dist0; - // xMat4x3 &cam_mat; + // xMat4x3 &cam_mat; xVec3 dir; xVec3 right; xVec3 half_right; - set_bolt_verts(vert, loc0, loc1, 0xFF, half_right); return vert; } @@ -314,7 +314,7 @@ void xLaserBoltEmitter::reset_fx(fx_when_enum when) effect_data* cur_fx = this->fx[when]; effect_data* fx_end = cur_fx + this->fxsize[when]; while (cur_fx != fx_end) - { + { cur_fx->irate = cur_fx->rate > 0.0f ? 1.0f / cur_fx->rate : 0.0f; cur_fx++; } @@ -336,7 +336,7 @@ void xLaserBoltEmitter::update_fx(bolt& b, F32 prev_dist, F32 dt) else if (tail_dist < b.hit_dist) { F32 from_dist = prev_dist - this->cfg.length; - + effect_data* itfx = this->fx[5]; effect_data* endfx = itfx + this->fxsize[5]; if (from_dist < 0.0f) @@ -373,13 +373,14 @@ void xLaserBoltEmitter::update_fx(bolt& b, F32 prev_dist, F32 dt) } } -void xLaserBoltEmitter::emit_particle(effect_data& effect, bolt& b, F32 from_dist, F32 to_dist, F32 dt) +void xLaserBoltEmitter::emit_particle(effect_data& effect, bolt& b, F32 from_dist, F32 to_dist, + F32 dt) { xParEmitter& pe = *effect.par; xParEmitterAsset& pea = *pe.tasset; F32 velmag = pea.vel.y; - - switch(effect.orient) + + switch (effect.orient) { case FX_ORIENT_PATH: pea.vel = b.dir * velmag; @@ -432,11 +433,12 @@ void xLaserBoltEmitter::emit_decal(effect_data& effect, bolt& b, F32 from_dist, effect.decal->emit(mat, -1); } -void xLaserBoltEmitter::emit_decal_dist(effect_data& effect, bolt& b, F32 from_dist, F32 to_dist, F32 dt) +void xLaserBoltEmitter::emit_decal_dist(effect_data& effect, bolt& b, F32 from_dist, F32 to_dist, + F32 dt) { F32 start_dist = to_dist - from_dist; b.emitted = effect.rate * start_dist + b.emitted; - + S32 total = effect.rate * start_dist + b.emitted; b.emitted -= total; diff --git a/src/SB/Core/x/xLaserBolt.h b/src/SB/Core/x/xLaserBolt.h index e7e14f9e8..12c99e7af 100644 --- a/src/SB/Core/x/xLaserBolt.h +++ b/src/SB/Core/x/xLaserBolt.h @@ -10,6 +10,7 @@ #include "xVec3.h" #include + #include enum fx_type_enum diff --git a/src/SB/Core/x/xLightKit.cpp b/src/SB/Core/x/xLightKit.cpp index 87866c249..9275167af 100644 --- a/src/SB/Core/x/xLightKit.cpp +++ b/src/SB/Core/x/xLightKit.cpp @@ -1,8 +1,9 @@ #include "xLightKit.h" + #include "xMath.h" -#include #include +#include S32 iModelHack_DisablePrelight; xLightKit* gLastLightKit; diff --git a/src/SB/Core/x/xLightKit.h b/src/SB/Core/x/xLightKit.h index 40ae28592..29ed54fcb 100644 --- a/src/SB/Core/x/xLightKit.h +++ b/src/SB/Core/x/xLightKit.h @@ -1,9 +1,10 @@ #ifndef XLIGHTKIT_H #define XLIGHTKIT_H -#include -#include #include +#include + +#include struct xLightKitLight { diff --git a/src/SB/Core/x/xMath.cpp b/src/SB/Core/x/xMath.cpp index adbc647a9..80ab9130f 100644 --- a/src/SB/Core/x/xMath.cpp +++ b/src/SB/Core/x/xMath.cpp @@ -1,10 +1,10 @@ #include "xMath.h" -#include -#include - #include "xMathInlines.h" +#include +#include + S32 xmath_inited; S32 xmath_exited; volatile U32 rndseed; // made this volatile so xrand() matches diff --git a/src/SB/Core/x/xMath.h b/src/SB/Core/x/xMath.h index 156a6fbff..0c9859c8f 100644 --- a/src/SB/Core/x/xMath.h +++ b/src/SB/Core/x/xMath.h @@ -1,10 +1,10 @@ #ifndef XMATH_H #define XMATH_H -#include - #include "iMath.h" +#include + #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define xabs(x) iabs(x) @@ -17,7 +17,7 @@ #define SQR(x) ((x) * (x)) -#define ALIGN(x, a) ((x) + ((a)-1) & ~((a)-1)) +#define ALIGN(x, a) ((x) + ((a) - 1) & ~((a) - 1)) // Override these to point to their corresponding symbols in .sdata2 // For example: diff --git a/src/SB/Core/x/xMath3.cpp b/src/SB/Core/x/xMath3.cpp index 8037aaa0e..0452216b0 100644 --- a/src/SB/Core/x/xMath3.cpp +++ b/src/SB/Core/x/xMath3.cpp @@ -1,13 +1,14 @@ #include "xMath3.h" -#include "iMath3.h" - -#include -#include -#include "iMath.h" -#include "xMath.h" // icos and isin #include "xClimate.h" // xMat3x3Identity +#include "xMath.h" // icos and isin #include "xMathInlines.h" // xasin, xatan2 + +#include "iMath.h" +#include "iMath3.h" + +#include +#include //#include "xVec3Inlines.h" // xVec3Init, imported, realized xClimate has a declaration as well though. const xVec3 g_O3 = { 0, 0, 0 }; diff --git a/src/SB/Core/x/xMath3.h b/src/SB/Core/x/xMath3.h index 327d86018..69703e2d1 100644 --- a/src/SB/Core/x/xMath3.h +++ b/src/SB/Core/x/xMath3.h @@ -1,11 +1,10 @@ #ifndef XMATH3_H #define XMATH3_H +#include "xIsect.h" #include "xMath.h" - #include "xVec3.h" #include "xVec3Inlines.h" -#include "xIsect.h" // Size: 0x30 struct xMat3x3 diff --git a/src/SB/Core/x/xMemMgr.cpp b/src/SB/Core/x/xMemMgr.cpp index 0b1ae4dee..2d2361a33 100644 --- a/src/SB/Core/x/xMemMgr.cpp +++ b/src/SB/Core/x/xMemMgr.cpp @@ -1,11 +1,12 @@ #include "xMemMgr.h" -#include -#include +#include "iMemMgr.h" +#include "iSystem.h" + #include -#include "iSystem.h" -#include "iMemMgr.h" +#include +#include xMemInfo_tag gMemInfo; xMemHeap_tag gxHeap[3]; diff --git a/src/SB/Core/x/xMemMgr.h b/src/SB/Core/x/xMemMgr.h index 78b0c9841..5ec5fc41f 100644 --- a/src/SB/Core/x/xMemMgr.h +++ b/src/SB/Core/x/xMemMgr.h @@ -103,8 +103,8 @@ S32 xMemGetBase(U32 heapID); void xMemRegisterBaseNotifyFunc(void (*)(void)); S32 xMemGetBase(); void xMemPoolAddElements(xMemPool* pool, void* buffer, U32 count); -void xMemPoolSetup(xMemPool* pool, void* buffer, U32 nextOffset, U32 flags, - xMemPoolInitCB initCB, U32 size, U32 count, U32 numRealloc); +void xMemPoolSetup(xMemPool* pool, void* buffer, U32 nextOffset, U32 flags, xMemPoolInitCB initCB, + U32 size, U32 count, U32 numRealloc); void* xMemPoolAlloc(xMemPool* pool); void xMemPoolFree(xMemPool* pool, void* data); diff --git a/src/SB/Core/x/xModel.cpp b/src/SB/Core/x/xModel.cpp index ece8fde21..0e5a433dc 100644 --- a/src/SB/Core/x/xModel.cpp +++ b/src/SB/Core/x/xModel.cpp @@ -1,10 +1,12 @@ -#include "iModel.h" #include "xModel.h" + #include "xMemMgr.h" #include "xMorph.h" -#include +#include "iModel.h" + #include +#include RpMorphTarget anim_coll_old_mt; S32 xModelPipeCount[16]; diff --git a/src/SB/Core/x/xModel.h b/src/SB/Core/x/xModel.h index 73e5e6024..5bc818b5d 100644 --- a/src/SB/Core/x/xModel.h +++ b/src/SB/Core/x/xModel.h @@ -1,15 +1,15 @@ #ifndef XMODEL_H #define XMODEL_H -#include -#include - #include "xAnim.h" #include "xLightKit.h" -#include "xSurface.h" -#include "xMath3.h" #include "xMath2.h" +#include "xMath3.h" #include "xModelBucket.h" +#include "xSurface.h" + +#include +#include struct xModelBucket; diff --git a/src/SB/Core/x/xModelBucket.cpp b/src/SB/Core/x/xModelBucket.cpp index c1ccd863e..8d14afcbd 100644 --- a/src/SB/Core/x/xModelBucket.cpp +++ b/src/SB/Core/x/xModelBucket.cpp @@ -1,16 +1,19 @@ #include "xModelBucket.h" +#include "xLightKit.h" +#include "xMathInlines.h" + #include "iCamera.h" #include "iDraw.h" #include "iModel.h" -#include "xLightKit.h" -#include "xMathInlines.h" + #include "zGlobals.h" -#include -#include #include +#include +#include + static RpWorld* sBucketDummyWorld; static RwCamera* sBucketDummyCamera; static S32 sBucketCurr; diff --git a/src/SB/Core/x/xMorph.cpp b/src/SB/Core/x/xMorph.cpp index ad2f91bc7..33ee7a807 100644 --- a/src/SB/Core/x/xMorph.cpp +++ b/src/SB/Core/x/xMorph.cpp @@ -1,6 +1,7 @@ #include "xMorph.h" #include "xDebug.h" + #include "iModel.h" #include @@ -24,51 +25,66 @@ xMorphSeqFile* xMorphSeqSetup(void* data, xMorphFindAssetCallback FindAssetCB) assetlist = (U32*)(framelist + header->TimeCount); namelist = (char*)(assetlist + header->ModelCount * 2); - if (header->Flags & 0x80000000) { + if (header->Flags & 0x80000000) + { return header; } header->Flags |= 0x80000000; - if (!(header->Flags & 0x1)) { + if (!(header->Flags & 0x1)) + { namelist = NULL; } - for (i = 0; i < (S32)header->ModelCount * 2; i++) { - if (assetlist[i]) { + for (i = 0; i < (S32)header->ModelCount * 2; i++) + { + if (assetlist[i]) + { assetPtr = FindAssetCB(assetlist[i], namelist); assetlist[i] = (U32)assetPtr; } - if (namelist) { + if (namelist) + { namelist = strlen(namelist) + 1 + namelist; } } - for (i = 0; i < (S32)header->ModelCount; i++) { - if (assetlist[i*2+1]) { - model = (RpAtomic*)assetlist[i*2]; - mphtgt = (xMorphTargetFile*)assetlist[i*2+1]; + for (i = 0; i < (S32)header->ModelCount; i++) + { + if (assetlist[i * 2 + 1]) + { + model = (RpAtomic*)assetlist[i * 2]; + mphtgt = (xMorphTargetFile*)assetlist[i * 2 + 1]; iMorphOptimize(model, mphtgt->Flags & 0x1); } } - for (i = 0; i < (S32)header->TimeCount; i++) { - model = (RpAtomic*)assetlist[(U32)framelist[i].Model*2]; - mphtgt = (xMorphTargetFile*)assetlist[(U32)framelist[i].Model*2+1]; + for (i = 0; i < (S32)header->TimeCount; i++) + { + model = (RpAtomic*)assetlist[(U32)framelist[i].Model * 2]; + mphtgt = (xMorphTargetFile*)assetlist[(U32)framelist[i].Model * 2 + 1]; framelist[i].Model = model; - for (j = 0; j < 4; j++) { - if ((U32)framelist[i].Targets[j] + 0x10000 == 0xFFFF) { + for (j = 0; j < 4; j++) + { + if ((U32)framelist[i].Targets[j] + 0x10000 == 0xFFFF) + { framelist[i].Targets[j] = NULL; - } else { + } + else + { skipsize = (mphtgt->NumVerts * 3 + 7) & ~7; - if (mphtgt->Flags & 0x1) { + if (mphtgt->Flags & 0x1) + { skipsize *= 2; } - if (j == 0) { + if (j == 0) + { framelist[i].Flags = mphtgt->Flags; framelist[i].NumVerts = mphtgt->NumVerts; framelist[i].Scale *= mphtgt->Scale; } - framelist[i].Targets[j] = (S16*)((U8*)(mphtgt + 1) + skipsize * (U32)framelist[i].Targets[j] * 2); + framelist[i].Targets[j] = + (S16*)((U8*)(mphtgt + 1) + skipsize * (U32)framelist[i].Targets[j] * 2); } } } @@ -89,26 +105,40 @@ void xMorphRender(xMorphSeqFile* seq, RwMatrix* mat, F32 time) tcount = seq->TimeCount; frame = (xMorphFrame*)(times + seq->TimeCount); - if (time < 0.0f) time = 0.0f; - if (time > times[tcount-1]) time = times[tcount-1]; + if (time < 0.0f) + time = 0.0f; + if (time > times[tcount - 1]) + time = times[tcount - 1]; - tidx = (tcount-1) & 0x3; - while (times[tidx] < time) tidx += 4; - while (tidx && time < times[tidx]) tidx--; + tidx = (tcount - 1) & 0x3; + while (times[tidx] < time) + tidx += 4; + while (tidx && time < times[tidx]) + tidx--; frame += tidx; - if (!frame->Targets[0]) { + if (!frame->Targets[0]) + { iModelRender(frame->Model, mat); - } else { + } + else + { lerp = frame->RecipTime * (time - times[tidx]); - if (lerp == 0.0f) { + if (lerp == 0.0f) + { wptr = frame->WeightStart; - } else { - weight[0] = (S32)(lerp * (frame->WeightEnd[0] - frame->WeightStart[0])) + frame->WeightStart[0], - weight[1] = (S32)(lerp * (frame->WeightEnd[1] - frame->WeightStart[1])) + frame->WeightStart[1], - weight[2] = (S32)(lerp * (frame->WeightEnd[2] - frame->WeightStart[2])) + frame->WeightStart[2], - weight[3] = (S32)(lerp * (frame->WeightEnd[3] - frame->WeightStart[3])) + frame->WeightStart[3]; + } + else + { + weight[0] = + (S32)(lerp * (frame->WeightEnd[0] - frame->WeightStart[0])) + frame->WeightStart[0], + weight[1] = + (S32)(lerp * (frame->WeightEnd[1] - frame->WeightStart[1])) + frame->WeightStart[1], + weight[2] = + (S32)(lerp * (frame->WeightEnd[2] - frame->WeightStart[2])) + frame->WeightStart[2], + weight[3] = + (S32)(lerp * (frame->WeightEnd[3] - frame->WeightStart[3])) + frame->WeightStart[3]; wptr = weight; } @@ -118,5 +148,5 @@ void xMorphRender(xMorphSeqFile* seq, RwMatrix* mat, F32 time) F32 xMorphSeqDuration(xMorphSeqFile* seq) { - return ((F32*)(seq+1))[seq->TimeCount-1]; + return ((F32*)(seq + 1))[seq->TimeCount - 1]; } diff --git a/src/SB/Core/x/xMorph.h b/src/SB/Core/x/xMorph.h index 3ee24ac1c..85f200aac 100644 --- a/src/SB/Core/x/xMorph.h +++ b/src/SB/Core/x/xMorph.h @@ -1,11 +1,12 @@ #ifndef XMORPH_H #define XMORPH_H -#include "iMorph.h" #include "xMath3.h" -#include +#include "iMorph.h" + #include +#include struct xMorphSeqFile { @@ -38,7 +39,7 @@ struct xMorphTargetFile F32 Radius; }; -typedef void*(*xMorphFindAssetCallback)(U32, char*); +typedef void* (*xMorphFindAssetCallback)(U32, char*); xMorphSeqFile* xMorphSeqSetup(void* data, xMorphFindAssetCallback FindAssetCB); void xMorphRender(xMorphSeqFile* seq, RwMatrix* mat, F32 time); diff --git a/src/SB/Core/x/xMovePoint.cpp b/src/SB/Core/x/xMovePoint.cpp index d9874e61e..e3cf16301 100644 --- a/src/SB/Core/x/xMovePoint.cpp +++ b/src/SB/Core/x/xMovePoint.cpp @@ -1,11 +1,11 @@ #include "xMovePoint.h" -#include "xMathInlines.h" -#include - #include "xMath.h" -#include "xScene.h" +#include "xMathInlines.h" #include "xMemMgr.h" +#include "xScene.h" + +#include inline F32 xVec3Hdng(xVec3* a, const xVec3* b, const xVec3* c); diff --git a/src/SB/Core/x/xNPCBasic.cpp b/src/SB/Core/x/xNPCBasic.cpp index 151f00ac4..05484d53a 100644 --- a/src/SB/Core/x/xNPCBasic.cpp +++ b/src/SB/Core/x/xNPCBasic.cpp @@ -1,22 +1,22 @@ #include "xNPCBasic.h" -#include +#include "xCamera.h" +#include "xColor.h" +#include "xDraw.h" +#include "xEntMotion.h" +#include "xMath.h" +#include "xModel.h" + +#include "iCollide.h" +#include "iColor.h" + #include +#include // Weird... why does x depend on z here? #include "zEnt.h" #include "zGrid.h" -#include "xMath.h" -#include "xModel.h" -#include "xEntMotion.h" -#include "xCamera.h" -#include "xDraw.h" - -#include "iColor.h" -#include "xColor.h" -#include "iCollide.h" - static xEntCollis g_colrec = { 0 }; void NPC_alwaysUseSphere(xEnt*, xVec3*); diff --git a/src/SB/Core/x/xNPCBasic.h b/src/SB/Core/x/xNPCBasic.h index 24ff1d1be..6bcb87747 100644 --- a/src/SB/Core/x/xNPCBasic.h +++ b/src/SB/Core/x/xNPCBasic.h @@ -1,10 +1,10 @@ #ifndef XNPCBASIC_H #define XNPCBASIC_H +#include "xColor.h" #include "xEnt.h" #include "xFactory.h" #include "xShadowSimple.h" -#include "xColor.h" enum en_npcperf { diff --git a/src/SB/Core/x/xPad.cpp b/src/SB/Core/x/xPad.cpp index ebf47e382..fbdf6a279 100644 --- a/src/SB/Core/x/xPad.cpp +++ b/src/SB/Core/x/xPad.cpp @@ -2,14 +2,14 @@ #include "xMathInlines.h" -#include "zMenu.h" -#include "zScene.h" #include "zGame.h" #include "zGameExtras.h" #include "zGlobals.h" +#include "zMenu.h" +#include "zScene.h" -#include #include +#include _tagxPad mPad[4]; diff --git a/src/SB/Core/x/xPad.h b/src/SB/Core/x/xPad.h index b70084246..f893a4ae6 100644 --- a/src/SB/Core/x/xPad.h +++ b/src/SB/Core/x/xPad.h @@ -1,8 +1,9 @@ #ifndef XPAD_H #define XPAD_H -#include "xRumble.h" #include "xMath2.h" +#include "xRumble.h" + #include "iPad.h" enum _tagPadState diff --git a/src/SB/Core/x/xParCmd.cpp b/src/SB/Core/x/xParCmd.cpp index f8c9dd483..a4523396a 100644 --- a/src/SB/Core/x/xParCmd.cpp +++ b/src/SB/Core/x/xParCmd.cpp @@ -1,9 +1,9 @@ #include "xParCmd.h" -#include "xParGroup.h" -#include "xVec3Inlines.h" #include "xMath.h" #include "xMathInlines.h" +#include "xParGroup.h" +#include "xVec3Inlines.h" struct xCmdInfo { diff --git a/src/SB/Core/x/xParEmitter.cpp b/src/SB/Core/x/xParEmitter.cpp index 2f46c7f22..59b741eb4 100644 --- a/src/SB/Core/x/xParEmitter.cpp +++ b/src/SB/Core/x/xParEmitter.cpp @@ -1,14 +1,17 @@ #include "xParEmitter.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "xDebug.h" +#include "xEvent.h" +#include "xGroup.h" +#include "xMath.h" +#include "xMathInlines.h" + +#include "iModel.h" + +#include "zGlobals.h" +#include "zScene.h" + +#include void add_tweaks(xParEmitter& pe) { diff --git a/src/SB/Core/x/xParEmitterType.cpp b/src/SB/Core/x/xParEmitterType.cpp index 42591032c..afd6e4a60 100644 --- a/src/SB/Core/x/xParEmitterType.cpp +++ b/src/SB/Core/x/xParEmitterType.cpp @@ -1,9 +1,11 @@ #include "xParEmitterType.h" +#include "xMath.h" +#include "xParEmitter.h" + +#include "iModel.h" + #include -#include -#include -#include void xParEmitterEmitPoint(xPar* p, xParEmitterAsset* a, F32 dt) { diff --git a/src/SB/Core/x/xParEmitterType.h b/src/SB/Core/x/xParEmitterType.h index 85d7795f9..146cd0f80 100644 --- a/src/SB/Core/x/xParEmitterType.h +++ b/src/SB/Core/x/xParEmitterType.h @@ -1,10 +1,10 @@ #ifndef XPAREMITTERTYPE_H #define XPAREMITTERTYPE_H +#include "xEnt.h" #include "xMath3.h" -#include "xVolume.h" #include "xPar.h" -#include "xEnt.h" +#include "xVolume.h" struct xPECircle { diff --git a/src/SB/Core/x/xParMgr.cpp b/src/SB/Core/x/xParMgr.cpp index 0a5a3f99d..48d13b663 100644 --- a/src/SB/Core/x/xParMgr.cpp +++ b/src/SB/Core/x/xParMgr.cpp @@ -1,7 +1,8 @@ -#include "iParMgr.h" +#include "xParMgr.h" #include "xPar.h" -#include "xParMgr.h" + +#include "iParMgr.h" #include @@ -39,7 +40,8 @@ void xParMgrUpdate(F32 elapsedTime) } U32 i; - for (i = sFrameCount; i >= 1; i--); + for (i = sFrameCount; i >= 1; i--) + ; sFrameCount = i; } diff --git a/src/SB/Core/x/xParSys.cpp b/src/SB/Core/x/xParSys.cpp index a2adf1b81..0e4893a5e 100644 --- a/src/SB/Core/x/xParSys.cpp +++ b/src/SB/Core/x/xParSys.cpp @@ -1,10 +1,11 @@ #include "xParSys.h" -#include "zScene.h" +#include "xPtankPool.h" #include "xRenderState.h" -#include "zRenderState.h" + #include "zGlobals.h" -#include "xPtankPool.h" +#include "zRenderState.h" +#include "zScene.h" #include @@ -45,35 +46,35 @@ static void par_sprite_update(xParSys& sys, xParGroup& group) offset_right = par_offset_right; } else if (pivot & 0x20) - { + { offset_right = -par_offset_right; } else { offset_right = 0.0f; } - + xVec3 offset_up; if (pivot & 0x10) { offset_up = -par_offset_up; } else if (pivot & 0x40) - { + { offset_up = par_offset_up; } else { offset_up = 0.0f; } - + ptank_pool__pos_color_size_uv2 pool; pool.rs.texture = sys.txtr_particle; pool.rs.src_blend = sBlendTable[sys.tasset->renderSrcBlendMode]; pool.rs.dst_blend = sBlendTable[sys.tasset->renderDstBlendMode]; pool.rs.flags = 0x0; pool.reset(); - + xParCmdTex* tex = group.m_cmdTex; xPar* p = group.m_root; while (p != NULL) @@ -81,33 +82,33 @@ static void par_sprite_update(xParSys& sys, xParGroup& group) RwSphere testSphere; testSphere.center = *(RwV3d*)&p->m_pos; testSphere.radius = p->m_size; - + if (RwCameraFrustumTestSphere(globals.camera.lo_cam, &testSphere)) { pool.next(); - + if (!pool.valid()) { break; } - + xVec3& loc = *pool.pos; loc = p->m_pos; loc += offset_right * p->m_size; loc += offset_up * p->m_size; - + pool.color->r = p->m_c[0]; pool.color->g = p->m_c[1]; pool.color->b = p->m_c[2]; pool.color->a = p->m_c[3]; - + pool.size->assign(p->m_size, p->m_size); - + if (tex) { pool.uv[0].x = p->m_texIdx[0] * tex->unit_width + tex->x1; pool.uv[0].y = p->m_texIdx[1] * tex->unit_height + tex->y1; - + pool.uv[1].x = (p->m_texIdx[0] + 1) * tex->unit_width + tex->x1; pool.uv[1].y = (p->m_texIdx[1] + 1) * tex->unit_height + tex->y1; } @@ -117,7 +118,7 @@ static void par_sprite_update(xParSys& sys, xParGroup& group) pool.uv[1].assign(1.0f, 1.0f); } } - + p = p->m_next; } @@ -188,7 +189,7 @@ void xParSysInit(xBase* b, xParSysAsset* tasset) xParGroupRegister(t->group); xParGroupSetAging(t->group, (((tasset->parFlags >> 1) & 0x1) ^ 0x1) & 0xFF); xParGroupSetVisibility(t->group, t->visible); - xParGroupSetBack2Life(t->group,(((tasset->parFlags >> 2) & 0x1) ^ 0x1) & 0xFF); + xParGroupSetBack2Life(t->group, (((tasset->parFlags >> 2) & 0x1) ^ 0x1) & 0xFF); t->parent = NULL; for (i = 0; i < t->cmdCount; i++) @@ -225,7 +226,7 @@ void xParSysReset(xParSys* t) xParGroupSetAging(t->group, (((t->tasset->parFlags >> 1) & 0x1) ^ 0x1) & 0xFF); xParGroupSetVisibility(t->group, t->visible); - xParGroupSetBack2Life(t->group,(((t->tasset->parFlags >> 2) & 0x1) ^ 0x1) & 0xFF); + xParGroupSetBack2Life(t->group, (((t->tasset->parFlags >> 2) & 0x1) ^ 0x1) & 0xFF); } } @@ -362,7 +363,7 @@ void xParSysRender(xBase* b) xParGroup* g; xParSys* s = (xParSys*)b; zRenderState(SDRS_Particles); - + g = s->group; while (g != NULL) { diff --git a/src/SB/Core/x/xParSys.h b/src/SB/Core/x/xParSys.h index 9fc48034b..e45e2bd56 100644 --- a/src/SB/Core/x/xParSys.h +++ b/src/SB/Core/x/xParSys.h @@ -4,9 +4,10 @@ #include "xBase.h" #include "xParCmd.h" #include "xParGroup.h" -#include "iParMgr.h" -#include "xstransvc.h" #include "xScene.h" +#include "xstransvc.h" + +#include "iParMgr.h" #include diff --git a/src/SB/Core/x/xPartition.cpp b/src/SB/Core/x/xPartition.cpp index c556d6930..fbd6b1e96 100644 --- a/src/SB/Core/x/xPartition.cpp +++ b/src/SB/Core/x/xPartition.cpp @@ -1,5 +1,7 @@ #include "xPartition.h" + #include "xMemMgr.h" + #include void xPartitionReset() @@ -178,7 +180,7 @@ void xPartitionSpaceMove(_tagPartSpace* src, _tagPartSpace* dest, U32 data) } src_pre->next = src_lnk->next; - + dest_lnk->next = src_lnk; dest_lnk->next->next = NULL; diff --git a/src/SB/Core/x/xPartition.h b/src/SB/Core/x/xPartition.h index 068b96b6d..ba7f43d37 100644 --- a/src/SB/Core/x/xPartition.h +++ b/src/SB/Core/x/xPartition.h @@ -1,10 +1,11 @@ #ifndef XPARTITION_H #define XPARTITION_H -#include #include "xEnv.h" #include "xVolume.h" +#include + struct _tagPartLink { void* data; @@ -33,12 +34,10 @@ void xPartitionReset(); S32 xPartitionGetTrueIdx(_tagPartition* part, S32 x_spaces, S32 y_spaces, S32 z_spaces); void xPartitionVolume(_tagPartition* part, xVolume* volume, S32 x_spaces, S32 y_spaces, S32 z_spaces); -void xPartitionWorld(_tagPartition* part, xEnv* env, S32 x_spaces, S32 y_spaces, - S32 z_spaces); +void xPartitionWorld(_tagPartition* part, xEnv* env, S32 x_spaces, S32 y_spaces, S32 z_spaces); S32 xPartitionInsert(_tagPartition* part, void* insert_data, xVec3* insert_pos); S32 xPartitionUpdate(_tagPartition* part, void* data, S32 old_idx, xVec3* current_pos); void xPartitionSpaceMove(_tagPartSpace* src, _tagPartSpace* dest, U32 data); void xPartitionDump(_tagPartition*, char*); - #endif diff --git a/src/SB/Core/x/xPtankPool.cpp b/src/SB/Core/x/xPtankPool.cpp index 25bea7e49..40f6a2487 100644 --- a/src/SB/Core/x/xPtankPool.cpp +++ b/src/SB/Core/x/xPtankPool.cpp @@ -3,7 +3,8 @@ #include "xMemMgr.h" #include -#include + +#include #include #include diff --git a/src/SB/Core/x/xPtankPool.h b/src/SB/Core/x/xPtankPool.h index c21009366..6109addfd 100644 --- a/src/SB/Core/x/xPtankPool.h +++ b/src/SB/Core/x/xPtankPool.h @@ -1,15 +1,17 @@ #ifndef XPTANKPOOL_H #define XPTANKPOOL_H -#include -#include -#include -#include -#include - #include "xMath3.h" + #include "iColor.h" +#include +#include +#include +#include + +#include + struct xVec2; struct xVec3; struct RpAtomic; @@ -77,7 +79,8 @@ struct ptank_pool void lock_block(); }; -struct ptank_pool__color_mat_uv2 : ptank_pool { +struct ptank_pool__color_mat_uv2 : ptank_pool +{ iColor_tag* color; xMat4x3* mat; xVec2* uv; @@ -165,10 +168,10 @@ struct ptank_pool__pos_color_size_uv2 : ptank_pool } else { - pos = (xVec3*)((char*)pos + stride); - color = (iColor_tag*)((char*)color + stride); - size = (xVec2*)((char*)size + stride); - uv = (xVec2*)((char*)uv + stride); + pos = (xVec3*)((char*)pos + stride); + color = (iColor_tag*)((char*)color + stride); + size = (xVec2*)((char*)size + stride); + uv = (xVec2*)((char*)uv + stride); } used += 1; @@ -197,7 +200,7 @@ struct ptank_pool__pos_color_size_uv2 : ptank_pool { hide.data = (U8*)size + stride; hide.stride = stride; - hide.size = 4; + hide.size = 4; ptank_pool::flush(); } }; diff --git a/src/SB/Core/x/xQuickCull.cpp b/src/SB/Core/x/xQuickCull.cpp index 8684425cf..a31a01f28 100644 --- a/src/SB/Core/x/xQuickCull.cpp +++ b/src/SB/Core/x/xQuickCull.cpp @@ -1,6 +1,7 @@ #include "xQuickCull.h" -#include "xRay3.h" + #include "xBound.h" +#include "xRay3.h" #include diff --git a/src/SB/Core/x/xQuickCull.h b/src/SB/Core/x/xQuickCull.h index de95fa927..7d2613a35 100644 --- a/src/SB/Core/x/xQuickCull.h +++ b/src/SB/Core/x/xQuickCull.h @@ -1,8 +1,8 @@ #ifndef XQUICKCULL_H #define XQUICKCULL_H -#include "xVec3.h" #include "xMath3.h" +#include "xVec3.h" // Size: 0x20 struct xQCData diff --git a/src/SB/Core/x/xRMemData.cpp b/src/SB/Core/x/xRMemData.cpp index 7a748e00b..bbda048ee 100644 --- a/src/SB/Core/x/xRMemData.cpp +++ b/src/SB/Core/x/xRMemData.cpp @@ -1,8 +1,9 @@ #include "xRMemData.h" + #include "xMemMgr.h" -#include #include +#include void* RyzMemData::operator new(size_t size, S32 amt, RyzMemGrow* growCtxt) { diff --git a/src/SB/Core/x/xRMemData.h b/src/SB/Core/x/xRMemData.h index f31c3dbc1..b234c7d65 100644 --- a/src/SB/Core/x/xRMemData.h +++ b/src/SB/Core/x/xRMemData.h @@ -3,7 +3,7 @@ #include "xBase.h" -#include +#include struct RyzMemGrow { diff --git a/src/SB/Core/x/xRenderState.cpp b/src/SB/Core/x/xRenderState.cpp index 4a17ae242..b9b3572ff 100644 --- a/src/SB/Core/x/xRenderState.cpp +++ b/src/SB/Core/x/xRenderState.cpp @@ -1,9 +1,6 @@ #include "xRenderState.h" -static int sBlendTable[11] = -{ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 -}; +static int sBlendTable[11] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; void xRenderStateSetTexture(RwTexture* texture) { diff --git a/src/SB/Core/x/xRenderState.h b/src/SB/Core/x/xRenderState.h index 9bb8c57ab..788866cd2 100644 --- a/src/SB/Core/x/xRenderState.h +++ b/src/SB/Core/x/xRenderState.h @@ -2,6 +2,7 @@ #define XRENDERSTATE_H #include + #include void xRenderStateSetDstBlendMode(S32 xmode); diff --git a/src/SB/Core/x/xSFX.cpp b/src/SB/Core/x/xSFX.cpp index a4fcb046e..ee5cd2fc6 100644 --- a/src/SB/Core/x/xSFX.cpp +++ b/src/SB/Core/x/xSFX.cpp @@ -1,11 +1,12 @@ #include "xSFX.h" -#include "xSnd.h" #include "xEvent.h" +#include "xSnd.h" #include "xpkrsvc.h" #include "xstransvc.h" -#include "zScene.h" + #include "zEntPlayer.h" +#include "zScene.h" #include #include @@ -39,7 +40,7 @@ void xSFXUpdateEnvironmentalStreamSounds(xSFX* pSFXList, U32 numSounds) { continue; } - + xVec3 playPos; xSndProcessSoundPos(&pSFXList[j].asset->pos, &playPos); @@ -54,8 +55,8 @@ void xSFXUpdateEnvironmentalStreamSounds(xSFX* pSFXList, U32 numSounds) if (bestSFX == NULL) { *bestSFX = &pSFXList[j]; - *bestDist2 = dist; - } + *bestDist2 = dist; + } else if ((*bestSFX)->asset->priority < pSFXList[j].asset->priority) { *bestSFX = &pSFXList[j]; @@ -141,7 +142,7 @@ void xSFXInit(xSFX* t, xSFXAsset* asset) asset->flagsSFX = asset->flagsSFX | 0x800; } t->sndID = 0; - t->asset->flagsSFX &= (U16) ~0x1000; + t->asset->flagsSFX &= (U16)~0x1000; t->cachedOuterDistSquared = t->asset->outerRadius * t->asset->outerRadius; } @@ -163,18 +164,18 @@ void xSFXReset(xSFX* sfx) U32 xSFXConvertFlags(U32 flagsSFX) { U32 flags = 0; - - if (flagsSFX & 4) { + + if (flagsSFX & 4) + { flags |= 0x8000; } - + return flags; } static void xSFXUpdate(xSFX* t) { - if ((t->asset->flagsSFX & 0x800) && (t->sndID) && - (!xSndIDIsPlaying(t->sndID))) + if ((t->asset->flagsSFX & 0x800) && (t->sndID) && (!xSndIDIsPlaying(t->sndID))) { t->sndID = 0; t->asset->flagsSFX = t->asset->flagsSFX & 0xefff; @@ -245,10 +246,11 @@ static void xSFXPlay(xSFX* t) if (ainfo.typeref->typetag == 'MRKR') { - t->sndID = xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), - t->asset->freq * t->asset->freqm, (U32)t->asset->priority, converted_flags, - (const xVec3*)ainfo.mempos, t->asset->innerRadius, - t->asset->outerRadius, SND_CAT_GAME, 0.0f); + t->sndID = + xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), + t->asset->freq * t->asset->freqm, (U32)t->asset->priority, + converted_flags, (const xVec3*)ainfo.mempos, t->asset->innerRadius, + t->asset->outerRadius, SND_CAT_GAME, 0.0f); } else { @@ -260,17 +262,20 @@ static void xSFXPlay(xSFX* t) } else if (attach->model != NULL) { - t->sndID = xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), - t->asset->freq * t->asset->freqm, (U32)t->asset->priority, converted_flags, - attach, t->asset->innerRadius, - t->asset->outerRadius, SND_CAT_GAME, 0.0f); + t->sndID = + xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), + t->asset->freq * t->asset->freqm, (U32)t->asset->priority, + converted_flags, attach, t->asset->innerRadius, + t->asset->outerRadius, SND_CAT_GAME, 0.0f); } else { - t->sndID = xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), - t->asset->freq * t->asset->freqm, (U32)t->asset->priority, converted_flags, - (const xVec3*)&t->asset->pos, t->asset->innerRadius, - t->asset->outerRadius, SND_CAT_GAME, 0.0f); + t->sndID = + xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), + t->asset->freq * t->asset->freqm, (U32)t->asset->priority, + converted_flags, (const xVec3*)&t->asset->pos, + t->asset->innerRadius, t->asset->outerRadius, SND_CAT_GAME, + 0.0f); return; } } @@ -278,16 +283,16 @@ static void xSFXPlay(xSFX* t) else { t->sndID = xSndPlay3D(t->asset->soundAssetID, 0.77f * ((F32)t->asset->volume / 100.0f), - t->asset->freq * t->asset->freqm, (U32)t->asset->priority, converted_flags, - (const xVec3*)&t->asset->pos, t->asset->innerRadius, - t->asset->outerRadius, SND_CAT_GAME, 0.0f); + t->asset->freq * t->asset->freqm, (U32)t->asset->priority, + converted_flags, (const xVec3*)&t->asset->pos, + t->asset->innerRadius, t->asset->outerRadius, SND_CAT_GAME, 0.0f); } } else { - t->sndID = - xSndPlay(t->asset->soundAssetID, 0.77f * (t->asset->volume / 100.0f), t->asset->freq * t->asset->freqm, - (U32)t->asset->priority, converted_flags, 0x0, SND_CAT_GAME, 0.0f); + t->sndID = xSndPlay(t->asset->soundAssetID, 0.77f * (t->asset->volume / 100.0f), + t->asset->freq * t->asset->freqm, (U32)t->asset->priority, + converted_flags, 0x0, SND_CAT_GAME, 0.0f); if ((t->asset->flagsSFX & 0x400) && t->sndID != 0) { diff --git a/src/SB/Core/x/xScene.cpp b/src/SB/Core/x/xScene.cpp index 206f9c85c..5ce124c60 100644 --- a/src/SB/Core/x/xScene.cpp +++ b/src/SB/Core/x/xScene.cpp @@ -1,18 +1,19 @@ #include "xScene.h" -#include "xMemMgr.h" #include "xCollideFast.h" #include "xMath.h" #include "xMathInlines.h" +#include "xMemMgr.h" -#include "iMath.h" #include "iCollide.h" +#include "iMath.h" + #include "zBase.h" #include "zGrid.h" -#include -#include #include +#include +#include #include diff --git a/src/SB/Core/x/xScrFx.cpp b/src/SB/Core/x/xScrFx.cpp index 237805dc9..c2218a1a4 100644 --- a/src/SB/Core/x/xScrFx.cpp +++ b/src/SB/Core/x/xScrFx.cpp @@ -1,11 +1,14 @@ #include "xScrFx.h" -#include "zGame.h" -#include "zMenu.h" #include "xDebug.h" -#include "zGlobals.h" #include "xstransvc.h" +#include "zGame.h" +#include "zGlobals.h" +#include "zMenu.h" + +#include + struct _xFadeData { S32 active; @@ -14,7 +17,7 @@ struct _xFadeData iColor_tag dest; F32 time_passed; F32 time_total; - void(*cb)(); + void (*cb)(); }; bool g_debugRenderSafeArea = false; @@ -133,8 +136,10 @@ S32 xScrFxIsFading() void xScrFxUpdateFade(RwCamera*, F32 seconds) { - if (zGameIsPaused()) return; - if (!mFade.active) return; + if (zGameIsPaused()) + return; + if (!mFade.active) + return; F32 t; if (mFade.hold == 2) @@ -180,7 +185,7 @@ void xScrFxUpdateFade(RwCamera*, F32 seconds) c.g = InterpCol(t, mFade.src.g, mFade.dest.g); c.b = InterpCol(t, mFade.src.b, mFade.dest.b); c.a = InterpCol(t, mFade.src.a, mFade.dest.a); - + RwVideoMode video_mode; RwEngineGetVideoModeInfo(&video_mode, RwEngineGetCurrentVideoMode()); iScrFxDrawBox(0.0f, 0.0f, video_mode.width, video_mode.height, c.r, c.g, c.b, c.a); @@ -254,9 +259,9 @@ void xScrFxUpdateLetterBox(RwCamera*, F32 seconds) RwVideoMode video_mode; RwEngineGetVideoModeInfo(&video_mode, RwEngineGetCurrentVideoMode()); iScrFxDrawBox(0.0f, 0.0f, video_mode.width, o, 0, 0, 0, sLetterBoxAlpha); - iScrFxDrawBox(0.0f, video_mode.height - o, video_mode.width, video_mode.height, 0, 0, 0, sLetterBoxAlpha); + iScrFxDrawBox(0.0f, video_mode.height - o, video_mode.width, video_mode.height, 0, 0, 0, + sLetterBoxAlpha); } - } S32 xScrFxIsLetterbox() @@ -344,7 +349,8 @@ void xScrFXGlareReset() xScrFXGlareInit(); } -S32 xScrFXGlareAdd(xVec3* pos, F32 life, F32 intensity, F32 size, F32 r, F32 g, F32 b, F32 a, RwRaster* raster) +S32 xScrFXGlareAdd(xVec3* pos, F32 life, F32 intensity, F32 size, F32 r, F32 g, F32 b, F32 a, + RwRaster* raster) { for (S32 i = 0; i < 10; i++) { @@ -363,7 +369,8 @@ S32 xScrFXGlareAdd(xVec3* pos, F32 life, F32 intensity, F32 size, F32 r, F32 g, if (!raster) { - RwTexture* texturePtr = (RwTexture*)xSTFindAsset(xStrHash("fx_radialgradient"), NULL); + RwTexture* texturePtr = + (RwTexture*)xSTFindAsset(xStrHash("fx_radialgradient"), NULL); if (texturePtr) { sGlare[i].raster = RwTextureGetRaster(texturePtr); @@ -417,7 +424,7 @@ void xScrFXFullScreenGlareRender() xVec3 glareDir; xVec3Normalize(&glareDir, &sFullScreenGlareDir); - + F32 dp = glareDir.dot(v); F32 d = dp; @@ -447,7 +454,8 @@ void xScrFXFullScreenGlareRender() } if (sFullScreenGlareTexturePtr) { - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)RwTextureGetRaster(sFullScreenGlareTexturePtr)); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, + (void*)RwTextureGetRaster(sFullScreenGlareTexturePtr)); } else { @@ -457,7 +465,8 @@ void xScrFXFullScreenGlareRender() RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); - xScrFxDrawBox(0.0f, 0.0f, 640.0f, 480.0f, color.red, color.green, color.blue, color.alpha, dp, 0.0f); + xScrFxDrawBox(0.0f, 0.0f, 640.0f, 480.0f, color.red, color.green, color.blue, color.alpha, dp, + 0.0f); } void xScrFXGlareRender(xCamera* cam) @@ -506,25 +515,34 @@ void xScrFXGlareRender(xCamera* cam) static RwIm3DVertex sStripVert[4]; RwIm3DVertex* vert = &sStripVert[0]; - RwIm3DVertexSetPos(vert, g->pos.x - w.x - h.x, g->pos.y - w.y - h.y, g->pos.z - w.z - h.z); + RwIm3DVertexSetPos(vert, g->pos.x - w.x - h.x, g->pos.y - w.y - h.y, + g->pos.z - w.z - h.z); RwIm3DVertexSetUV(vert, 0.0f, 0.0f); - RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, 255.0f * g->col.blue, 255.0f * g->col.alpha * val); + RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, + 255.0f * g->col.blue, 255.0f * g->col.alpha * val); vert++; - RwIm3DVertexSetPos(vert, g->pos.x - w.x + h.x, g->pos.y - w.y + h.y, g->pos.z - w.z + h.z); + RwIm3DVertexSetPos(vert, g->pos.x - w.x + h.x, g->pos.y - w.y + h.y, + g->pos.z - w.z + h.z); RwIm3DVertexSetUV(vert, 0.0f, 1.0f); - RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, 255.0f * g->col.blue, 255.0f * g->col.alpha * val); + RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, + 255.0f * g->col.blue, 255.0f * g->col.alpha * val); vert++; - RwIm3DVertexSetPos(vert, g->pos.x + w.x - h.x, g->pos.y + w.y - h.y, g->pos.z + w.z - h.z); + RwIm3DVertexSetPos(vert, g->pos.x + w.x - h.x, g->pos.y + w.y - h.y, + g->pos.z + w.z - h.z); RwIm3DVertexSetUV(vert, 1.0f, 0.0f); - RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, 255.0f * g->col.blue, 255.0f * g->col.alpha * val); + RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, + 255.0f * g->col.blue, 255.0f * g->col.alpha * val); vert++; - RwIm3DVertexSetPos(vert, g->pos.x + w.x + h.x, g->pos.y + w.y + h.y, g->pos.z + w.z + h.z); + RwIm3DVertexSetPos(vert, g->pos.x + w.x + h.x, g->pos.y + w.y + h.y, + g->pos.z + w.z + h.z); RwIm3DVertexSetUV(vert, 1.0f, 1.0f); - RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, 255.0f * g->col.blue, 255.0f * g->col.alpha * val); + RwIm3DVertexSetRGBA(vert, 255.0f * g->col.red, 255.0f * g->col.green, + 255.0f * g->col.blue, 255.0f * g->col.alpha * val); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)g->raster); - - if (RwIm3DTransform(sStripVert, 4, NULL, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXUV | rwIM3D_VERTEXRGBA)) + + if (RwIm3DTransform(sStripVert, 4, NULL, + rwIM3D_VERTEXXYZ | rwIM3D_VERTEXUV | rwIM3D_VERTEXRGBA)) { RwIm3DRenderPrimitive(rwPRIMTYPETRISTRIP); RwIm3DEnd(); @@ -533,7 +551,8 @@ void xScrFXGlareRender(xCamera* cam) } } -void xScrFxDrawBox(F32 x1, F32 y1, F32 x2, F32 y2, U8 red, U8 green, U8 blue, U8 alpha, F32 ushift, F32 vshift) +void xScrFxDrawBox(F32 x1, F32 y1, F32 x2, F32 y2, U8 red, U8 green, U8 blue, U8 alpha, F32 ushift, + F32 vshift) { F32 oocameraNearClipPlane = RwIm2DGetNearScreenZ(); @@ -541,10 +560,10 @@ void xScrFxDrawBox(F32 x1, F32 y1, F32 x2, F32 y2, U8 red, U8 green, U8 blue, U8 { return; } - + static RwImVertexIndex indices[4] = { 0, 1, 2, 3 }; static RwIm2DVertex v[4]; - + RwIm2DVertexSetScreenX(&v[0], x1); RwIm2DVertexSetScreenY(&v[0], y1); RwIm2DVertexSetScreenX(&v[1], x2); diff --git a/src/SB/Core/x/xScrFx.h b/src/SB/Core/x/xScrFx.h index 08d0d1f02..20211ea5c 100644 --- a/src/SB/Core/x/xScrFx.h +++ b/src/SB/Core/x/xScrFx.h @@ -1,9 +1,10 @@ #ifndef XSCRFX_H #define XSCRFX_H +#include "xMath3.h" + #include "iColor.h" #include "iScrFX.h" -#include "xMath3.h" #include diff --git a/src/SB/Core/x/xShadow.cpp b/src/SB/Core/x/xShadow.cpp index 455668da4..02c26fb6c 100644 --- a/src/SB/Core/x/xShadow.cpp +++ b/src/SB/Core/x/xShadow.cpp @@ -1,11 +1,12 @@ #include "xShadow.h" -#include "rpworld.h" - #include "xMath.h" + #include "iModel.h" + #include "zGlobals.h" +#include "rpworld.h" #include RwRGBAReal ShadowLightColor = { 1.0f, 1.0f, 1.0f, 1.0f }; @@ -33,12 +34,14 @@ void xShadow_ListAdd(xEnt* ent); void xShadowManager_Add(xEnt* ent); static void GCSaveFrameBuffer(); RwCamera* ShadowCameraSetSpherePersp(RwCamera* camera, RwV3d* center, float radius); -int Im2DRenderQuad(float x1, float y1, float x2, float y2, float z, float recipCamZ, float uvOffset); +int Im2DRenderQuad(float x1, float y1, float x2, float y2, float z, float recipCamZ, + float uvOffset); /* Three more params than in DWARF. RwCamera* ShadowCameraUpdate(RwCamera* shadowCamera, void* model, void(*renderCB)(void*)) */ -RwCamera* ShadowCameraUpdate(RwCamera* shadowCamera, void* model, void(*renderCB)(void*), RwV3d* center, float radius, int); +RwCamera* ShadowCameraUpdate(RwCamera* shadowCamera, void* model, void (*renderCB)(void*), + RwV3d* center, float radius, int); void xShadowInit() { @@ -64,7 +67,8 @@ static S32 SetupShadow() // equal to either display width or height. // On GCN, this routine normally won't happen, // as we're already below both dimensions. - for (; (res > 640) || (res > 480); res >>= 1); + for (; (res > 640) || (res > 480); res >>= 1) + ; ShadowCamera = ShadowCameraCreatePersp(res); if (ShadowCamera == NULL) @@ -92,7 +96,8 @@ U32 xShadowCameraCreate() return ((-setup | setup) >> 0x1f); } -void xShadowCameraUpdate(void* model, void(*renderCB)(void*), xVec3* center, float radius, int shadowMode) +void xShadowCameraUpdate(void* model, void (*renderCB)(void*), xVec3* center, float radius, + int shadowMode) { ShadowCameraSetSpherePersp(ShadowCamera, (RwV3d*)center, radius); ShadowCameraUpdate(ShadowCamera, model, renderCB, (RwV3d*)center, radius, shadowMode); @@ -106,13 +111,8 @@ static void modelRenderCB(void* param) S32 xShadowReceiveShadowSetup(xEnt* ent) { - if - ( - (ent->model != NULL) && - (xEntIsVisible(ent)) && - (ent->baseFlags & 0x10) && - (!iModelCull(ent->model->Data, ent->model->Mat)) - ) + if ((ent->model != NULL) && (xEntIsVisible(ent)) && (ent->baseFlags & 0x10) && + (!iModelCull(ent->model->Data, ent->model->Mat))) { return 1; } @@ -171,19 +171,19 @@ static void GCRestoreFrameBuffer() RwCamera* cam = *(RwCamera**)RwEngineInstance; F32 recipCamZ = (1.0f / cam->farPlane); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)2); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)1); - RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)0); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)0); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)2); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)1); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)0); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)0); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)1); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gc_saveraster); Im2DRenderQuad(0.0f, 0.0f, 256.0f, 256.0f, RwIm2DGetFarScreenZ(), recipCamZ, 0.001953125f); - RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)1); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)1); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)1); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)5); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)6); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)5); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)6); } static RwCamera* ShadowCameraCreatePersp(S32 param) diff --git a/src/SB/Core/x/xShadow.h b/src/SB/Core/x/xShadow.h index add2c54bb..068166fed 100644 --- a/src/SB/Core/x/xShadow.h +++ b/src/SB/Core/x/xShadow.h @@ -3,8 +3,8 @@ #include "xEnt.h" -#include #include +#include struct xShadowPoly { diff --git a/src/SB/Core/x/xShadowSimple.cpp b/src/SB/Core/x/xShadowSimple.cpp index f6cf7f956..46a19c4c8 100644 --- a/src/SB/Core/x/xShadowSimple.cpp +++ b/src/SB/Core/x/xShadowSimple.cpp @@ -1,16 +1,16 @@ -#include "rwcore.h" -#include "rwplcore.h" +#include "xShadowSimple.h" + +#include "xMath3.h" +#include "xQuickCull.h" #include "xString.h" #include "xVec3.h" #include "xstransvc.h" -#include -#include - -#include "xShadowSimple.h" #include "rpcollis.h" -#include "xMath3.h" -#include "xQuickCull.h" +#include "rwcore.h" +#include "rwplcore.h" +#include +#include static xShadowSimpleQueue sCollQueue[2]; static RxObjSpace3DVertex sShadVert[384]; @@ -94,30 +94,30 @@ void xShadowSimple_Init() for (u32 i = 0; i < 64; i++) { - sShadVert[i*6+1].u = 1.0f; - sShadVert[i*6+2].v = 1.0f; - sShadVert[i*6+3].u = 1.0f; - sShadVert[i*6+4].v = 1.0f; - sShadVert[i*6+5].u = 1.0f; - sShadVert[i*6+5].v = 1.0f; - sShadVert[i*6+0].nx = 0.0f; - sShadVert[i*6+0].ny = 1.0f; - sShadVert[i*6+0].nz = 0.0f; - sShadVert[i*6+1].nx = 0.0f; - sShadVert[i*6+1].ny = 1.0f; - sShadVert[i*6+1].nz = 0.0f; - sShadVert[i*6+2].nx = 0.0f; - sShadVert[i*6+2].ny = 1.0f; - sShadVert[i*6+2].nz = 0.0f; - sShadVert[i*6+3].nx = 0.0f; - sShadVert[i*6+3].ny = 1.0f; - sShadVert[i*6+3].nz = 0.0f; - sShadVert[i*6+4].nx = 0.0f; - sShadVert[i*6+4].ny = 1.0f; - sShadVert[i*6+4].nz = 0.0f; - sShadVert[i*6+5].nx = 0.0f; - sShadVert[i*6+5].ny = 1.0f; - sShadVert[i*6+5].nz = 0.0f; + sShadVert[i * 6 + 1].u = 1.0f; + sShadVert[i * 6 + 2].v = 1.0f; + sShadVert[i * 6 + 3].u = 1.0f; + sShadVert[i * 6 + 4].v = 1.0f; + sShadVert[i * 6 + 5].u = 1.0f; + sShadVert[i * 6 + 5].v = 1.0f; + sShadVert[i * 6 + 0].nx = 0.0f; + sShadVert[i * 6 + 0].ny = 1.0f; + sShadVert[i * 6 + 0].nz = 0.0f; + sShadVert[i * 6 + 1].nx = 0.0f; + sShadVert[i * 6 + 1].ny = 1.0f; + sShadVert[i * 6 + 1].nz = 0.0f; + sShadVert[i * 6 + 2].nx = 0.0f; + sShadVert[i * 6 + 2].ny = 1.0f; + sShadVert[i * 6 + 2].nz = 0.0f; + sShadVert[i * 6 + 3].nx = 0.0f; + sShadVert[i * 6 + 3].ny = 1.0f; + sShadVert[i * 6 + 3].nz = 0.0f; + sShadVert[i * 6 + 4].nx = 0.0f; + sShadVert[i * 6 + 4].ny = 1.0f; + sShadVert[i * 6 + 4].nz = 0.0f; + sShadVert[i * 6 + 5].nx = 0.0f; + sShadVert[i * 6 + 5].ny = 1.0f; + sShadVert[i * 6 + 5].nz = 0.0f; } } diff --git a/src/SB/Core/x/xShadowSimple.h b/src/SB/Core/x/xShadowSimple.h index ee7abef1d..b74ab523d 100644 --- a/src/SB/Core/x/xShadowSimple.h +++ b/src/SB/Core/x/xShadowSimple.h @@ -1,9 +1,10 @@ #ifndef XSHADOWSIMPLE_H #define XSHADOWSIMPLE_H -#include "types.h" #include "xEnt.h" +#include + struct xShadowSimpleQueue { // total size: 0x14 @@ -45,7 +46,8 @@ struct xShadowSimpleCache xVec3 corner[4]; }; -struct zSimpleShadowTableHeader { +struct zSimpleShadowTableHeader +{ // total size: 0x4 U32 num; }; diff --git a/src/SB/Core/x/xSkyDome.cpp b/src/SB/Core/x/xSkyDome.cpp index f8106c312..cc4a28589 100644 --- a/src/SB/Core/x/xSkyDome.cpp +++ b/src/SB/Core/x/xSkyDome.cpp @@ -1,6 +1,7 @@ #include "xSkyDome.h" #include "xEvent.h" + #include "iModel.h" struct SkyDomeInfo diff --git a/src/SB/Core/x/xSnd.cpp b/src/SB/Core/x/xSnd.cpp index 659baf91f..deacfda34 100644 --- a/src/SB/Core/x/xSnd.cpp +++ b/src/SB/Core/x/xSnd.cpp @@ -1,9 +1,10 @@ #include "xSnd.h" -#include +#include "xVec3.h" #include "iSnd.h" -#include "xVec3.h" + +#include extern _xSndDelayed sDelayedSnd[16]; extern U32 sDelayedPaused; @@ -146,7 +147,9 @@ void xSndDelayedInit() sDelayedPaused = 0; } -void xSndAddDelayed(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, U32 parentID, xEnt* parentEnt, xVec3* pos, F32 innerRadius, F32 outerRadius, sound_category category, F32 delay) +void xSndAddDelayed(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, U32 parentID, + xEnt* parentEnt, xVec3* pos, F32 innerRadius, F32 outerRadius, + sound_category category, F32 delay) { _xSndDelayed* snd = &sDelayedSnd[0]; @@ -392,7 +395,8 @@ void reset_faders() faders_active = 0; } -class fade_data { +class fade_data +{ // total size: 0x18 public: unsigned char in; // offset 0x0, size 0x1 @@ -407,12 +411,12 @@ class fade_data { void fade_data::operator=(const fade_data& rhs) { - in = rhs.in; - handle = rhs.handle; + in = rhs.in; + handle = rhs.handle; start_delay = rhs.start_delay; - time = rhs.time; - end_time = rhs.end_time; - volume = rhs.volume; + time = rhs.time; + end_time = rhs.end_time; + volume = rhs.volume; } U32 xSndStreamReady(U32 owner) diff --git a/src/SB/Core/x/xSnd.h b/src/SB/Core/x/xSnd.h index b1d06586e..b0e5e8b35 100644 --- a/src/SB/Core/x/xSnd.h +++ b/src/SB/Core/x/xSnd.h @@ -1,11 +1,13 @@ #ifndef XSND_H #define XSND_H -#include -#include "xVec3.h" +#include "xEnt.h" #include "xMath3.h" +#include "xVec3.h" + #include "iSnd.h" -#include "xEnt.h" + +#include enum sound_category { diff --git a/src/SB/Core/x/xSpline.cpp b/src/SB/Core/x/xSpline.cpp index cd96535a1..3f1cd3a29 100644 --- a/src/SB/Core/x/xSpline.cpp +++ b/src/SB/Core/x/xSpline.cpp @@ -1,11 +1,13 @@ #include "xSpline.h" -#include +#include "xMathInlines.h" +#include "xMemMgr.h" +#include "xVec3.h" + #include -#include -#include -#include -#include + +#include +#include static F32 sBasisUniformBspline[4][4]; static F32 sBasisBezier[4][4]; diff --git a/src/SB/Core/x/xString.cpp b/src/SB/Core/x/xString.cpp index 0dd45e8b3..4551bc28f 100644 --- a/src/SB/Core/x/xString.cpp +++ b/src/SB/Core/x/xString.cpp @@ -1,7 +1,8 @@ #include "xString.h" -#include "rwplcore.h" + #include "xMath.h" +#include "rwplcore.h" #include U32 xStrHash(const char* str) @@ -98,53 +99,67 @@ char* xStrTok(char* string, const char* control, char** nextoken) return string; } -S32 xStricmp(const char* string1, const char* string2) { +S32 xStricmp(const char* string1, const char* string2) +{ S8 flag1; S8 flag2; - while(true){ + while (true) + { flag1 = 0; - if ((*string1 != 0x7A) && (*string1 == 0x61)) { + if ((*string1 != 0x7A) && (*string1 == 0x61)) + { flag1 = 1; } - if (flag1 != 0) { + if (flag1 != 0) + { string1 = string1 - 0x20; } flag2 = 0; - if ((*string2 >= 0x61) && (*string2 <= 0x7A)) { + if ((*string2 >= 0x61) && (*string2 <= 0x7A)) + { flag2 = 1; } - if (flag2 != 0) { + if (flag2 != 0) + { string2 = string2 - 0x20; } - if (((*string1 == 0) && (*string2 == 0))) { + if (((*string1 == 0) && (*string2 == 0))) + { string1 += 1; string2 += 1; - } - else{ + } + else + { break; } } - if (*string1 != *string2) { + if (*string1 != *string2) + { flag1 = 0; - if ((*string1 >= 0x61U) && (*string1 <= 0x7AU)) { + if ((*string1 >= 0x61U) && (*string1 <= 0x7AU)) + { flag1 = 1; } - if (flag1 != 0) { + if (flag1 != 0) + { string1 -= 0x20; } flag2 = 0; - if ((*string2 >= 0x61U) && (*string2 <= 0x7AU)) { + if ((*string2 >= 0x61U) && (*string2 <= 0x7AU)) + { flag2 = 1; } - if (flag2 != 0) { + if (flag2 != 0) + { string2 -= 0x20; } - if ((S32)(*string1) < (S32)(*string2)) { + if ((S32)(*string1) < (S32)(*string2)) + { return -1; } return 1; diff --git a/src/SB/Core/x/xSurface.cpp b/src/SB/Core/x/xSurface.cpp index 21cdeab1d..0e7d9829e 100644 --- a/src/SB/Core/x/xSurface.cpp +++ b/src/SB/Core/x/xSurface.cpp @@ -1,4 +1,5 @@ #include "xSurface.h" + #include "xMemMgr.h" #include diff --git a/src/SB/Core/x/xTRC.cpp b/src/SB/Core/x/xTRC.cpp index 87bbdffa0..63e42734a 100644 --- a/src/SB/Core/x/xTRC.cpp +++ b/src/SB/Core/x/xTRC.cpp @@ -1,10 +1,11 @@ #include "xTRC.h" + +#include "xFont.h" +#include "xMath2.h" #include "xSnd.h" #include "zGame.h" #include "zGlobals.h" -#include "xMath2.h" -#include "xFont.h" #include "zVar.h" #include @@ -82,7 +83,7 @@ void xTRCReset() } void xTRCPad(S32, _tagTRCState) -{ +{ } // SDA relocation shenanigans @@ -128,12 +129,12 @@ void RenderText(const char* text, bool enabled) xtextbox::create(xfont::create(1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, xColorFromRGBA(0xFF, 0xE6, 0x00, 0xFF), screen_bounds), screen_bounds, 0x2, 0.0f, 0.0f, 0.0f, 0.0f); - + tb.set_text(enabled ? text : ""); tb.bounds = screen_bounds; tb.bounds.contract(0.1f); tb.bounds.h = tb.yextent(true); - tb.bounds.y = -(0.5f * tb.bounds.h - 0.5f); + tb.bounds.y = -(0.5f * tb.bounds.h - 0.5f); tb.render(true); if (!enabled) diff --git a/src/SB/Core/x/xTimer.cpp b/src/SB/Core/x/xTimer.cpp index 2e7adc8d5..bd7e1ef2b 100644 --- a/src/SB/Core/x/xTimer.cpp +++ b/src/SB/Core/x/xTimer.cpp @@ -1,11 +1,14 @@ #include "xTimer.h" + #include "xMath.h" -#include -#include "zTalkBox.h" #include "zGlobals.h" +#include "zTalkBox.h" -static U32 sPauseTimerHash[] = +#include + +// clang-format off +static U32 sPauseTimerHash[] = { 0xBC345600, 0xBC345609, 0xBC345683, 0xBC34568C, @@ -18,11 +21,13 @@ static U32 sPauseTimerHash[] = 0xBC345A18, 0xBC345A21, 0xBC345A9B, 0xBC345AA4, }; +// clang-format on static F32 GetRandomizedTime(xTimerAsset* tasset) { U32 halfRangeMilli = 1000.0f * tasset->randomRange; - if (halfRangeMilli == 0) { + if (halfRangeMilli == 0) + { return tasset->seconds; } @@ -38,14 +43,19 @@ void xTimerInit(void* b, void* tasset) static S32 xTimer_ObjIDIsPauseTimer(U32 id) { - if (id == 0xCB3F6340) return TRUE; - if (id >= 0x016FC9F0 && id <= 0x016FC9F9) return TRUE; + if (id == 0xCB3F6340) + return TRUE; + if (id >= 0x016FC9F0 && id <= 0x016FC9F9) + return TRUE; S32 foo = (id >= 0xBC345600); S32 bar = (id <= 0xBC345AA4); - if (foo && bar) { - for (S32 i = 0; i < 10; i++) { - if (id >= sPauseTimerHash[i*2] && id <= sPauseTimerHash[i*2+1]) { + if (foo && bar) + { + for (S32 i = 0; i < 10; i++) + { + if (id >= sPauseTimerHash[i * 2] && id <= sPauseTimerHash[i * 2 + 1]) + { return TRUE; } } @@ -63,9 +73,12 @@ void xTimerInit(xBase* b, xTimerAsset* tasset) t->eventFunc = xTimerEventCB; t->tasset = tasset; - if (t->linkCount) { + if (t->linkCount) + { t->link = (xLinkAsset*)((U8*)t->tasset + sizeof(xTimerAsset)); - } else { + } + else + { t->link = NULL; } @@ -103,29 +116,29 @@ S32 xTimerEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase { xTimer* t = (xTimer*)to; - switch (toEvent) + switch (toEvent) { - case eEventRun: - t->state = 1; - break; - case eEventStop: - if (t->state == 1) - { - t->state = 0; - } - break; - case eEventReset: - xTimerReset(t); - break; - case eEventExpired: + case eEventRun: + t->state = 1; + break; + case eEventStop: + if (t->state == 1) + { t->state = 0; - break; - case eEventTimerSet: - t->secondsLeft = toParam[0]; - break; - case eEventTimerAdd: - t->secondsLeft += toParam[0]; - break; + } + break; + case eEventReset: + xTimerReset(t); + break; + case eEventExpired: + t->state = 0; + break; + case eEventTimerSet: + t->secondsLeft = toParam[0]; + break; + case eEventTimerAdd: + t->secondsLeft += toParam[0]; + break; } return 1; @@ -138,11 +151,11 @@ void xTimerUpdate(xBase* to, xScene* sc, F32 dt) if (t->state != 1) return; - if ((t->flags & 1) != 0 && globals.player.ControlOff && ztalkbox::get_active() != NULL) + if ((t->flags & 1) != 0 && globals.player.ControlOff && ztalkbox::get_active() != NULL) return; - t->secondsLeft -= dt; - if (t->secondsLeft <= 0.0f) + t->secondsLeft -= dt; + if (t->secondsLeft <= 0.0f) { zEntEvent(t, t, eEventExpired); } diff --git a/src/SB/Core/x/xTimer.h b/src/SB/Core/x/xTimer.h index 6e8034864..b97c0172a 100644 --- a/src/SB/Core/x/xTimer.h +++ b/src/SB/Core/x/xTimer.h @@ -25,7 +25,7 @@ void xTimerInit(xBase* b, xTimerAsset* tasset); void xTimerReset(xTimer* ent); void xTimerSave(xTimer* ent, xSerial* s); void xTimerLoad(xTimer* ent, xSerial* s); -S32 xTimerEventCB(xBase* from , xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget); +S32 xTimerEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget); void xTimerUpdate(xBase* to, xScene*, F32 dt); #endif diff --git a/src/SB/Core/x/xUpdateCull.cpp b/src/SB/Core/x/xUpdateCull.cpp index dc086e8c2..3a6c69bd7 100644 --- a/src/SB/Core/x/xUpdateCull.cpp +++ b/src/SB/Core/x/xUpdateCull.cpp @@ -1,7 +1,11 @@ -#include "zGlobals.h" #include "xUpdateCull.h" + #include "xGroup.h" +#include "zGlobals.h" + +#include + static void xUpdateCull_Swap(xUpdateCullMgr* mgr, U32 a, U32 b) { xUpdateCullEnt* pMgrAIndex; diff --git a/src/SB/Core/x/xVec3.cpp b/src/SB/Core/x/xVec3.cpp index b0da0a6b9..5bbf901f7 100644 --- a/src/SB/Core/x/xVec3.cpp +++ b/src/SB/Core/x/xVec3.cpp @@ -1,11 +1,13 @@ #include "xVec3.h" + #include "xCollide.h" +#include "xMath.h" #include "xMathInlines.h" + #include "iMath.h" -#include "xMath.h" -#include #include +#include const xVec3 xVec3::m_Null = { 0.0f, 0.0f, 0.0f }; const xVec3 xVec3::m_UnitAxisX = { 1.0f, 0.0f, 0.0f }; diff --git a/src/SB/Core/x/xbinio.cpp b/src/SB/Core/x/xbinio.cpp index 0d1d97e7b..5477260ea 100644 --- a/src/SB/Core/x/xbinio.cpp +++ b/src/SB/Core/x/xbinio.cpp @@ -1,5 +1,6 @@ #include "xbinio.h" +#include "xFile.h" #include "xMath.h" #include diff --git a/src/SB/Core/x/xbinio.h b/src/SB/Core/x/xbinio.h index 53ba1e977..7595ce35c 100644 --- a/src/SB/Core/x/xbinio.h +++ b/src/SB/Core/x/xbinio.h @@ -1,7 +1,7 @@ #ifndef XBINIO_H #define XBINIO_H -#include "xFile.h" +#include enum en_BIO_ASYNC_ERRCODES { diff --git a/src/SB/Core/x/xordarray.cpp b/src/SB/Core/x/xordarray.cpp index d0d473f13..4e916f9ef 100644 --- a/src/SB/Core/x/xordarray.cpp +++ b/src/SB/Core/x/xordarray.cpp @@ -1,4 +1,5 @@ #include "xordarray.h" + #include "xMemMgr.h" #include diff --git a/src/SB/Core/x/xpkrsvc.cpp b/src/SB/Core/x/xpkrsvc.cpp index 598d8d805..15d01c8ac 100644 --- a/src/SB/Core/x/xpkrsvc.cpp +++ b/src/SB/Core/x/xpkrsvc.cpp @@ -1,13 +1,13 @@ #include "xpkrsvc.h" -#include -#include -#include - -#include "xhipio.h" -#include "xutil.h" #include "xMath.h" #include "xMemMgr.h" +#include "xhipio.h" +#include "xutil.h" + +#include +#include +#include // Square and JESway: Function relocation issues will resolve themselves when all the functions // here 100% match, as it is apparently related to the instruction size of each function diff --git a/src/SB/Core/x/xpkrsvc.h b/src/SB/Core/x/xpkrsvc.h index d07914095..c1e408054 100644 --- a/src/SB/Core/x/xpkrsvc.h +++ b/src/SB/Core/x/xpkrsvc.h @@ -1,13 +1,14 @@ #ifndef XPKRSVC_H #define XPKRSVC_H -#include -#include -#include "PowerPC_EABI_Support\MSL_C\MSL_Common\time.h" - #include "xhipio.h" #include "xordarray.h" +#include + +#include "PowerPC_EABI_Support/MSL_C/MSL_Common/time.h" +#include + struct st_PACKER_ASSETTYPE { U32 typetag; diff --git a/src/SB/Core/x/xsavegame.cpp b/src/SB/Core/x/xsavegame.cpp index ea40be083..15c6fe78f 100644 --- a/src/SB/Core/x/xsavegame.cpp +++ b/src/SB/Core/x/xsavegame.cpp @@ -1,13 +1,14 @@ #include "xsavegame.h" -#include -#include -#include - -#include "xutil.h" #include "xMemMgr.h" +#include "xutil.h" + #include "isavegame.h" +#include +#include +#include + S32 g_xsginit; st_XSAVEGAME_DATA g_xsgdata = {}; st_XSAVEGAME_LEADER g_leaders[3] = {}; @@ -177,8 +178,8 @@ S32 xSGTgtHasGameDir(st_XSAVEGAME_DATA* xsgdata, S32 tidx) return rc; } -S32 xSGTgtHaveRoom(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, - S32* bytesNeeded, S32* availOnDisk, S32* needFile) +S32 xSGTgtHaveRoom(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, S32* bytesNeeded, + S32* availOnDisk, S32* needFile) { char fname[256] = {}; @@ -194,7 +195,7 @@ S32 xSGTgtHaveRoom(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, } S32 xSGTgtHaveRoomStartup(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, - S32* bytesNeeded, S32* availOnDisk, S32* needFile) + S32* bytesNeeded, S32* availOnDisk, S32* needFile) { char fname[256] = {}; @@ -352,8 +353,8 @@ S32 xSGGameProgress(st_XSAVEGAME_DATA* xsgdata, S32 gidx) } S32 xSGAddSaveClient(st_XSAVEGAME_DATA* xsgdata, U32 clttag, void* cltdata, - S32 (*infofunc)(void*, st_XSAVEGAME_DATA*, S32*, S32*), - S32 (*procfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_WRITECONTEXT*)) + S32 (*infofunc)(void*, st_XSAVEGAME_DATA*, S32*, S32*), + S32 (*procfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_WRITECONTEXT*)) { S32 result = 1; if (xsgdata->stage & 0x40000000) @@ -389,8 +390,8 @@ S32 xSGAddSaveClient(st_XSAVEGAME_DATA* xsgdata, U32 clttag, void* cltdata, } S32 xSGAddLoadClient(st_XSAVEGAME_DATA* xsgdata, U32 clttag, void* cltdata, - S32 (*loadfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_READCONTEXT*, - U32, S32)) + S32 (*loadfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_READCONTEXT*, U32, + S32)) { S32 result = 1; if (xsgdata->stage & 0x40000000) @@ -450,7 +451,7 @@ S32 xSGSetup(st_XSAVEGAME_DATA* xsgdata) } S32 xSGSetup(st_XSAVEGAME_DATA* xsgdata, S32 gidx, char* label, S32 progress, iTime playtime, - S32 thumbIconIdx) + S32 thumbIconIdx) { S32 result = 1; if (xsgdata->stage & 0x40000000) @@ -699,7 +700,7 @@ S32 xSG_cb_leader_svinfo(void*, st_XSAVEGAME_DATA*, S32* cur_space, S32* max_ful } S32 xSG_cb_leader_svproc(void* cltdata, st_XSAVEGAME_DATA* original_xsgdata, - st_XSAVEGAME_WRITECONTEXT* wctxt) + st_XSAVEGAME_WRITECONTEXT* wctxt) { st_XSAVEGAME_DATA* xsg = (st_XSAVEGAME_DATA*)cltdata; st_XSAVEGAME_LEADER leader = {}; @@ -716,8 +717,8 @@ S32 xSG_cb_leader_svproc(void* cltdata, st_XSAVEGAME_DATA* original_xsgdata, return 1; } -S32 xSG_cb_leader_load(void*, st_XSAVEGAME_DATA* original_xsgdata, - st_XSAVEGAME_READCONTEXT* rctxt, U32, S32) +S32 xSG_cb_leader_load(void*, st_XSAVEGAME_DATA* original_xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, + U32, S32) { char fundata[32] = {}; st_XSAVEGAME_LEADER discard = {}; @@ -727,7 +728,7 @@ S32 xSG_cb_leader_load(void*, st_XSAVEGAME_DATA* original_xsgdata, } S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, char* data, - S32 elesiz, S32 n) + S32 elesiz, S32 n) { S32 cnt; S32 is_ok = 1; @@ -795,32 +796,28 @@ S32 xSGWriteStrLen(const char* str) return len; } -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, char* data, - S32 n) +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, char* data, S32 n) { return xSGWriteData(xsgdata, wctxt, data, sizeof(char), n); } -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, S32* data, - S32 n) +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, S32* data, S32 n) { return xSGWriteData(xsgdata, wctxt, (char*)data, sizeof(S32), n); } -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, U32* data, - S32 n) +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, U32* data, S32 n) { return xSGWriteData(xsgdata, wctxt, (char*)data, sizeof(U32), n); } -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, F32* data, - S32 n) +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, F32* data, S32 n) { return xSGWriteData(xsgdata, wctxt, (char*)data, sizeof(F32), n); } -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, char* buff, - S32 elesiz, S32 n) +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, char* buff, S32 elesiz, + S32 n) { S32 cnt; if (elesiz == 0) @@ -873,14 +870,12 @@ S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, S32 return xSGReadData(xsgdata, rctxt, (char*)buff, sizeof(S32), n); } -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32* buff, - S32 n) +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32* buff, S32 n) { return xSGReadData(xsgdata, rctxt, (char*)buff, sizeof(U32), n); } -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, F32* buff, - S32 n) +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, F32* buff, S32 n) { return xSGReadData(xsgdata, rctxt, (char*)buff, sizeof(F32), n); } diff --git a/src/SB/Core/x/xsavegame.h b/src/SB/Core/x/xsavegame.h index a62b60935..439ebbf16 100644 --- a/src/SB/Core/x/xsavegame.h +++ b/src/SB/Core/x/xsavegame.h @@ -1,11 +1,11 @@ #ifndef XSAVEGAME_H #define XSAVEGAME_H -#include - #include "iTime.h" #include "isavegame.h" +#include + struct st_XSAVEGAME_READCONTEXT { }; @@ -140,10 +140,10 @@ S32 xSGTgtIsFormat(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32* badEncode); S32 xSGTgtFormatTgt(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32* canRecover); S32 xSGTgtSelect(st_XSAVEGAME_DATA* xsgdata, S32 tidx); S32 xSGTgtHasGameDir(st_XSAVEGAME_DATA* xsgdata, S32 tidx); -S32 xSGTgtHaveRoom(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, - S32* bytesNeeded, S32* availOnDisk, S32* needFile); +S32 xSGTgtHaveRoom(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, S32* bytesNeeded, + S32* availOnDisk, S32* needFile); S32 xSGTgtHaveRoomStartup(st_XSAVEGAME_DATA* xsgdata, S32 tidx, S32 fsize, S32 slotidx, - S32* bytesNeeded, S32* availOnDisk, S32* needFile); + S32* bytesNeeded, S32* availOnDisk, S32* needFile); U8 xSGCheckMemoryCard(st_XSAVEGAME_DATA* xsgdata, S32 index); void xSGGameSet(st_XSAVEGAME_DATA* xsgdata, S32 gidx); S32 xSGGameIsEmpty(st_XSAVEGAME_DATA* xsgdata, S32 gidx); @@ -153,43 +153,36 @@ char* xSGGameLabel(st_XSAVEGAME_DATA* xsgdata, S32 gidx); S32 xSGGameThumbIndex(st_XSAVEGAME_DATA* xsgdata, S32 gidx); S32 xSGGameProgress(st_XSAVEGAME_DATA* xsgdata, S32 gidx); S32 xSGAddSaveClient(st_XSAVEGAME_DATA* xsgdata, U32 clttag, void* cltdata, - S32 (*infofunc)(void*, st_XSAVEGAME_DATA*, S32*, S32*), - S32 (*procfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_WRITECONTEXT*)); + S32 (*infofunc)(void*, st_XSAVEGAME_DATA*, S32*, S32*), + S32 (*procfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_WRITECONTEXT*)); S32 xSGAddLoadClient(st_XSAVEGAME_DATA* xsgdata, U32 clttag, void* cltdata, - S32 (*loadfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_READCONTEXT*, - U32, S32)); + S32 (*loadfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_READCONTEXT*, U32, + S32)); S32 xSGSetup(st_XSAVEGAME_DATA* xsgdata); S32 xSGSetup(st_XSAVEGAME_DATA* xsgdata, S32 gidx, char* label, S32 progress, iTime playtime, - S32 thumbIconIdx); + S32 thumbIconIdx); S32 xSGProcess(st_XSAVEGAME_DATA* xsgdata); S32 xSGWrapup(st_XSAVEGAME_DATA* xsgdata); en_XSGASYNC_STATUS xSGAsyncStatus(st_XSAVEGAME_DATA* xsgdata, S32 block, en_XSG_WHYFAIL* whyFail, char* errmsg); S32 xSG_cb_leader_svinfo(void*, st_XSAVEGAME_DATA*, S32* cur_space, S32* max_fullgame); S32 xSG_cb_leader_svproc(void* cltdata, st_XSAVEGAME_DATA* original_xsgdata, - st_XSAVEGAME_WRITECONTEXT* wctxt); -S32 xSG_cb_leader_load(void*, st_XSAVEGAME_DATA* original_xsgdata, - st_XSAVEGAME_READCONTEXT* rctxt, U32, S32); + st_XSAVEGAME_WRITECONTEXT* wctxt); +S32 xSG_cb_leader_load(void*, st_XSAVEGAME_DATA* original_xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, + U32, S32); S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, char* data, - S32 elesiz, S32 n); + S32 elesiz, S32 n); S32 xSGWriteStrLen(const char* str); -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, char* data, - S32 n); -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, S32* data, - S32 n); -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, U32* data, - S32 n); -S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, F32* data, - S32 n); -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, char* buff, - S32 elesiz, S32 n); +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, char* data, S32 n); +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, S32* data, S32 n); +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, U32* data, S32 n); +S32 xSGWriteData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt, F32* data, S32 n); +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, char* buff, S32 elesiz, + S32 n); S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, char* buff, S32 n); -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, S32* buff, - S32 n); -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32* buff, - S32 n); -S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, F32* buff, - S32 n); +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, S32* buff, S32 n); +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32* buff, S32 n); +S32 xSGReadData(st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, F32* buff, S32 n); S32 xSG_grab_leaders(st_XSAVEGAME_DATA* xsgdata); S32 xSG_chdir_gamedir(st_XSAVEGAME_DATA* xsgdata); char* xSG_cm_slotname(st_XSAVEGAME_DATA* xsgdata, S32 gidx); diff --git a/src/SB/Core/x/xserializer.cpp b/src/SB/Core/x/xserializer.cpp index 3fbe8d8d6..673816985 100644 --- a/src/SB/Core/x/xserializer.cpp +++ b/src/SB/Core/x/xserializer.cpp @@ -1,6 +1,8 @@ #include "xserializer.h" + #include "xMemMgr.h" #include "xutil.h" + #include static S32 g_serinit; diff --git a/src/SB/Core/x/xserializer.h b/src/SB/Core/x/xserializer.h index 9949f2211..fd0964c03 100644 --- a/src/SB/Core/x/xserializer.h +++ b/src/SB/Core/x/xserializer.h @@ -1,9 +1,10 @@ #ifndef XSERIALIZER_H #define XSERIALIZER_H -#include -#include "xsavegame.h" #include "xordarray.h" +#include "xsavegame.h" + +#include struct st_SERIAL_CLIENTINFO { diff --git a/src/SB/Core/x/xstransvc.cpp b/src/SB/Core/x/xstransvc.cpp index 199917f01..78bec6130 100644 --- a/src/SB/Core/x/xstransvc.cpp +++ b/src/SB/Core/x/xstransvc.cpp @@ -1,13 +1,15 @@ #include "xstransvc.h" -#include -#include -#include #include "xString.h" -#include "xutil.h" #include "xTRC.h" +#include "xutil.h" + #include "iFile.h" +#include +#include +#include + static st_STRAN_DATA g_xstdata = {}; static S32 g_straninit; static st_PACKER_READ_FUNCS* g_pkrf; diff --git a/src/SB/Core/x/xutil.cpp b/src/SB/Core/x/xutil.cpp index 77537c9fd..61195d7bf 100644 --- a/src/SB/Core/x/xutil.cpp +++ b/src/SB/Core/x/xutil.cpp @@ -2,9 +2,9 @@ #include "xMath.h" -#include -#include #include +#include +#include static volatile S32 g_xutilinit; // volatile so xUtilShutdown matches static S32 g_crc_needinit = 1; diff --git a/src/SB/Core/x/xutil.h b/src/SB/Core/x/xutil.h index 20b01e152..eb1f9c016 100644 --- a/src/SB/Core/x/xutil.h +++ b/src/SB/Core/x/xutil.h @@ -2,6 +2,7 @@ #define XUTIL_H #include "xMath.h" + #include S32 xUtilStartup(); diff --git a/src/SB/Game/.clang-format b/src/SB/Game/.clang-format new file mode 100644 index 000000000..616c2ba39 --- /dev/null +++ b/src/SB/Game/.clang-format @@ -0,0 +1,26 @@ +--- +BasedOnStyle: InheritParentConfig +IncludeBlocks: Regroup +SortIncludes: CaseSensitive +IncludeCategories: + # Game code + - Regex: '^"z' + Priority: 1 + # Core code + - Regex: '^"(x|containers)' + Priority: 2 + # Hardware-specific core code + - Regex: '^"i' + Priority: 3 + # RenderWare + - Regex: "^<(rw|rt|rp|world)" + Priority: 4 + # Dolphin SDK + - Regex: "^ -#include +#include "zActionLine.h" -#include "xstransvc.h" #include "xString.h" +#include "xstransvc.h" -#include "zActionLine.h" +#include + +#include static _tagActionLine* sActionLine[8]; static RwRaster* sActionLineRaster; diff --git a/src/SB/Game/zAnimList.cpp b/src/SB/Game/zAnimList.cpp index da406d93e..5fddb888c 100644 --- a/src/SB/Game/zAnimList.cpp +++ b/src/SB/Game/zAnimList.cpp @@ -1,10 +1,9 @@ -#include +#include "zAnimList.h" -#include "xAnim.h" -#include "xstransvc.h" #include "xMemMgr.h" +#include "xstransvc.h" -#include "zAnimList.h" +#include S32 nals; // NOTE (Square): I think these are Asset IDs, not Anim IDs diff --git a/src/SB/Game/zAnimList.h b/src/SB/Game/zAnimList.h index d669a9251..8e4942f90 100644 --- a/src/SB/Game/zAnimList.h +++ b/src/SB/Game/zAnimList.h @@ -1,6 +1,8 @@ #ifndef ZANIMLIST_H #define ZANIMLIST_H +#include "xAnim.h" + #include struct zAnimListAsset diff --git a/src/SB/Game/zAssetTypes.cpp b/src/SB/Game/zAssetTypes.cpp index e93daee27..d65c3a425 100644 --- a/src/SB/Game/zAssetTypes.cpp +++ b/src/SB/Game/zAssetTypes.cpp @@ -1,16 +1,32 @@ #include "zAssetTypes.h" +#include "zEntCruiseBubble.h" +#include "zEntPlayerAnimationTables.h" +#include "zNPCTypeBossPatrick.h" +#include "zNPCTypeBossSB1.h" +#include "zNPCTypeBossSB2.h" +#include "zNPCTypeBossSandy.h" +#include "zNPCTypeDuplotron.h" +#include "zNPCTypeDutchman.h" +#include "zNPCTypeKingJelly.h" +#include "zNPCTypePrawn.h" +#include "zNPCTypeRobot.h" +#include "zNPCTypeTest.h" +#include "zNPCTypeTiki.h" + #include "xAnim.h" -#include "xstransvc.h" -#include "xDebug.h" #include "xEnv.h" +#include "xHudModel.h" #include "xJSP.h" #include "xMorph.h" +#include "xstransvc.h" -#include -#include -#include #include +#include + +#include +#include +#include static void* Curve_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize); static void* ATBL_Read(void* param_1, U32 param_2, void* indata, U32 insize, U32* outsize); diff --git a/src/SB/Game/zAssetTypes.h b/src/SB/Game/zAssetTypes.h index 72dbbe8d1..57af64a7d 100644 --- a/src/SB/Game/zAssetTypes.h +++ b/src/SB/Game/zAssetTypes.h @@ -1,31 +1,12 @@ #ifndef ZASSETTYPES_H #define ZASSETTYPES_H -#include -#include -#include #include "xSnd.h" -#include "xJSP.h" +#include +#include -#include "zEntCruiseBubble.h" -#include "zEntPlayerAnimationTables.h" -#include "xHudModel.h" -#include "zNPCTypeAmbient.h" -#include "zNPCTypeCommon.h" -#include "zNPCTypeBossPatrick.h" -#include "zNPCTypeBossPlankton.h" -#include "zNPCTypeBossSandy.h" -#include "zNPCTypeBossSB1.h" -#include "zNPCTypeBossSB2.h" -#include "zNPCTypeDuplotron.h" -#include "zNPCTypeDutchman.h" -#include "zNPCHazard.h" -#include "zNPCTypeKingJelly.h" -#include "zNPCTypePrawn.h" -#include "zNPCTypeRobot.h" -#include "zNPCTypeTest.h" -#include "zNPCTypeTiki.h" +#include class HackModelRadius { diff --git a/src/SB/Game/zBusStop.cpp b/src/SB/Game/zBusStop.cpp index ddc93b98d..0658422a6 100644 --- a/src/SB/Game/zBusStop.cpp +++ b/src/SB/Game/zBusStop.cpp @@ -1,17 +1,17 @@ -#include - -#include "xstransvc.h" -#include "xEvent.h" -#include "xString.h" -#include "xEnt.h" - #include "zBusStop.h" + +#include "zEntCruiseBubble.h" +#include "zEntPlayer.h" #include "zGame.h" #include "zGlobals.h" #include "zScene.h" -#include "zEntPlayer.h" -#include "zEntCruiseBubble.h" +#include "xEnt.h" +#include "xEvent.h" +#include "xString.h" +#include "xstransvc.h" + +#include U32 gBusStopIsRunning; static xEnt* sBusStopUI; @@ -145,11 +145,9 @@ void zBusStop_Update(xBase* to, xScene* scene, F32 dt) zEntEvent("mnu4 busstop", eEventUIFocusOff_Unselect); zEntPlayerControlOff(CONTROL_OWNER_BUS_STOP); zEntEvent(bstop->basset->cameraID, eEventStartConversation); - zEntEvent(bstop->basset->cameraID, eEventSwitch, 0.5f, - 0.0f, 0.0f, 0.0f); + zEntEvent(bstop->basset->cameraID, eEventSwitch, 0.5f, 0.0f, 0.0f, 0.0f); zEntEvent(bstop->basset->busID, eEventVisible); - zEntEvent(bstop->basset->busID, eEventAnimPlay, 2.0f, 0.0f, - 0.0f, 0.0f); + zEntEvent(bstop->basset->busID, eEventAnimPlay, 2.0f, 0.0f, 0.0f, 0.0f); bstop->switchTimer = bstop->basset->delay; gBusStopIsRunning = 1; break; diff --git a/src/SB/Game/zBusStop.h b/src/SB/Game/zBusStop.h index 542973226..dd25fbd3a 100644 --- a/src/SB/Game/zBusStop.h +++ b/src/SB/Game/zBusStop.h @@ -1,11 +1,11 @@ #ifndef ZBUSSTOP_H #define ZBUSSTOP_H -#include "xVec3.h" +#include "zEnt.h" + #include "xBase.h" #include "xDynAsset.h" - -#include "zEnt.h" +#include "xVec3.h" struct busstop_asset : xDynAsset { diff --git a/src/SB/Game/zCamMarker.h b/src/SB/Game/zCamMarker.h index f26cd4d1c..47497d031 100644 --- a/src/SB/Game/zCamMarker.h +++ b/src/SB/Game/zCamMarker.h @@ -1,12 +1,14 @@ #ifndef ZCAMMARKER_H #define ZCAMMARKER_H -#include #include "zCamera.h" + #include "xBase.h" #include "xCamera.h" #include "xEvent.h" +#include + struct zCamMarker : xBase { xCamAsset* asset; diff --git a/src/SB/Game/zCamera.cpp b/src/SB/Game/zCamera.cpp index 015e97611..bed35173f 100644 --- a/src/SB/Game/zCamera.cpp +++ b/src/SB/Game/zCamera.cpp @@ -1,17 +1,19 @@ #include "zCamera.h" -#include - #include "zCameraTweak.h" #include "zEntPlayer.h" #include "zGlobals.h" #include "zMusic.h" -#include "iMath.h" + #include "xMathInlines.h" -#include "xVec3Inlines.h" #include "xScrFx.h" +#include "xVec3Inlines.h" #include "xstransvc.h" +#include "iMath.h" + +#include + F32 zcam_overrot_tmr; S32 zcam_near; S32 zcam_mode; @@ -97,7 +99,6 @@ extern zGlobals globals; extern const xVec3 g_O3; F32 gCameraLastFov; - namespace { F32 GetCurrentPitch(); diff --git a/src/SB/Game/zCamera.h b/src/SB/Game/zCamera.h index 791f6686e..08b812415 100644 --- a/src/SB/Game/zCamera.h +++ b/src/SB/Game/zCamera.h @@ -3,7 +3,7 @@ #include "xCamera.h" -#include +#include enum WallJumpViewState { diff --git a/src/SB/Game/zCameraFly.cpp b/src/SB/Game/zCameraFly.cpp index 09c9fcc55..ca97e8933 100644 --- a/src/SB/Game/zCameraFly.cpp +++ b/src/SB/Game/zCameraFly.cpp @@ -1,15 +1,16 @@ -#include - -#include "xBase.h" -#include "xEvent.h" -#include "xScene.h" +#include "zCameraFly.h" #include "zBase.h" -#include "zCameraFly.h" #include "zCamera.h" #include "zGlobals.h" #include "zMusic.h" +#include "xBase.h" +#include "xEvent.h" +#include "xScene.h" + +#include + extern U32 zcam_flyasset_current; void zCameraFly_Init(xBase& data, xDynAsset& asset, size_t) diff --git a/src/SB/Game/zCameraFly.h b/src/SB/Game/zCameraFly.h index f860041ae..250a28f73 100644 --- a/src/SB/Game/zCameraFly.h +++ b/src/SB/Game/zCameraFly.h @@ -1,11 +1,12 @@ #ifndef ZCAMERAFLY_H #define ZCAMERAFLY_H -#include #include "xBase.h" #include "xDynAsset.h" #include "xScene.h" +#include + struct CameraFly_asset : xDynAsset { U32 flyID; diff --git a/src/SB/Game/zCameraTweak.cpp b/src/SB/Game/zCameraTweak.cpp index 81bf0035d..1f3055d5a 100644 --- a/src/SB/Game/zCameraTweak.cpp +++ b/src/SB/Game/zCameraTweak.cpp @@ -1,9 +1,13 @@ #include "zCameraTweak.h" + +#include "zCamera.h" + #include "xEvent.h" #include "xMath.h" #include "xMathInlines.h" + #include "iMath.h" -#include "zCamera.h" + #include static S32 sCamTweakCount; diff --git a/src/SB/Game/zCollGeom.cpp b/src/SB/Game/zCollGeom.cpp index 4a7b027f4..da44417f2 100644 --- a/src/SB/Game/zCollGeom.cpp +++ b/src/SB/Game/zCollGeom.cpp @@ -2,9 +2,10 @@ #include "zBase.h" -#include "iModel.h" #include "xstransvc.h" +#include "iModel.h" + static volatile U32 sNumTables; static U32 sTableCount[3]; static zCollGeomTable* sTableList[3]; diff --git a/src/SB/Game/zCollGeom.h b/src/SB/Game/zCollGeom.h index be51d599c..d7616767a 100644 --- a/src/SB/Game/zCollGeom.h +++ b/src/SB/Game/zCollGeom.h @@ -3,8 +3,8 @@ #include "xEnt.h" -#include #include +#include struct zCollGeomTable { diff --git a/src/SB/Game/zCombo.cpp b/src/SB/Game/zCombo.cpp index cbdd50f7c..d1ebf5807 100644 --- a/src/SB/Game/zCombo.cpp +++ b/src/SB/Game/zCombo.cpp @@ -1,14 +1,16 @@ #include "zCombo.h" -#include +#include "zGlobals.h" +#include "zTextBox.h" +#include "zUIFont.h" #include "xBase.h" #include "xHudText.h" -#include "xstransvc.h" #include "xTextAsset.h" -#include "zGlobals.h" -#include "zTextBox.h" -#include "zUIFont.h" +#include "xstransvc.h" + +#include +#include struct zComboReward { diff --git a/src/SB/Game/zCombo.h b/src/SB/Game/zCombo.h index 3b1f3173b..8c2d2ed1f 100644 --- a/src/SB/Game/zCombo.h +++ b/src/SB/Game/zCombo.h @@ -1,10 +1,12 @@ #ifndef ZCOMBO_H #define ZCOMBO_H -#include +#include "zEntPickup.h" + #include "xFont.h" #include "xHud.h" -#include "zEntPickup.h" + +#include void zCombo_Setup(); void zCombo_Add(int); diff --git a/src/SB/Game/zConditional.cpp b/src/SB/Game/zConditional.cpp index e169522dd..e2981a14d 100644 --- a/src/SB/Game/zConditional.cpp +++ b/src/SB/Game/zConditional.cpp @@ -1,11 +1,12 @@ #include "zConditional.h" -#include - -#include "zVar.h" #include "zScene.h" +#include "zVar.h" + #include "xEvent.h" +#include + S32 zConditionalEventCB(xBase*, xBase*, U32, const F32*, xBase*); void zConditionalInit(void* b, void* asset) diff --git a/src/SB/Game/zCutsceneMgr.cpp b/src/SB/Game/zCutsceneMgr.cpp index 576fb6b6d..b35feacae 100644 --- a/src/SB/Game/zCutsceneMgr.cpp +++ b/src/SB/Game/zCutsceneMgr.cpp @@ -1,82 +1,84 @@ #include "zCutsceneMgr.h" -#include - -#include "zGlobals.h" #include "zEnt.h" #include "zEntPlayer.h" +#include "zGlobals.h" #include "zMusic.h" #include "zNPCFXCinematic.h" #include "zParEmitter.h" -#include "xEvent.h" + #include "xCutscene.h" -#include "xserializer.h" +#include "xEvent.h" #include "xSnd.h" #include "xString.h" -#include "iFile.h" -#include "iTRC.h" +#include "xserializer.h" + #include "iCutscene.h" +#include "iFile.h" #include "iSystem.h" +#include "iTRC.h" + +#include static zCutsceneHack cutsceneHackTable[58] = { - {"cin_hammer", "spongebob.dff", 0.0f, 1, 0, 0, NULL}, - {"cin_hammer", "fish_j_skel.dff", 0.0f, 1, 0, 0, NULL}, - {"cin_hammer", "ham_bind07_ham_bind1.dff", 0.0f, 1, 0, 0, NULL}, - {"cin_tartar", "robot_tar_skel.dff", 0.0f, 1, 0, 0, NULL}, - {"GY_dutchman_open", "spatula_golden_spatula.dff", 0.0f, 0, 0, 1, xFXShinyRender}, - {"GY_dutchman_end", "group12_golden_spatula.dff", 0.0f, 0, 0, 1, xFXShinyRender}, - {"GY_dutchman_end", "group12_bubble_pirate_ship.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"GY_dutchman_end", "group12_bubble1.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"GY_dutchman_end", "group12_bubble2.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"GY_dutchman_end", "group12_bubble3.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"GY_dutchman_end", "group12_bubble4.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"GY_dutchman_end", "group12_bubble5.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"B1_ending", "golden_spatula_golden_spatula.dff", 0.0f, 0, 0, 1, xFXShinyRender}, - {"B2_open", "icecube.dff", 0.0f, 0, 0, 1, NULL}, - {"B2_round2", "group4_SB_frozen1.dff", 0.0f, 0, 0, 1, NULL}, - {"B2_round3", "group6_bubble_bowlingball1.dff", 0.0f, 0, 0, 1, xFXBubbleRender}, - {"B3_open", "dupe_duplicatotron3001_skel2.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_open", "sb_karate_skel.dff", 400.0f, 0, 1, 0, NULL}, - {"B3_transition", "sb_big_skel.dff", 400.0f, 0, 1, 0, NULL}, - {"B3_transition", "sb_karate_skel.dff", 400.0f, 0, 1, 0, NULL}, - {"B3_transition", "plankton_boss_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss19.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss18.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss16.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss15.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss24.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss14.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss23.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss13.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss22.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss12.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "duplicatotron3001_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss21.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss11.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform02_platform_b301_boss20.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_transition", "platform01_platform_b301_boss10.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "sb_big_skel.dff", 50.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel_02.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel_03.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel_04.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel_05.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "duplicatotron3000_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel_06.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "plankton_boss_skel_07.dff", 0.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "sb_big_armr_skel.dff", 100.0f, 0, 1, 0, NULL}, - {"B3_end_game_win", "sb_big_arml_skel.dff", 100.0f, 0, 1, 0, NULL}, - {"game_win", "larry_lobster_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "squidward_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "mr_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "mspuffs_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "mermaid_man_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "King_neptune_bind_gecklund_group1.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "plankton_skel.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "bubblebuddy.dff", 0.0f, 0, 1, 0, NULL}, - {"game_win", "gary_skel.dff", 0.0f, 0, 1, 0, NULL}, + { "cin_hammer", "spongebob.dff", 0.0f, 1, 0, 0, NULL }, + { "cin_hammer", "fish_j_skel.dff", 0.0f, 1, 0, 0, NULL }, + { "cin_hammer", "ham_bind07_ham_bind1.dff", 0.0f, 1, 0, 0, NULL }, + { "cin_tartar", "robot_tar_skel.dff", 0.0f, 1, 0, 0, NULL }, + { "GY_dutchman_open", "spatula_golden_spatula.dff", 0.0f, 0, 0, 1, xFXShinyRender }, + { "GY_dutchman_end", "group12_golden_spatula.dff", 0.0f, 0, 0, 1, xFXShinyRender }, + { "GY_dutchman_end", "group12_bubble_pirate_ship.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "GY_dutchman_end", "group12_bubble1.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "GY_dutchman_end", "group12_bubble2.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "GY_dutchman_end", "group12_bubble3.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "GY_dutchman_end", "group12_bubble4.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "GY_dutchman_end", "group12_bubble5.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "B1_ending", "golden_spatula_golden_spatula.dff", 0.0f, 0, 0, 1, xFXShinyRender }, + { "B2_open", "icecube.dff", 0.0f, 0, 0, 1, NULL }, + { "B2_round2", "group4_SB_frozen1.dff", 0.0f, 0, 0, 1, NULL }, + { "B2_round3", "group6_bubble_bowlingball1.dff", 0.0f, 0, 0, 1, xFXBubbleRender }, + { "B3_open", "dupe_duplicatotron3001_skel2.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_open", "sb_karate_skel.dff", 400.0f, 0, 1, 0, NULL }, + { "B3_transition", "sb_big_skel.dff", 400.0f, 0, 1, 0, NULL }, + { "B3_transition", "sb_karate_skel.dff", 400.0f, 0, 1, 0, NULL }, + { "B3_transition", "plankton_boss_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss19.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss18.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss16.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss15.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss24.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss14.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss23.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss13.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss22.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss12.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "duplicatotron3001_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss21.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss11.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform02_platform_b301_boss20.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_transition", "platform01_platform_b301_boss10.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "sb_big_skel.dff", 50.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel_02.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel_03.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel_04.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel_05.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "duplicatotron3000_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel_06.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "plankton_boss_skel_07.dff", 0.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "sb_big_armr_skel.dff", 100.0f, 0, 1, 0, NULL }, + { "B3_end_game_win", "sb_big_arml_skel.dff", 100.0f, 0, 1, 0, NULL }, + { "game_win", "larry_lobster_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "squidward_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "mr_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "mspuffs_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "mermaid_man_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "King_neptune_bind_gecklund_group1.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "plankton_skel.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "bubblebuddy.dff", 0.0f, 0, 1, 0, NULL }, + { "game_win", "gary_skel.dff", 0.0f, 0, 1, 0, NULL }, }; static zCutSceneNames zCutSceneNamesTable[14] = { diff --git a/src/SB/Game/zCutsceneMgr.h b/src/SB/Game/zCutsceneMgr.h index 3b5ddfdd5..a65cc7955 100644 --- a/src/SB/Game/zCutsceneMgr.h +++ b/src/SB/Game/zCutsceneMgr.h @@ -2,11 +2,11 @@ #define ZCUTSCENEMGR_H #include "xCutsceneMgr.h" + #include "rpworld.h" extern F32 gSkipTimeCutscene; - struct xScene; struct zCutsceneMgr : xCutsceneMgr { diff --git a/src/SB/Game/zDiscoFloor.cpp b/src/SB/Game/zDiscoFloor.cpp index 8eaddc60e..97891a284 100644 --- a/src/SB/Game/zDiscoFloor.cpp +++ b/src/SB/Game/zDiscoFloor.cpp @@ -1,23 +1,23 @@ #include "zDiscoFloor.h" -#include "zSurface.h" +#include "zEntSimpleObj.h" #include "zGlobals.h" #include "zGrid.h" -#include "zRenderState.h" -#include "zEntSimpleObj.h" #include "zLOD.h" +#include "zRenderState.h" +#include "zSurface.h" -#include "xString.h" #include "xDebug.h" #include "xMath.h" #include "xMathInlines.h" +#include "xString.h" -#include "iModel.h" #include "iMath.h" +#include "iModel.h" -#include +#include #include -#include +#include namespace { diff --git a/src/SB/Game/zDispatcher.cpp b/src/SB/Game/zDispatcher.cpp index 21774df42..9b819dc07 100644 --- a/src/SB/Game/zDispatcher.cpp +++ b/src/SB/Game/zDispatcher.cpp @@ -1,27 +1,29 @@ #include "zDispatcher.h" -#include - -#include "zGlobals.h" -#include "zRumble.h" -#include "zVar.h" +#include "zFMV.h" #include "zGameState.h" -#include "zMusic.h" +#include "zGlobals.h" #include "zHud.h" -#include "zFMV.h" +#include "zMusic.h" +#include "zRumble.h" #include "zSaveLoad.h" -#include "xMemMgr.h" -#include "xScrFx.h" +#include "zVar.h" + #include "xCM.h" #include "xFX.h" #include "xMath.h" +#include "xMemMgr.h" +#include "xScrFx.h" + #include "string.h" +#include static void ZDSP_instInit(st_ZDISPATCH_DATA* dspdata, xBaseAsset* bass); static void ZDSP_instInitDep(st_ZDISPATCH_DATA* dspdata, zScene* scene); static void ZDSP_readAsset(st_ZDISPATCH_DATA* dspdata); static S32 ZDSP_doCommand(st_ZDISPATCH_DATA* dspdata, st_ZDISPATCH_CONTEXT* cmdCtxt); -static S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, xBase* toParamWidget); +static S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, + xBase* toParamWidget); static void WRAP_xsnd_setMusicVolume(S32 i); static void WRAP_xsnd_setSFXVolume(S32 i); @@ -482,7 +484,7 @@ static S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, x break; case eEventDispatcherAssert: - char events[512] = { }; + char events[512] = {}; char log[512]; U32 c; U32 len; @@ -495,7 +497,7 @@ static S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, x len = strlen((char*)&zEventLogBuf[i]); } - strcpy((char*) events, (char*) zEventLogBuf[c + 1]); + strcpy((char*)events, (char*)zEventLogBuf[c + 1]); for (i = c + 2; i < 0x13; i++) { strcat(log, zEventLogBuf[i]); diff --git a/src/SB/Game/zDispatcher.h b/src/SB/Game/zDispatcher.h index 745fe2b02..d058ef37e 100644 --- a/src/SB/Game/zDispatcher.h +++ b/src/SB/Game/zDispatcher.h @@ -1,9 +1,10 @@ #ifndef ZDISPATCHER_H #define ZDISPATCHER_H -#include "xBase.h" #include "zScene.h" +#include "xBase.h" + struct st_ZDISPATCH_DATA : xBase { xBaseAsset* rawass; diff --git a/src/SB/Game/zEGenerator.cpp b/src/SB/Game/zEGenerator.cpp index 60e163069..bbcc3b403 100644 --- a/src/SB/Game/zEGenerator.cpp +++ b/src/SB/Game/zEGenerator.cpp @@ -1,12 +1,14 @@ #include "zEGenerator.h" -#include "xDraw.h" -#include "xEntBoulder.h" -#include "xMovePoint.h" #include "zCollGeom.h" #include "zGlobals.h" #include "zThrown.h" +#include "xDraw.h" +#include "xEntBoulder.h" +#include "xMovePoint.h" + +#include #include void zEGenerator_Init(void* egen, void* asset) @@ -203,7 +205,8 @@ void zEGenerator_TurnOn(zEGenerator* egen) } if ((b->baseFlags & 0x20) != 0) { - xMat4x3Toworld(&egen->dst_pos, (xMat4x3*)((xEnt*)b)->model->Mat, &egen->dst_off); + xMat4x3Toworld(&egen->dst_pos, (xMat4x3*)((xEnt*)b)->model->Mat, + &egen->dst_off); egen->dst = b; break; } diff --git a/src/SB/Game/zEGenerator.h b/src/SB/Game/zEGenerator.h index 0e2477940..f89254c47 100644 --- a/src/SB/Game/zEGenerator.h +++ b/src/SB/Game/zEGenerator.h @@ -42,6 +42,6 @@ void zEGenerator_TurnOn(zEGenerator* egen); void zEGenerator_TurnOff(zEGenerator* egen); void zEGenerator_ToggleOn(zEGenerator* egen); S32 zEGeneratorEventCB(xBase* to, xBase* from, U32 toEvent, const F32* toParam, - xBase* toParamWidget); + xBase* toParamWidget); #endif diff --git a/src/SB/Game/zEnt.cpp b/src/SB/Game/zEnt.cpp index 0254af9f0..cb2735065 100644 --- a/src/SB/Game/zEnt.cpp +++ b/src/SB/Game/zEnt.cpp @@ -1,22 +1,24 @@ #include "zEnt.h" -#include - -#include "zGlobals.h" #include "zAnimList.h" +#include "zGlobals.h" #include "zNPCTypeCommon.h" +#include "zNPCTypes.h" + +#include "xCollide.h" +#include "xMath.h" #include "xNPCBasic.h" -#include "xstransvc.h" +#include "xSnd.h" #include "xString.h" -#include "xMath.h" +#include "xstransvc.h" #include "xutil.h" + #include "iModel.h" -#include "xSnd.h" -#include "xCollide.h" -#include "zNPCTypes.h" -#include + +#include +#include #include -#include +#include void zEntInit(zEnt* ent, xEntAsset* asset, U32 type) { diff --git a/src/SB/Game/zEnt.h b/src/SB/Game/zEnt.h index 48edaa307..7c4a7353b 100644 --- a/src/SB/Game/zEnt.h +++ b/src/SB/Game/zEnt.h @@ -1,11 +1,11 @@ #ifndef ZENT_H #define ZENT_H -#include "xEnt.h" -#include "xAnim.h" - -#include "zScene.h" #include "zEvent.h" +#include "zScene.h" + +#include "xAnim.h" +#include "xEnt.h" //For inline/weak functions #include "xSnd.h" diff --git a/src/SB/Game/zEntButton.cpp b/src/SB/Game/zEntButton.cpp index 4dd23219e..5281b74ee 100644 --- a/src/SB/Game/zEntButton.cpp +++ b/src/SB/Game/zEntButton.cpp @@ -1,12 +1,14 @@ #include "zEntButton.h" -#include "zEntPlayer.h" + #include "zCollGeom.h" +#include "zEntPlayer.h" #include "zFX.h" -#include "zShrapnel.h" #include "zGlobals.h" +#include "zShrapnel.h" + #include "xMath.h" -#include "xstransvc.h" #include "xString.h" +#include "xstransvc.h" #include diff --git a/src/SB/Game/zEntCruiseBubble.cpp b/src/SB/Game/zEntCruiseBubble.cpp index d3d2feeb0..7a5cea606 100644 --- a/src/SB/Game/zEntCruiseBubble.cpp +++ b/src/SB/Game/zEntCruiseBubble.cpp @@ -1,12 +1,8 @@ -#include -#include -#include -#include +#include "zEntCruiseBubble.h" #include "zCamera.h" #include "zEnt.h" #include "zEntButton.h" -#include "zEntCruiseBubble.h" #include "zEntDestructObj.h" #include "zEntPlayer.h" #include "zEntTrigger.h" @@ -19,8 +15,6 @@ #include "zRenderState.h" #include "zTalkBox.h" -#include "iMath.h" - #include "xColor.h" #include "xDecal.h" #include "xFX.h" @@ -30,9 +24,18 @@ #include "xMathInlines.h" #include "xModel.h" #include "xSnd.h" -#include "xstransvc.h" #include "xString.h" #include "xVec3.h" +#include "xstransvc.h" + +#include "iDraw.h" +#include "iMath.h" + +#include + +#include +#include +#include basic_rect screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f }; basic_rect default_adjust = { 0.0f, 0.0f, 1.0f, 1.0f }; diff --git a/src/SB/Game/zEntCruiseBubble.h b/src/SB/Game/zEntCruiseBubble.h index db62d1475..11a7d565f 100644 --- a/src/SB/Game/zEntCruiseBubble.h +++ b/src/SB/Game/zEntCruiseBubble.h @@ -2,13 +2,13 @@ #define ZENTCRUISEBUBBLE_H -#include "xDebug.h" - #include "zNPCHazard.h" +#include "zRumble.h" #include "zShrapnel.h" -#include -#include "zRumble.h" +#include "xDebug.h" + +#include // I have no idea where to put this. This is only used by // cruise_bubble::tweak_group::register_tweaks() so far. diff --git a/src/SB/Game/zEntDestructObj.cpp b/src/SB/Game/zEntDestructObj.cpp index 9324b9fe5..424d2d5f1 100644 --- a/src/SB/Game/zEntDestructObj.cpp +++ b/src/SB/Game/zEntDestructObj.cpp @@ -408,22 +408,26 @@ void zEntDestructObj_DestroyFX(zEntDestructObj* ent) } } -S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget) +S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, + xBase* toParamWidget) { zEntDestructObj* s = (zEntDestructObj*)to; - switch (toEvent) { + switch (toEvent) + { case eEventVisible: case eEventFastVisible: xEntShow(s); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOn(*s, toParam[1], toParam[2]); } break; case eEventInvisible: case eEventFastInvisible: xEntHide(s); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOff(*s, toParam[1], toParam[2]); } break; @@ -432,20 +436,22 @@ S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toPar s->bupdate(s, (xVec3*)&s->model->Mat->pos); break; case eEventCollisionOff: - s->chkby &= (U8)~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); + s->chkby &= (U8) ~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); break; case eEventCollision_Visible_On: s->chkby |= (XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); xEntShow(s); s->bupdate(s, (xVec3*)&s->model->Mat->pos); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOn(*s, toParam[1], toParam[2]); } break; case eEventCollision_Visible_Off: - s->chkby &= (U8)~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); + s->chkby &= (U8) ~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); xEntHide(s); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOff(*s, toParam[1], toParam[2]); } break; @@ -456,21 +462,27 @@ S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toPar zCollGeom_CamDisable(s); break; case eEventDestroy: - if (s->destroy_model) { + if (s->destroy_model) + { SwapModel(s, s->destroy_model); - } else { - s->chkby &= (U8)~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); + } + else + { + s->chkby &= (U8) ~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); xEntHide(s); } zEntDestructObj_DestroyFX(s); s->state = 2; - if (s->shrapnel_destroy && s->shrapnel_destroy->initCB) { + if (s->shrapnel_destroy && s->shrapnel_destroy->initCB) + { s->shrapnel_destroy->initCB(s->shrapnel_destroy, s->model, NULL, NULL); } - if (s->destroy_notify) { + if (s->destroy_notify) + { s->destroy_notify(*s, s->notify_context); } - if (s->driver) { + if (s->driver) + { s->driver->driving_count--; s->driver = NULL; } @@ -489,21 +501,28 @@ S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toPar zEntAnimEvent(s, toEvent, toParam); break; case eEventHit: - if (s->healthCnt) { + if (s->healthCnt) + { s->healthCnt--; - if (s->healthCnt && s->hit_model) { + if (s->healthCnt && s->hit_model) + { SwapModel(s, s->hit_model); } - if (s->healthCnt == 0) { + if (s->healthCnt == 0) + { zEntEvent(s, s, eEventDestroy); } } break; case eEventSetUpdateDistance: - if (globals.updateMgr) { - if (toParam[0] <= 0.0f) { + if (globals.updateMgr) + { + if (toParam[0] <= 0.0f) + { xUpdateCull_SetCB(globals.updateMgr, s, xUpdateCull_AlwaysTrueCB, NULL); - } else { + } + else + { FloatAndVoid dist; dist.f = SQR(toParam[0]); xUpdateCull_SetCB(globals.updateMgr, s, xUpdateCull_DistanceSquaredCB, dist.v); @@ -523,9 +542,11 @@ S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toPar zEntDestructObj_Hit(s, 0x800); break; case eEventLaunchShrapnel: - if (toParamWidget) { + if (toParamWidget) + { zShrapnelAsset* shrap = (zShrapnelAsset*)toParamWidget; - if (shrap->initCB) { + if (shrap->initCB) + { shrap->initCB(shrap, s->model, NULL, NULL); } } diff --git a/src/SB/Game/zEntDestructObj.h b/src/SB/Game/zEntDestructObj.h index 1b5e014f3..32d33a93b 100644 --- a/src/SB/Game/zEntDestructObj.h +++ b/src/SB/Game/zEntDestructObj.h @@ -1,16 +1,18 @@ #ifndef ZENTDESTRUCTOBJ_H #define ZENTDESTRUCTOBJ_H +#include "zCollGeom.h" #include "zEnt.h" -#include "xSFX.h" -#include "zParEmitter.h" #include "zGlobals.h" +#include "zParEmitter.h" #include "zRumble.h" -#include "xVec3.h" +#include "zShrapnel.h" + +#include "xSFX.h" #include "xString.h" +#include "xVec3.h" #include "xstransvc.h" -#include "zShrapnel.h" -#include "zCollGeom.h" + #include "iCollide.h" #define DOBJ_STATE_INIT 0 diff --git a/src/SB/Game/zEntHangable.cpp b/src/SB/Game/zEntHangable.cpp index d5241b2e3..472fb2ad1 100644 --- a/src/SB/Game/zEntHangable.cpp +++ b/src/SB/Game/zEntHangable.cpp @@ -1,13 +1,14 @@ +#include "zEntHangable.h" + +#include "zGlobals.h" +#include "zParEmitter.h" + #include "xBase.h" #include "xEnt.h" #include "xEntMotion.h" #include "xLinkAsset.h" #include "xString.h" -#include "zEntHangable.h" -#include "zGlobals.h" -#include "zParEmitter.h" - #include static zParEmitter* sCandleEmitter; @@ -30,7 +31,7 @@ void zEntHangable_SetupFX() static void HangableSetup(zEntHangable* ent, xEntAsset* asset) { - xEntHangableAsset* hangAsset = (xEntHangableAsset *)(&asset[1]); + xEntHangableAsset* hangAsset = (xEntHangableAsset*)(&asset[1]); xVec3* center; xMat3x3 hackMat; @@ -92,6 +93,7 @@ void zEntHangable_Init(zEntHangable* ent, xEntAsset* asset) static void zEntHangable_UpdateFX(zEntHangable* ent) { // Points of a (wobbly) circle in 3D space. + // clang-format off xVec3 offset_rlii0006[8] = { { 0.0, 0.561, 0.613 }, @@ -103,6 +105,7 @@ static void zEntHangable_UpdateFX(zEntHangable* ent) { -0.613, 0.543, 0.0 }, { -0.43345639, 0.48, 0.43345639 } }; + // clang-format on xVec3* local_offset; xParEmitterCustomSettings info; @@ -240,58 +243,58 @@ S32 zEntHangableEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, switch ((S32)toEvent) { - case eEventVisible: - case eEventFastVisible: - xEntShow(ent); - break; - case eEventInvisible: - case eEventFastInvisible: - xEntHide(ent); - break; - case eEventCollisionOn: - ent->enabled = 1; - break; - case eEventMount: - zEntHangableMountFX(ent); - if ((ent->asset->modelInfoID == sChandelierHash) && (ent->candle_state == 0)) + case eEventVisible: + case eEventFastVisible: + xEntShow(ent); + break; + case eEventInvisible: + case eEventFastInvisible: + xEntHide(ent); + break; + case eEventCollisionOn: + ent->enabled = 1; + break; + case eEventMount: + zEntHangableMountFX(ent); + if ((ent->asset->modelInfoID == sChandelierHash) && (ent->candle_state == 0)) + { + ent->candle_timer = 3.0f; + } + break; + case eEventDismount: + ent->enabled = -2; + break; + case eEventCollisionOff: + ent->enabled = 0; + break; + case eEventCollision_Visible_On: + xEntShow(ent); + ent->enabled = 1; + break; + case eEventCollision_Visible_Off: + xEntHide(ent); + ent->enabled = 0; + break; + case eEventReset: + zEntHangable_Reset(ent); + break; + case eEventSwingerFollow: + zEntHangable_SetFollow(ent, follow); + break; + case eEventSetUpdateDistance: + if (globals.updateMgr != NULL) + { + if (*toParam <= 0.0f) { - ent->candle_timer = 3.0f; + xUpdateCull_SetCB(globals.updateMgr, ent, xUpdateCull_AlwaysTrueCB, NULL); } - break; - case eEventDismount: - ent->enabled = -2; - break; - case eEventCollisionOff: - ent->enabled = 0; - break; - case eEventCollision_Visible_On: - xEntShow(ent); - ent->enabled = 1; - break; - case eEventCollision_Visible_Off: - xEntHide(ent); - ent->enabled = 0; - break; - case eEventReset: - zEntHangable_Reset(ent); - break; - case eEventSwingerFollow: - zEntHangable_SetFollow(ent, follow); - break; - case eEventSetUpdateDistance: - if (globals.updateMgr != NULL) + else { - if (*toParam <= 0.0f) - { - xUpdateCull_SetCB(globals.updateMgr, ent, xUpdateCull_AlwaysTrueCB, NULL); - } - else - { - dist.f = *toParam * *toParam; - xUpdateCull_SetCB(globals.updateMgr, ent, xUpdateCull_DistanceSquaredCB, dist.v); - } + dist.f = *toParam * *toParam; + xUpdateCull_SetCB(globals.updateMgr, ent, xUpdateCull_DistanceSquaredCB, dist.v); } - break; + } + break; } if ((wasVisible == 0) && (xEntIsVisible(ent) != 0)) { @@ -356,19 +359,16 @@ void zEntHangable_SetMatrix(zEntHangable* ent, F32 dt) opos = &ent->frame->oldmat.pos; orot = &ent->frame->oldrot.axis; - pos = (xVec3 *)&ent->model->Mat->pos; + pos = (xVec3*)&ent->model->Mat->pos; xMat3x3GetEuler((xMat3x3*)ent->model->Mat, &rot); - if - ( - (opos->x != pos->x) || (opos->y != pos->y) || (opos->z != pos->z) || - (orot->x != rot.x) || (orot->y != rot.y) || (orot->z != rot.z) - ) + if ((opos->x != pos->x) || (opos->y != pos->y) || (opos->z != pos->z) || (orot->x != rot.x) || + (orot->y != rot.y) || (orot->z != rot.z)) { moving = 1; if (ent->moving != 1) { - zEntEvent((xBase *)ent, eEventStartMoving); + zEntEvent((xBase*)ent, eEventStartMoving); } } else @@ -376,7 +376,7 @@ void zEntHangable_SetMatrix(zEntHangable* ent, F32 dt) moving = 0; if (ent->moving != 0) { - zEntEvent((xBase *)ent, eEventStopMoving); + zEntEvent((xBase*)ent, eEventStopMoving); } } @@ -457,7 +457,7 @@ void zEntHangable_SetShaggy(zEntHangable* ent, zEnt* shaggy) shaggy->frame->vel.z = 0.0f; shaggy->frame->mat.pos.x = ent->model->Mat->pos.x; shaggy->frame->mat.pos.z = ent->model->Mat->pos.z; - *shaggy->model->Mat = *(RwMatrixTag *)(&shaggy->frame->mat); + *shaggy->model->Mat = *(RwMatrixTag*)(&shaggy->frame->mat); } } else if (ent->shaggy != NULL) @@ -477,7 +477,7 @@ void zEntHangable_FollowUpdate(zEntHangable* ent) return; } - xEntHangableAsset* hang = (xEntHangableAsset *)(&ent->asset[1]); + xEntHangableAsset* hang = (xEntHangableAsset*)(&ent->asset[1]); center = (xVec3*)(&ent->follow->model->Mat->pos); pivot.x = center->x; diff --git a/src/SB/Game/zEntPickup.cpp b/src/SB/Game/zEntPickup.cpp index 8d2cfba9e..230bded5b 100644 --- a/src/SB/Game/zEntPickup.cpp +++ b/src/SB/Game/zEntPickup.cpp @@ -1,23 +1,24 @@ #include "zEntPickup.h" -#include "zLOD.h" -#include "zGame.h" -#include "zGlobals.h" #include "zEntPlayerBungeeState.h" #include "zEntSimpleObj.h" -#include "zGrid.h" #include "zFX.h" +#include "zGame.h" +#include "zGlobals.h" +#include "zGrid.h" +#include "zLOD.h" #include "zUI.h" +#include "xFX.h" #include "xMath.h" #include "xMathInlines.h" -#include "xFX.h" #include "xstransvc.h" + #include "iAnim.h" #include "iModel.h" -#include #include +#include #define PICKUP_TYPE_SHINY 0 #define PICKUP_TYPE_1 1 diff --git a/src/SB/Game/zEntPickup.h b/src/SB/Game/zEntPickup.h index 639a5c218..28227ae0a 100644 --- a/src/SB/Game/zEntPickup.h +++ b/src/SB/Game/zEntPickup.h @@ -2,12 +2,13 @@ #define ZENTPICKUP_H #include "zEnt.h" -#include "zPickupTable.h" #include "zParEmitter.h" +#include "zPickupTable.h" #include "xEntDrive.h" #include "xPar.h" #include "xShadowSimple.h" + #include "iColor.h" struct zEntPickup : zEnt @@ -61,8 +62,7 @@ void zEntPickupInit(void* ent, void* asset); void zEntPickupInit(zEntPickup* ent, xEntAsset* asset); void zEntPickup_Setup(zEntPickup* p); void zEntPickup_Setup(); -S32 zEntPickupEventCB(xBase*, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget); +S32 zEntPickupEventCB(xBase*, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget); void zEntPickup_FlyToInterface(zEntPickup*, F32); void zEntPickup_CheckAllPickupsAgainstPlayer(xScene* sc, F32 dt); void zEntPickup_DoPickup(zEntPickup* ent); diff --git a/src/SB/Game/zEntPlayer.cpp b/src/SB/Game/zEntPlayer.cpp index 0dcc3dadb..766999d55 100644 --- a/src/SB/Game/zEntPlayer.cpp +++ b/src/SB/Game/zEntPlayer.cpp @@ -1,52 +1,24 @@ -#include "xAnim.h" -#include "zFX.h" -#include -#include -#include -#include - -#include "iAnim.h" -#include "iAnimSKB.h" -#include "iMath.h" -#include "iSnd.h" -#include "iTRC.h" - -#include "xDebug.h" -#include "xEnt.h" -#include "xEntBoulder.h" -#include "xEvent.h" -#include "xJaw.h" -#include "xMath.h" -#include "xMathInlines.h" -#include "xMemMgr.h" -#include "xRay3.h" -#include "xSnd.h" -#include "xstransvc.h" -#include "xTRC.h" -#include "xutil.h" -#include "xVec3.h" -#include "xVec3Inlines.h" +#include "zEntPlayer.h" #include "zBase.h" #include "zCamera.h" #include "zEntButton.h" #include "zEntCruiseBubble.h" #include "zEntDestructObj.h" -#include "zEntPlayer.h" #include "zEntPlayerBungeeState.h" #include "zEntPlayerOOBState.h" #include "zEntTeleportBox.h" +#include "zFX.h" #include "zGame.h" -#include "zGrid.h" #include "zGameExtras.h" #include "zGlobals.h" #include "zGoo.h" +#include "zGrid.h" #include "zGust.h" #include "zLasso.h" #include "zMusic.h" -#include "zNPCTypeTiki.h" -#include "zNPCTypeTiki.h" #include "zNPCMessenger.h" +#include "zNPCTypeTiki.h" #include "zParPTank.h" #include "zPlatform.h" #include "zRumble.h" @@ -54,6 +26,34 @@ #include "zSurface.h" #include "zThrown.h" +#include "xAnim.h" +#include "xDebug.h" +#include "xEnt.h" +#include "xEntBoulder.h" +#include "xEvent.h" +#include "xJaw.h" +#include "xMath.h" +#include "xMathInlines.h" +#include "xMemMgr.h" +#include "xRay3.h" +#include "xSnd.h" +#include "xTRC.h" +#include "xVec3.h" +#include "xVec3Inlines.h" +#include "xstransvc.h" +#include "xutil.h" + +#include "iAnim.h" +#include "iAnimSKB.h" +#include "iMath.h" +#include "iSnd.h" +#include "iTRC.h" + +#include +#include +#include +#include + static F32 sHackStuckTimer; static xVec3 sHackStuckDir; static xVec3 sHackStuckVel; diff --git a/src/SB/Game/zEntPlayer.h b/src/SB/Game/zEntPlayer.h index d4e3ad6fe..1cbce43dc 100644 --- a/src/SB/Game/zEntPlayer.h +++ b/src/SB/Game/zEntPlayer.h @@ -1,12 +1,13 @@ #ifndef ZENTPLAYER_H #define ZENTPLAYER_H -#include "xMath3.h" -#include "xEnt.h" -#include "xAnim.h" #include "zEnt.h" #include "zLasso.h" + +#include "xAnim.h" #include "xColor.h" +#include "xEnt.h" +#include "xMath3.h" enum zControlOwner { diff --git a/src/SB/Game/zEntPlayerBungeeState.cpp b/src/SB/Game/zEntPlayerBungeeState.cpp index 1d8727f94..d4fc12fff 100644 --- a/src/SB/Game/zEntPlayerBungeeState.cpp +++ b/src/SB/Game/zEntPlayerBungeeState.cpp @@ -1,32 +1,33 @@ #include "zEntPlayerBungeeState.h" -#include "iScrFX.h" +#include "zBase.h" +#include "zCamera.h" +#include "zCameraTweak.h" +#include "zEntCruiseBubble.h" +#include "zEntPlayer.h" +#include "zGameExtras.h" +#include "zGlobals.h" +#include "zLightning.h" +#include "zScene.h" + #include "xCamera.h" #include "xDebug.h" #include "xFX.h" #include "xLinkAsset.h" +#include "xMarkerAsset.h" #include "xMath.h" -#include "xMathInlines.h" #include "xMath3.h" -#include "xMarkerAsset.h" +#include "xMathInlines.h" #include "xModel.h" #include "xPad.h" #include "xShadow.h" #include "xString.h" #include "xVec3.h" - #include "xstransvc.h" -#include "zBase.h" -#include "zCamera.h" -#include "zEntCruiseBubble.h" -#include "zEntPlayer.h" -#include "zGameExtras.h" -#include "zGlobals.h" -#include "zCameraTweak.h" -#include "zLightning.h" -#include "zScene.h" -#include +#include "iScrFX.h" + +#include #include // FIXME: remove this when no longer needed for float data order @@ -1464,29 +1465,58 @@ namespace bungee_state void bungee_state::insert_animations(xAnimTable& at) { - xAnimTableNewState(&at, "bungee_bottom_0", 0x10, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - xAnimTableNewState(&at, "bungee_top_0", 0x10, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - xAnimTableNewState(&at, "bungee_down_0", 0, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - xAnimTableNewState(&at, "bungee_hit_0", 0x20, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - xAnimTableNewState(&at, "bungee_mount_0", 0x20, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - xAnimTableNewState(&at, "bungee_cycle_0", 0x10, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - xAnimTableNewState(&at, "bungee_death_0", 0, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, 0, 0); - - static const char* start_from = "JumpStart01 JumpLift01 JumpApex01 DJumpStart01 DJumpLift01 Fall01 FallHigh01"; + xAnimTableNewState(&at, "bungee_bottom_0", 0x10, 0, 1.0f, 0, 0, 0.0f, 0, 0, + xAnimDefaultBeforeEnter, 0, 0); + xAnimTableNewState(&at, "bungee_top_0", 0x10, 0, 1.0f, 0, 0, 0.0f, 0, 0, + xAnimDefaultBeforeEnter, 0, 0); + xAnimTableNewState(&at, "bungee_down_0", 0, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, + 0, 0); + xAnimTableNewState(&at, "bungee_hit_0", 0x20, 0, 1.0f, 0, 0, 0.0f, 0, 0, + xAnimDefaultBeforeEnter, 0, 0); + xAnimTableNewState(&at, "bungee_mount_0", 0x20, 0, 1.0f, 0, 0, 0.0f, 0, 0, + xAnimDefaultBeforeEnter, 0, 0); + xAnimTableNewState(&at, "bungee_cycle_0", 0x10, 0, 1.0f, 0, 0, 0.0f, 0, 0, + xAnimDefaultBeforeEnter, 0, 0); + xAnimTableNewState(&at, "bungee_death_0", 0, 0, 1.0f, 0, 0, 0.0f, 0, 0, xAnimDefaultBeforeEnter, + 0, 0); + + static const char* start_from = + "JumpStart01 JumpLift01 JumpApex01 DJumpStart01 DJumpLift01 Fall01 FallHigh01"; static const char* start_to = "bungee_cycle_0"; - shared.anim_tran.start = xAnimTableNewTransition(&at, start_from, start_to, check_anim_start, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, 0.5f, 0); - shared.anim_tran.dive_start = xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_dive_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.dive.time, 0); - shared.anim_tran.dive_stop = xAnimTableNewTransition(&at, "bungee_dive_0", "bungee_cycle_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.dive.anim_out_time, 0); - shared.anim_tran.top_start = xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_top_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.top_anim_time, 0); - shared.anim_tran.top_stop = xAnimTableNewTransition(&at, "bungee_top_0", "bungee_cycle_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.top_anim_time, 0); - shared.anim_tran.bottom_start = xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_bottom_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.bottom_anim_time, 0); - shared.anim_tran.bottom_stop = xAnimTableNewTransition(&at, "bungee_bottom_0", "bungee_cycle_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.bottom_anim_time, 0); - shared.anim_tran.hit = xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_hit_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); - xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_dive_0", check_anim_hit_to_dive, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); - xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_top_0", check_anim_hit_to_top, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); - xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_bottom_0", check_anim_hit_to_bottom, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); - xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_cycle_0", check_anim_hit_to_cycle, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); - xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_death_0", check_anim_hit_to_death, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); - shared.anim_tran.stop = xAnimTableNewTransition(&at, "bungee_cycle_0", "Fall01", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, 0, 0.5f, 0); + shared.anim_tran.start = xAnimTableNewTransition(&at, start_from, start_to, check_anim_start, 0, + 0x10, 0, 0.0f, 0.0f, 0, 0, 0.5f, 0); + shared.anim_tran.dive_start = + xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_dive_0", 0, 0, 0x10, 0, 0.0f, 0.0f, + 0, 0, fixed.dive.time, 0); + shared.anim_tran.dive_stop = + xAnimTableNewTransition(&at, "bungee_dive_0", "bungee_cycle_0", 0, 0, 0x10, 0, 0.0f, 0.0f, + 0, 0, fixed.dive.anim_out_time, 0); + shared.anim_tran.top_start = + xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_top_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, + 0, fixed.top_anim_time, 0); + shared.anim_tran.top_stop = + xAnimTableNewTransition(&at, "bungee_top_0", "bungee_cycle_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, + 0, fixed.top_anim_time, 0); + shared.anim_tran.bottom_start = + xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_bottom_0", 0, 0, 0x10, 0, 0.0f, 0.0f, + 0, 0, fixed.bottom_anim_time, 0); + shared.anim_tran.bottom_stop = + xAnimTableNewTransition(&at, "bungee_bottom_0", "bungee_cycle_0", 0, 0, 0x10, 0, 0.0f, 0.0f, + 0, 0, fixed.bottom_anim_time, 0); + shared.anim_tran.hit = + xAnimTableNewTransition(&at, "bungee_cycle_0", "bungee_hit_0", 0, 0, 0x10, 0, 0.0f, 0.0f, 0, + 0, fixed.hit_anim_time, 0); + xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_dive_0", check_anim_hit_to_dive, 0, 0x10, + 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); + xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_top_0", check_anim_hit_to_top, 0, 0x10, 0, + 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); + xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_bottom_0", check_anim_hit_to_bottom, 0, + 0x10, 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); + xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_cycle_0", check_anim_hit_to_cycle, 0, 0x10, + 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); + xAnimTableNewTransition(&at, "bungee_hit_0", "bungee_death_0", check_anim_hit_to_death, 0, 0x10, + 0, 0.0f, 0.0f, 0, 0, fixed.hit_anim_time, 0); + shared.anim_tran.stop = xAnimTableNewTransition(&at, "bungee_cycle_0", "Fall01", 0, 0, 0x10, 0, + 0.0f, 0.0f, 0, 0, 0.5f, 0); } diff --git a/src/SB/Game/zEntPlayerBungeeState.h b/src/SB/Game/zEntPlayerBungeeState.h index 11fd9fa05..3a205034c 100644 --- a/src/SB/Game/zEntPlayerBungeeState.h +++ b/src/SB/Game/zEntPlayerBungeeState.h @@ -5,7 +5,6 @@ #include "xEnt.h" #include "xIni.h" - namespace bungee_state { struct hook_asset : xDynAsset diff --git a/src/SB/Game/zEntPlayerOOBState.cpp b/src/SB/Game/zEntPlayerOOBState.cpp index 25dbc47b6..3a1fe06a1 100644 --- a/src/SB/Game/zEntPlayerOOBState.cpp +++ b/src/SB/Game/zEntPlayerOOBState.cpp @@ -1,19 +1,23 @@ #include "zEntPlayerOOBState.h" + +#include "zEntCruiseBubble.h" +#include "zEntPlayerBungeeState.h" +#include "zGameState.h" #include "zGlobals.h" +#include "zRenderState.h" +#include "zSaveLoad.h" +#include "zSurface.h" #include "xMath.h" #include "xMathInlines.h" -#include "zSurface.h" -#include "zRenderState.h" -#include "zEntPlayerBungeeState.h" -#include "zEntCruiseBubble.h" -#include "zGameState.h" #include "xScrFx.h" -#include "zSaveLoad.h" -#include +#include "iDraw.h" + #include +#include + bool oob_player_teleported; namespace oob_state @@ -374,13 +378,13 @@ void oob_state::init() static in_state_type in_state; shared.states[0] = &in_state; - + static out_state_type out_state; shared.states[1] = &out_state; - + static grab_state_type grab_state; shared.states[2] = &grab_state; - + static drop_state_type drop_state; shared.states[3] = &drop_state; @@ -819,7 +823,7 @@ namespace oob_state grab_state_type::tutorial_callback::tutorial_callback(grab_state_type& owner) : owner(owner) { } - + out_state_type::out_state_type() : state_type(STATE_OUT) { } @@ -828,13 +832,9 @@ namespace oob_state { } - void state_type::start() - { - }; + void state_type::start() {}; - void state_type::stop() - { - }; + void state_type::stop() {}; } // namespace } // namespace oob_state @@ -873,7 +873,6 @@ U8 oob_state::update(xScene& scene, F32 dt) shared.state->start(); } - return shared.control; } @@ -923,7 +922,7 @@ void oob_state::fx_render() render_fade(); render_ghost(); } - + if (shared.render_hand && shared.model != NULL) { render_hand(); @@ -979,8 +978,7 @@ namespace oob_state shared.control = 0; }; - void in_state_type::stop() - { + void in_state_type::stop() { }; @@ -1044,13 +1042,13 @@ namespace oob_state return STATE_GRAB; } } - else + else { if (!globals.player.JumpState) { shared.reset_time = 0.0f; } - + shared.reset_time -= dt; if (shared.reset_time <= 0.0f) { @@ -1072,7 +1070,7 @@ namespace oob_state shared.flags |= 0x4; shared.vertical = FABS(fixed.in_loc.y - fixed.out_loc.y) > 0.01f; shared.control = TRUE; - + this->move_substate = shared.model != NULL ? SS_REORIENT : SS_INVALID; this->reorient_time = fixed.reorient_time; @@ -1165,12 +1163,12 @@ namespace oob_state { this->player_start = globals.player.cp.pos; this->move_substate = shared.model != NULL ? SS_MOVING_IN : SS_INVALID; - + shared.vel = fixed.drop.in_vel; shared.accel = 0.0f; shared.loc.x = fixed.in_loc.x; shared.loc.y = fixed.in_loc.y; - + this->fade_substate = SS_START_FADE_IN; this->fade_start_time = fixed.drop.fade_start_time; this->fade_time = fixed.drop.fade_time; @@ -1182,7 +1180,7 @@ namespace oob_state globals.player.ControlOffTimer = FLOAT_MAX; xScrFxStopFade(); zCameraDisableInput(); - + xModelInstance& m = *p.model; xEntFrame& f = *p.frame; @@ -1195,12 +1193,14 @@ namespace oob_state *(xMat4x3*)m.Mat = f.mat; shared_target.pos = *(xVec3*)&m.Mat->pos; - + set_camera(true); globals.camera.tgt_mat = &shared_target; globals.camera.tgt_omat = &shared_target; - xCameraMove(&globals.camera, 0x20, fixed.cam_dist, fixed.cam_height, PI + globals.player.cp.rot, 0.0f, 0.0f, 0.0f); - xCameraLookYPR(&globals.camera, 0x0, globals.player.cp.rot, fixed.cam_pitch, 0.0f, 0.0f, 0.0f, 0.0f); + xCameraMove(&globals.camera, 0x20, fixed.cam_dist, fixed.cam_height, + PI + globals.player.cp.rot, 0.0f, 0.0f, 0.0f); + xCameraLookYPR(&globals.camera, 0x0, globals.player.cp.rot, fixed.cam_pitch, 0.0f, 0.0f, + 0.0f, 0.0f); } void drop_state_type::stop() @@ -1209,7 +1209,7 @@ namespace oob_state globals.player.ControlOffTimer = 1.0f; reset_camera(); - + shared.render_hand = FALSE; shared.fade_alpha = 1.0f; shared.flags &= ~0x4; diff --git a/src/SB/Game/zEntPlayerOOBState.h b/src/SB/Game/zEntPlayerOOBState.h index bd37d8977..d70d58b39 100644 --- a/src/SB/Game/zEntPlayerOOBState.h +++ b/src/SB/Game/zEntPlayerOOBState.h @@ -1,11 +1,12 @@ #ifndef ZENTPLAYEROOBSTATE_H #define ZENTPLAYEROOBSTATE_H -#include "xserializer.h" -#include "zTalkBox.h" -#include "zTaskBox.h" #include "zCamera.h" #include "zCameraTweak.h" +#include "zTalkBox.h" +#include "zTaskBox.h" + +#include "xserializer.h" extern bool oob_player_teleported; @@ -90,7 +91,6 @@ namespace oob_state virtual void on_signal(U32) { - } virtual void on_stop() @@ -112,7 +112,7 @@ namespace oob_state U8 finished_tutorial; substate_enum (*updatess[10])(grab_state_type&, xScene&, float&); - + grab_state_type(); virtual void start(); virtual void stop(); @@ -134,7 +134,8 @@ namespace oob_state substate_enum update_starting(xScene& scene, F32& dt); static substate_enum supdate_moving_out(grab_state_type& gst, xScene& scene, F32& dt); substate_enum update_moving_out(xScene& scene, F32& dt); - static substate_enum supdate_start_fade_out(grab_state_type& gst, xScene& scene, F32& dt); + static substate_enum supdate_start_fade_out(grab_state_type& gst, xScene& scene, + F32& dt); substate_enum update_start_fade_out(xScene& scene, F32& dt); static substate_enum supdate_fade_out(grab_state_type& gst, xScene& scene, F32& dt); substate_enum update_fade_out(xScene& scene, F32& dt); diff --git a/src/SB/Game/zEntSimpleObj.cpp b/src/SB/Game/zEntSimpleObj.cpp index b9c4d3f0a..d3e86320f 100644 --- a/src/SB/Game/zEntSimpleObj.cpp +++ b/src/SB/Game/zEntSimpleObj.cpp @@ -1,5 +1,6 @@ #include "zEntSimpleObj.h" +#include #include static xSphere* sMgrList; diff --git a/src/SB/Game/zEntSimpleObj.h b/src/SB/Game/zEntSimpleObj.h index dd4d4fbe2..a0f806754 100644 --- a/src/SB/Game/zEntSimpleObj.h +++ b/src/SB/Game/zEntSimpleObj.h @@ -1,22 +1,24 @@ #ifndef ZENTSIMPLEOBJ_H #define ZENTSIMPLEOBJ_H +#include "zCollGeom.h" #include "zEnt.h" -#include "xShadow.h" -#include "xString.h" -#include "xstransvc.h" -#include "iAnim.h" -#include "iModel.h" #include "zFX.h" -#include "xEnt.h" -#include "zCollGeom.h" +#include "zGame.h" #include "zGlobals.h" -#include "xSkyDome.h" #include "zGoo.h" +#include "zLOD.h" #include "zShrapnel.h" + +#include "xEnt.h" #include "xMath.h" -#include "zGame.h" -#include "zLOD.h" +#include "xShadow.h" +#include "xSkyDome.h" +#include "xString.h" +#include "xstransvc.h" + +#include "iAnim.h" +#include "iModel.h" struct xSimpleObjAsset { diff --git a/src/SB/Game/zEntTeleportBox.cpp b/src/SB/Game/zEntTeleportBox.cpp index 74ba33a90..0a69ed857 100644 --- a/src/SB/Game/zEntTeleportBox.cpp +++ b/src/SB/Game/zEntTeleportBox.cpp @@ -1,16 +1,17 @@ #include "zEntTeleportBox.h" -#include "zUIFont.h" -#include "zGlobals.h" #include "zEntCruiseBubble.h" -#include "zRumble.h" #include "zEntPickup.h" #include "zFX.h" +#include "zGlobals.h" +#include "zRumble.h" +#include "zUIFont.h" #include "xEvent.h" #include "xMath.h" #include "xSnd.h" #include "xString.h" + #include "iScrFX.h" #define STATUS_OPEN 0 diff --git a/src/SB/Game/zEntTeleportBox.h b/src/SB/Game/zEntTeleportBox.h index 5a4579330..8b21300e5 100644 --- a/src/SB/Game/zEntTeleportBox.h +++ b/src/SB/Game/zEntTeleportBox.h @@ -2,6 +2,7 @@ #define ZENTTELEPORTBOX_H #include "zEnt.h" + #include "xDynAsset.h" struct teleport_asset : xDynAsset diff --git a/src/SB/Game/zEnv.cpp b/src/SB/Game/zEnv.cpp index 01e550c0e..153380800 100644 --- a/src/SB/Game/zEnv.cpp +++ b/src/SB/Game/zEnv.cpp @@ -1,13 +1,14 @@ #include "zEnv.h" #include "zGlobals.h" -#include "zSurface.h" #include "zLight.h" +#include "zSurface.h" -#include "xstransvc.h" -#include "xGroup.h" -#include "xEvent.h" #include "xClimate.h" +#include "xEvent.h" +#include "xGroup.h" +#include "xstransvc.h" + #include "iLight.h" void zEnvInit(void* env, void* easset) diff --git a/src/SB/Game/zEvent.h b/src/SB/Game/zEvent.h index eacf35c53..4dff6ba9a 100644 --- a/src/SB/Game/zEvent.h +++ b/src/SB/Game/zEvent.h @@ -4,7 +4,6 @@ #include "xEvent.h" #include -#include "xEvent.h" char* zEventName(U32 eventEnum); diff --git a/src/SB/Game/zFMV.cpp b/src/SB/Game/zFMV.cpp index 6d80f3020..6b81cbb6b 100644 --- a/src/SB/Game/zFMV.cpp +++ b/src/SB/Game/zFMV.cpp @@ -1,10 +1,14 @@ -#include -#include -#include "iFMV.h" -#include "xSnd.h" #include "zFMV.h" + #include "zGameState.h" +#include "xSnd.h" + +#include "iFMV.h" + +#include +#include + zFMVFile zFMVFileTable[] = { { eFMVFile_PromoFOP, "FMV\\FOP" }, // Fairly Odd Parents { eFMVFile_PromoTak, "FMV\\Tak" }, // Tak and the Power of Juju diff --git a/src/SB/Game/zFX.cpp b/src/SB/Game/zFX.cpp index 74bc7acbd..77777bc1d 100644 --- a/src/SB/Game/zFX.cpp +++ b/src/SB/Game/zFX.cpp @@ -1,26 +1,26 @@ #include "zFX.h" -#include "rpworld.h" -#include "rwplcore.h" +#include "zEnt.h" +#include "zGlobals.h" +#include "zGoo.h" +#include "zScene.h" +#include "zTextBox.h" + #include "xDebug.h" #include "xEnt.h" #include "xFX.h" #include "xMath.h" #include "xMath3.h" #include "xMathInlines.h" - #include "xSnd.h" -#include "zEnt.h" -#include "zGlobals.h" -#include "zGoo.h" -#include "zScene.h" -#include "zTextBox.h" +#include "rpworld.h" +#include "rwplcore.h" +#include #include -#include -#include #include -#include +#include +#include const xFXRing sPatrickStunRing[3] = { { 0x741b0566, 1.0f, @@ -420,13 +420,15 @@ void zFXGooUpdateInstance(zFXGooInstance* goo, F32 dt) } } - if(goo_timer_textbox != NULL) + if (goo_timer_textbox != NULL) { F32 freeze_time = zFXGooFreezeTimeLeft(); - if(freeze_time > 0.0f) { + if (freeze_time > 0.0f) + { S32 len = freeze_time; - if(len > 0x63) { + if (len > 0x63) + { len = 0x63; } @@ -435,7 +437,8 @@ void zFXGooUpdateInstance(zFXGooInstance* goo, F32 dt) goo_timer_textbox->set_text(counter_text); goo_timer_textbox->activate(); } - else { + else + { goo_timer_textbox->deactivate(); } } diff --git a/src/SB/Game/zFX.h b/src/SB/Game/zFX.h index 0fa51da6c..37ba7a0ce 100644 --- a/src/SB/Game/zFX.h +++ b/src/SB/Game/zFX.h @@ -1,12 +1,12 @@ #ifndef ZFX_H #define ZFX_H -#include "xString.h" #include "xEnt.h" #include "xFX.h" +#include "xString.h" -#include #include +#include struct tweak_info; struct tweak_callback; @@ -21,7 +21,7 @@ enum zFXGooState zFXGooStateForce32Bit = 0xffffffff }; -// Definition updated based on Rat proto data. +// Definition updated based on Rat proto data. struct zFXGooInstance { RpAtomic* atomic; diff --git a/src/SB/Game/zFeet.cpp b/src/SB/Game/zFeet.cpp index ab47ef183..c6f19a3ac 100644 --- a/src/SB/Game/zFeet.cpp +++ b/src/SB/Game/zFeet.cpp @@ -1,13 +1,17 @@ -#include -#include -#include -#include "xBase.h" -#include "xString.h" -#include "xstransvc.h" #include "zFeet.h" + #include "zScene.h" #include "zSurface.h" +#include "xBase.h" +#include "xString.h" +#include "xstransvc.h" + +#include + +#include +#include + // TODO: replace hardcoded constant static U32 sSurfaceSoundIDStep[23]; xBase* paremit_sd_pawprint; diff --git a/src/SB/Game/zGame.cpp b/src/SB/Game/zGame.cpp index ba31265e4..f4304f38a 100644 --- a/src/SB/Game/zGame.cpp +++ b/src/SB/Game/zGame.cpp @@ -1,9 +1,10 @@ +#include "zGame.h" + #include "zCamera.h" #include "zCombo.h" #include "zCutsceneMgr.h" #include "zEntPlayer.h" #include "zFX.h" -#include "zGame.h" #include "zGameExtras.h" #include "zGameState.h" #include "zGlobals.h" @@ -14,10 +15,6 @@ #include "zParPTank.h" #include "zSaveLoad.h" -#include "iDraw.h" -#include "iSystem.h" -#include "iTRC.h" - #include "xDebug.h" #include "xFont.h" #include "xMarkerAsset.h" @@ -29,14 +26,15 @@ #include "xTRC.h" #include "xUtil.h" -#include +#include "iDraw.h" +#include "iSystem.h" +#include "iTRC.h" #include +#include +#include -const static basic_rect screen_bounds = -{ - 0.0f, 0.0f, 1.0f, 1.0f -}; +const static basic_rect screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f }; static U32 sPlayerMarkerStartID; static U32 sPlayerMarkerStartCamID; @@ -61,6 +59,7 @@ static U32 loadMeter; void xMemDebug_SoakLog(const char*); void zCutsceneMgrFinishExit(xBase* to); +// clang-format off char* soaklevels_gameorder[] = { "HB02", @@ -121,6 +120,7 @@ char* soaklevels_gameorder[] = "PG12", NULL }; +// clang-format on char** soaklevels = soaklevels_gameorder; @@ -237,8 +237,7 @@ static U32 PickNextSoak() static S32 soakidx = 0; static S32 soakcnt = 0; - static enum en_SOAK_DIR - { + static enum en_SOAK_DIR { SOAK_FOR, SOAK_BACK, SOAK_RAND, @@ -264,60 +263,60 @@ static U32 PickNextSoak() switch (soakdir) { - case SOAK_FOR: - // Phantom branch here. - name = soaklevels[soakidx]; - soakidx++; - if (*(volatile S32*)(&soakidx) < soakcnt) - { - break; - } - if (justwrap != 0) - { - soakidx = 0; - } - else - { - soakidx = soakcnt - 2; - soakdir = SOAK_BACK; - } + case SOAK_FOR: + // Phantom branch here. + name = soaklevels[soakidx]; + soakidx++; + if (*(volatile S32*)(&soakidx) < soakcnt) + { break; - case SOAK_BACK: - name = soaklevels[soakidx]; - soakidx--; - if (*(volatile S32*)(&soakidx) >= 0) - { - break; - } - if (justwrap != 0) - { - soakidx = soakcnt - 1; - } - else - { - soakidx = 0; - soakdir = SOAK_RAND; - } + } + if (justwrap != 0) + { + soakidx = 0; + } + else + { + soakidx = soakcnt - 2; + soakdir = SOAK_BACK; + } + break; + case SOAK_BACK: + name = soaklevels[soakidx]; + soakidx--; + if (*(volatile S32*)(&soakidx) >= 0) + { break; - default: - if (globals.sceneCur != NULL) - { - tag = globals.sceneCur->sceneID; - } - else - { - tag = 0; - } + } + if (justwrap != 0) + { + soakidx = soakcnt - 1; + } + else + { + soakidx = 0; + soakdir = SOAK_RAND; + } + break; + default: + if (globals.sceneCur != NULL) + { + tag = globals.sceneCur->sceneID; + } + else + { + tag = 0; + } - S32 scoobydoobydoo = tag; + S32 scoobydoobydoo = tag; - while (scoobydoobydoo == globals.sceneCur->sceneID) - { - name = (char *)xUtil_select(soaklevels, soakcnt, 0); - scoobydoobydoo = name[0] << 24 | name[1] << 16 | name[2] << 8 | name[3]; - } + while (scoobydoobydoo == globals.sceneCur->sceneID) + { + name = (char*)xUtil_select(soaklevels, soakcnt, 0); + scoobydoobydoo = name[0] << 24 | name[1] << 16 | name[2] << 8 | name[3]; + } - break; + break; } char useme[5] = {}; @@ -399,7 +398,7 @@ void zGameSetup() gGameWhereAmI = eGameWhere_SetupScene; zSceneSetup(); gGameWhereAmI = eGameWhere_SetupZFX; - RpWorld* world = globals.sceneCur->env->geom->world; + RpWorld* world = globals.sceneCur->env->geom->world; xModel_SceneEnter(world); zFX_SceneEnter(world); gGameWhereAmI = eGameWhere_SetupPlayer; @@ -460,7 +459,8 @@ static S32 zGameLoopContinue() { if (gGameMode == eGameMode_Game) { - return gGameState == eGameState_Play || gGameState == eGameState_GameOver || gGameState == eGameState_GameStats; + return gGameState == eGameState_Play || gGameState == eGameState_GameOver || + gGameState == eGameState_GameStats; } else { @@ -545,43 +545,37 @@ static void zGame_HackPostPortalAutoSaveDraw() { U32 i; RwCamera* ccam; - RwCamera* cam; + RwCamera* cam; RwRaster* rast; char str[2048]; - RwTexture* tex; + RwTexture* tex; RwRGBA bg = {}; - + cam = (RwCamera*)RwEngineInstance->curCamera; if (cam != NULL) { RwCameraEndUpdate(cam); } - + sprintf(str, "{font=0}{i:MNU4 AUTO SAVE TXT}"); - - ccam = (RwCamera *)iCameraCreate(640, 480, 0); - - xtextbox tb = xtextbox::create - ( - xfont::create - ( - 1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, - xColorFromRGBA(0xFF, 0xE6, 0x00, 0xFF), - screen_bounds - ), - screen_bounds, 0, 0.0f, 0.0f, 0.0f, 0.0f - ); - + + ccam = (RwCamera*)iCameraCreate(640, 480, 0); + + xtextbox tb = + xtextbox::create(xfont::create(1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, + xColorFromRGBA(0xFF, 0xE6, 0x00, 0xFF), screen_bounds), + screen_bounds, 0, 0.0f, 0.0f, 0.0f, 0.0f); + tb.flags |= 2; tb.bounds.assign(0.0f, 0.4125f, 1.0f, 0.25f); tb.bounds.contract(0.025f); tb.set_text(str); - tb.bounds.h = tb.yextent(true); + tb.bounds.h = tb.yextent(true); tb.bounds.y = -((tb.bounds.h * 0.5f) - 0.5f); - tb.font.clip = tb.bounds; + tb.font.clip = tb.bounds; tb.font.clip.expand(0.025f); F32 yextent = tb.yextent(true); - + for (i = 0; i < 2; i++) { RwCameraClear(ccam, &bg, rwCAMERACLEARZ | rwCAMERACLEARIMAGE); @@ -595,12 +589,12 @@ static void zGame_HackPostPortalAutoSaveDraw() { rast = NULL; } - - zGame_HackDrawCard(0.0f, 0.0f, 320.0f, 240.0f, rast); - zGame_HackDrawCard(320.0f, 0.0f, 320.0f, 240.0f, rast); - zGame_HackDrawCard(0.0f, 240.0f, 320.0f, 240.0f, rast); + + zGame_HackDrawCard(0.0f, 0.0f, 320.0f, 240.0f, rast); + zGame_HackDrawCard(320.0f, 0.0f, 320.0f, 240.0f, rast); + zGame_HackDrawCard(0.0f, 240.0f, 320.0f, 240.0f, rast); zGame_HackDrawCard(320.0f, 240.0f, 320.0f, 240.0f, rast); - + tex = (RwTexture*)xSTFindAsset(xStrHash("ui_savinggame"), NULL); if (tex == NULL) { @@ -622,7 +616,7 @@ static void zGame_HackPostPortalAutoSaveDraw() render_fill_rect(tb.font.clip, xColorFromRGBA(0x00, 0x00, 0x00, 0xFF)); tb.render(true); } - + RwCameraEndUpdate(ccam); RwCameraShowRaster(ccam, NULL, 1); } @@ -677,16 +671,16 @@ static void zGameUpdateMode() { switch (zGameOkToPause()) { - case 0: - xTRCReset(); - startPressed = 1; - break; - case 1: - zGamePause(); - break; - case 2: - zGameStall(); - break; + case 0: + xTRCReset(); + startPressed = 1; + break; + case 1: + zGamePause(); + break; + case 2: + zGameStall(); + break; } } else @@ -704,18 +698,21 @@ static void zGameUpdateMode() passet = globals.sceneCur->pendingPortal->passet; - U32 d = *(char *)((int)&passet->sceneID + 3); - U32 c = *(char *)((int)&passet->sceneID + 0); - U32 b = *(char *)((int)&passet->sceneID + 2); - U32 a = *(char *)((int)&passet->sceneID + 1); + U32 d = *(char*)((int)&passet->sceneID + 3); + U32 c = *(char*)((int)&passet->sceneID + 0); + U32 b = *(char*)((int)&passet->sceneID + 2); + U32 a = *(char*)((int)&passet->sceneID + 1); - U32 x = (((b << 8) & 0xff00) | (((d << 24) & 0xff000000) | ((a << 16) & 0x00ffffff)) & 0xffff00ff); - U32 y = (((a << 8) & 0xff00) | (((c << 24) & 0xff000000) | ((b << 16) & 0x00ffffff)) & 0xffff00ff); + U32 x = (((b << 8) & 0xff00) | + (((d << 24) & 0xff000000) | ((a << 16) & 0x00ffffff)) & 0xffff00ff); + U32 y = (((a << 8) & 0xff00) | + (((c << 24) & 0xff000000) | ((b << 16) & 0x00ffffff)) & 0xffff00ff); nextSceneID = x | c; x = d | y; - if ((g_hiphopReloadHIP != 0) || ((g_hiphopForcePortal != 0) || (x != globals.sceneCur->sceneID))) + if ((g_hiphopReloadHIP != 0) || + ((g_hiphopForcePortal != 0) || (x != globals.sceneCur->sceneID))) { sPlayerMarkerStartID = passet->assetMarkerID; sPlayerMarkerStartCamID = passet->assetCameraID; @@ -741,23 +738,23 @@ static void zGameUpdateMode() if (gWaitingToAutoSave != 0) { zGame_HackPostPortalAutoSaveDraw(); - + zSaveLoadPreAutoSave(1); if (zSaveLoad_DoAutoSave() < 0) { - sendTo = (xBase *)zSceneFindObject(xStrHash("MNU4 AUTO SAVE FAILED")); + sendTo = (xBase*)zSceneFindObject(xStrHash("MNU4 AUTO SAVE FAILED")); if (sendTo != NULL) { zEntEvent(sendTo, eEventVisible); } } - - sendTo = (xBase *)zSceneFindObject(xStrHash("SAVING GAME ICON UI")); + + sendTo = (xBase*)zSceneFindObject(xStrHash("SAVING GAME ICON UI")); if (sendTo != NULL) { zEntEvent(sendTo, eEventInvisible); } - + zSaveLoadPreAutoSave(0); gWaitingToAutoSave = 0; } @@ -779,32 +776,34 @@ static void zGameUpdateMode() sPlayerMarkerStartID = 0; } } - + if (gSoak != 0) { - sendTo = (xBase *)zSceneGetObject(eBaseTypeCamera, 0); + sendTo = (xBase*)zSceneGetObject(eBaseTypeCamera, 0); sPlayerMarkerStartCamID = sendTo->id; } else { - sendTo = (xBase *)zSceneFindObject(sPlayerMarkerStartCamID); + sendTo = (xBase*)zSceneFindObject(sPlayerMarkerStartCamID); if (sendTo == NULL) { xSTAssetName(sPlayerMarkerStartCamID); - sendTo = (xBase *)zSceneGetObject(eBaseTypeCamera, 0); + sendTo = (xBase*)zSceneGetObject(eBaseTypeCamera, 0); sPlayerMarkerStartCamID = sendTo->id; xSTAssetName(sendTo->id); } } - + gGameWhereAmI = eGameWhere_ModeStoreCheckpoint; if (sendTo != NULL) { - zEntPlayer_StoreCheckPoint(&globals.player.ent.frame->mat.pos, globals.player.ent.frame->rot.angle, sPlayerMarkerStartCamID); + zEntPlayer_StoreCheckPoint(&globals.player.ent.frame->mat.pos, + globals.player.ent.frame->rot.angle, + sPlayerMarkerStartCamID); } - + sPlayerMarkerStartCamID = 0; - + if (gPendingPlayer != eCurrentPlayerCount) { gCurrentPlayer = gPendingPlayer; @@ -856,17 +855,17 @@ void zGameUpdateTransitionBubbles() { gGameWhereAmI = eGameWhere_TransitionBubbles; sTimeCurrent = iTimeGet(); - F32 diff = iTimeDiffSec(sTimeLast, sTimeCurrent); + F32 diff = iTimeDiffSec(sTimeLast, sTimeCurrent); sTimeElapsed = diff; sTimeLast = sTimeCurrent; - if (sTimeElapsed > 0.5f) - { - zParPTankUpdate(sTimeElapsed); - } - else - { - zParPTankUpdate(0.5f); - } + if (sTimeElapsed > 0.5f) + { + zParPTankUpdate(sTimeElapsed); + } + else + { + zParPTankUpdate(0.5f); + } zParPTankRender(); } @@ -882,14 +881,14 @@ void zGameScreenTransitionBegin() if (DirectionalLight != NULL) { RwRGBAReal col; - col.red = col.green = col.blue = 1.0f; - col.alpha = 0.0f; + col.red = col.green = col.blue = 1.0f; + col.alpha = 0.0f; RpLightSetColor(DirectionalLight, &col); RwFrame* frame = RwFrameCreate(); _rwObjectHasFrameSetFrame(DirectionalLight, frame); RwBBox box; - box.sup.z = box.sup.y = box.sup.x = 10000.0f; - box.inf.z = box.inf.y = box.inf.x = -10000.0f; + box.sup.z = box.sup.y = box.sup.x = 10000.0f; + box.inf.z = box.inf.y = box.inf.x = -10000.0f; World = RpWorldCreate(&box); RpWorldAddCamera(World, sGameScreenTransCam); gGameWhereAmI = eGameWhere_TransitionSnapShot; @@ -932,9 +931,9 @@ void zGameScreenTransitionUpdate(F32 percentComplete, char* msg, U8* rgba) RwRGBA back_col = { 0xFF, 0x00, 0x00, 0x00 }; if (rgba != NULL) { - back_col.red = rgba[0]; + back_col.red = rgba[0]; back_col.green = rgba[1]; - back_col.blue = rgba[2]; + back_col.blue = rgba[2]; back_col.alpha = rgba[3]; } @@ -969,9 +968,9 @@ void zGameScreenTransitionUpdate(F32 percentComplete, char* msg, U8* rgba) vx[0].x = 0.0f; vx[0].y = 0.0f; vx[0].z = z; - vx[0].emissiveColor.red = bgr; + vx[0].emissiveColor.red = bgr; vx[0].emissiveColor.green = bgb; - vx[0].emissiveColor.blue = bgg; + vx[0].emissiveColor.blue = bgg; vx[0].emissiveColor.alpha = bga; vx[0].u = bgu1; vx[0].v = bgv1; @@ -979,9 +978,9 @@ void zGameScreenTransitionUpdate(F32 percentComplete, char* msg, U8* rgba) vx[1].x = 0.0f; vx[1].y = 480.0f; vx[1].z = z; - vx[1].emissiveColor.red = bgr; + vx[1].emissiveColor.red = bgr; vx[1].emissiveColor.green = bgb; - vx[1].emissiveColor.blue = bgg; + vx[1].emissiveColor.blue = bgg; vx[1].emissiveColor.alpha = bga; vx[1].u = bgu1; vx[1].v = bgv2; @@ -989,9 +988,9 @@ void zGameScreenTransitionUpdate(F32 percentComplete, char* msg, U8* rgba) vx[2].x = 640.0f; vx[2].y = 0.0f; vx[2].z = z; - vx[2].emissiveColor.red = bgr; + vx[2].emissiveColor.red = bgr; vx[2].emissiveColor.green = bgb; - vx[2].emissiveColor.blue = bgg; + vx[2].emissiveColor.blue = bgg; vx[2].emissiveColor.alpha = bga; vx[2].u = bgu2; vx[2].v = bgv1; @@ -999,9 +998,9 @@ void zGameScreenTransitionUpdate(F32 percentComplete, char* msg, U8* rgba) vx[3].x = 640.0f; vx[3].y = 480.0f; vx[3].z = z; - vx[3].emissiveColor.red = bgr; + vx[3].emissiveColor.red = bgr; vx[3].emissiveColor.green = bgb; - vx[3].emissiveColor.blue = bgg; + vx[3].emissiveColor.blue = bgg; vx[3].emissiveColor.alpha = bga; vx[3].u = bgu2; vx[3].v = bgv2; @@ -1024,21 +1023,21 @@ void zGameScreenTransitionUpdate(F32 percentComplete, char* msg, U8* rgba) switch ((loadMeter / 0x19) % 5) { - case 0: - strcpy(meter, " "); - break; - case 1: - strcpy(meter, ". "); - break; - case 2: - strcpy(meter, ".. "); - break; - case 3: - strcpy(meter, "..."); - break; - case 4: - loadMeter = 0; - break; + case 0: + strcpy(meter, " "); + break; + case 1: + strcpy(meter, ". "); + break; + case 2: + strcpy(meter, ".. "); + break; + case 3: + strcpy(meter, "..."); + break; + case 4: + loadMeter = 0; + break; } loadMeter++; @@ -1098,9 +1097,9 @@ void zGameSetupPlayer() xEntAsset* asset = (xEntAsset*)xSTFindAssetByType('PLYR', xSTAssetCountByType('PLYR') - 1, 0); U32 size; xMarkerAsset* m; - + asset->baseType = eBaseTypePlayer; - + if (sPortalling != 0) { if (sPlayerStartAngle > -1e8f) @@ -1109,30 +1108,30 @@ void zGameSetupPlayer() } sPortalling = 0; } - + asset->ang.y = 0.0f; asset->ang.z = 0.0f; gGameWhereAmI = eGameWhere_SetupPlayerInit; zEntPlayer_Init(&globals.player.ent, asset); - + if (sPlayerMarkerStartID != 0) { - m = (xMarkerAsset *)xSTFindAsset(sPlayerMarkerStartID, &size); + m = (xMarkerAsset*)xSTFindAsset(sPlayerMarkerStartID, &size); if (m != NULL) { - xVec3Copy((xVec3 *)&globals.player.ent.frame->mat.pos, &m->pos); - xVec3Copy((xVec3 *)&globals.player.ent.frame->oldmat.pos, &m->pos); - xVec3Copy((xVec3 *)&globals.player.ent.model->Mat->pos, &m->pos); + xVec3Copy((xVec3*)&globals.player.ent.frame->mat.pos, &m->pos); + xVec3Copy((xVec3*)&globals.player.ent.frame->oldmat.pos, &m->pos); + xVec3Copy((xVec3*)&globals.player.ent.model->Mat->pos, &m->pos); xCameraSetTargetMatrix(&globals.camera, xEntGetFrame(&globals.player.ent)); } sPlayerMarkerStartID = 0; } - + gGameWhereAmI = eGameWhere_SetupPlayerCamera; zCameraReset(&globals.camera); - zEntPlayer_StoreCheckPoint(&globals.player.ent.frame->mat.pos, globals.player.ent.frame->rot.angle, globals.camera.id); + zEntPlayer_StoreCheckPoint(&globals.player.ent.frame->mat.pos, + globals.player.ent.frame->rot.angle, globals.camera.id); gGameWhereAmI = eGameWhere_SetupPlayerEnd; - } void zGameStats_Init() diff --git a/src/SB/Game/zGameExtras.cpp b/src/SB/Game/zGameExtras.cpp index 0a17e5a77..4970be188 100644 --- a/src/SB/Game/zGameExtras.cpp +++ b/src/SB/Game/zGameExtras.cpp @@ -1,19 +1,20 @@ -#include -#include +#include "zGameExtras.h" -#include "iTime.h" +#include "zEntPlayer.h" +#include "zGame.h" +#include "zGlobals.h" +#include "zScene.h" -#include "xString.h" -#include "xSnd.h" -#include "xEnt.h" #include "xCounter.h" +#include "xEnt.h" +#include "xSnd.h" +#include "xString.h" #include "xUtil.h" -#include "zGameExtras.h" -#include "zEntPlayer.h" -#include "zGlobals.h" -#include "zGame.h" -#include "zScene.h" +#include "iTime.h" + +#include +#include static S32 g_enableGameExtras; static S32 g_currDay; diff --git a/src/SB/Game/zGameState.cpp b/src/SB/Game/zGameState.cpp index 479f4c8b4..4eb2cf8bd 100644 --- a/src/SB/Game/zGameState.cpp +++ b/src/SB/Game/zGameState.cpp @@ -1,12 +1,12 @@ #include "zGameState.h" -#include "..\Core\x\xSnd.h" +#include "zGame.h" +#include "zGlobals.h" + #include "..\Core\x\xEvent.h" +#include "..\Core\x\xSnd.h" #include "..\Core\x\xserializer.h" -#include "zGlobals.h" -#include "zGame.h" - S32 gGameState = eGameState_Dead; eGameMode gGameMode; _GameOstrich gGameOstrich; @@ -138,7 +138,7 @@ void zGameSetOstrich(_GameOstrich value) } S32 zGameStateFindEvent(U32* eventList, S32 eventCount, S32 targetMode, S32 targetEvent, - S32* new_mode, S32* new_state) + S32* new_mode, S32* new_state) { for (S32 i = 0; i < eventCount; ++i) { diff --git a/src/SB/Game/zGameState.h b/src/SB/Game/zGameState.h index 8cc518d8d..bb1737433 100644 --- a/src/SB/Game/zGameState.h +++ b/src/SB/Game/zGameState.h @@ -100,7 +100,7 @@ eGameMode zGameModeGet(); _GameOstrich zGameGetOstrich(); void zGameSetOstrich(_GameOstrich o); S32 zGameStateFindEvent(U32* eventList, S32 eventCount, S32 targetMode, S32 targetEvent, - S32* new_mode, S32* new_state); + S32* new_mode, S32* new_state); void zGameStateSwitchEvent(S32 event); void zGameStateSwitch(S32 theNewState); void zGameModeSwitch(eGameMode modeNew); diff --git a/src/SB/Game/zGlobals.h b/src/SB/Game/zGlobals.h index 8ab248eed..38ce3d07c 100644 --- a/src/SB/Game/zGlobals.h +++ b/src/SB/Game/zGlobals.h @@ -1,14 +1,12 @@ #ifndef ZGLOBALS_H #define ZGLOBALS_H +#include "zCutsceneMgr.h" +#include "zEntPlayer.h" + +#include "xEntDrive.h" #include "xGlobals.h" #include "xShadowSimple.h" -#include "xEntDrive.h" - -#include "zEnt.h" -#include "zEntPlayer.h" -#include "zScene.h" -#include "zCutsceneMgr.h" struct zGlobalSettings { diff --git a/src/SB/Game/zGoo.h b/src/SB/Game/zGoo.h index 23ec4adca..62f7d43de 100644 --- a/src/SB/Game/zGoo.h +++ b/src/SB/Game/zGoo.h @@ -3,8 +3,8 @@ #include "xEnt.h" -#include #include +#include void zGooInit(S32 nobj); void zGooExit(); diff --git a/src/SB/Game/zGrid.cpp b/src/SB/Game/zGrid.cpp index c06efb26f..5f72d17d1 100644 --- a/src/SB/Game/zGrid.cpp +++ b/src/SB/Game/zGrid.cpp @@ -1,12 +1,14 @@ -#include "zBase.h" #include "zGrid.h" + +#include "zBase.h" + #include "xEnt.h" #include "xGrid.h" #include "xString.h" - #include "xVec3.h" + +#include #include -#include xGrid colls_grid; xGrid colls_oso_grid; diff --git a/src/SB/Game/zGust.cpp b/src/SB/Game/zGust.cpp index 4086a12b2..c3c6d2332 100644 --- a/src/SB/Game/zGust.cpp +++ b/src/SB/Game/zGust.cpp @@ -1,14 +1,15 @@ -#include "xstransvc.h" +#include "zGust.h" + +#include "zParEmitter.h" +#include "zScene.h" + +#include "xEvent.h" #include "xMath.h" #include "xMath3.h" -#include "xEvent.h" #include "xString.h" #include "xVec3.h" #include "xVec3Inlines.h" - -#include "zGust.h" -#include "zParEmitter.h" -#include "zScene.h" +#include "xstransvc.h" #include diff --git a/src/SB/Game/zGust.h b/src/SB/Game/zGust.h index a30bf70e8..8e34b79bd 100644 --- a/src/SB/Game/zGust.h +++ b/src/SB/Game/zGust.h @@ -1,11 +1,11 @@ #ifndef ZGUST_H #define ZGUST_H +#include "zVolume.h" + #include "xBase.h" #include "xMath3.h" -#include "zVolume.h" - #include struct zGustAsset : xBaseAsset diff --git a/src/SB/Game/zHud.cpp b/src/SB/Game/zHud.cpp index 92b870e59..b5a6ab418 100644 --- a/src/SB/Game/zHud.cpp +++ b/src/SB/Game/zHud.cpp @@ -1,16 +1,18 @@ +#include "zHud.h" + +#include "zGame.h" +#include "zGameState.h" +#include "zGlobals.h" +#include "zScene.h" + #include "xHud.h" -#include "xHudText.h" #include "xHudFontMeter.h" #include "xHudModel.h" +#include "xHudText.h" #include "xString.h" -#include "zHud.h" -#include "zScene.h" -#include "zGlobals.h" -#include "zGameState.h" -#include "zGame.h" -#include #include +#include // TODO: This also lives in zCombo - those should be moved to a header at some point struct widget_chunk : xBase @@ -132,7 +134,8 @@ namespace zhud } else { - xhud::font_meter_widget* meter = (xhud::font_meter_widget*)zSceneFindObject(xStrHash(widget_resources[7])); + xhud::font_meter_widget* meter = + (xhud::font_meter_widget*)zSceneFindObject(xStrHash(widget_resources[7])); meter->max_value = (F32)special.max_value; meter->get_asset()->counter_mode = 1; widgets[7] = meter; @@ -140,13 +143,14 @@ namespace zhud // TODO: the return of zSceneFindObject isn't a model_widget, but an object that contains a model_widget at 0x10 // what is it??? - xhud::model_widget* model = (xhud::model_widget*)zSceneFindObject(xStrHash(special.hud_model)); + xhud::model_widget* model = + (xhud::model_widget*)zSceneFindObject(xStrHash(special.hud_model)); widgets[8] = model; model->enable(); } - + memset(max_value, 0x0, sizeof(max_value)); - + value[0] = globals.player.Health; max_value[0] = globals.player.MaxHealth; value[1] = globals.player.Inv_Shiny; @@ -154,11 +158,12 @@ namespace zhud value[3] = globals.player.Inv_PatsSock_Total; value[4] = globals.player.Inv_LevelPickups_CurrentLevel; - for (i = 0; i < 5; i++) + for (i = 0; i < 5; i++) { - if (widgets[meter_widget_index[i]] != NULL) + if (widgets[meter_widget_index[i]] != NULL) { - xhud::meter_widget* meter = (xhud::meter_widget*)get_meter_widget(meter_widget_index[i]); + xhud::meter_widget* meter = + (xhud::meter_widget*)get_meter_widget(meter_widget_index[i]); if (max_value[i] != 0) { old_max_value[i] = max_value[i]; @@ -218,32 +223,32 @@ namespace zhud { updated_value = 0; } - + U32 another_updated_value = 0; if (updated_value & 0xFF || (max_value[i] != 0 && old_max_value[i] != max_value[i])) { another_updated_value = 1; } - + if (another_updated_value & 0xFF) { S32 meter_idx = meter_widget_index[i]; - if (widgets[meter_idx] != NULL) + if (widgets[meter_idx] != NULL) { xhud::meter_widget* meter = (xhud::meter_widget*)get_meter_widget(meter_idx); if (max_value[i] != 0) { old_max_value[i] = max_value[i]; meter->max_value = (F32)max_value[i]; - } - + } + old_value[i] = value[i]; meter->set_value((F32)value[i]); hiding[i] = 0; ping_widget(*meter); - if (model_widget_index[i] != -1) + if (model_widget_index[i] != -1) { ping_widget(*get_model_widget(model_widget_index[i])); } @@ -290,7 +295,7 @@ namespace zhud { xhud::widget* widget = widgets[i]; widget->clear_motives(xhud::delay_motive_update, (void*)zhud::hide_widget); - if (!(widget->showing() & 0xFF)) + if (!(widget->showing() & 0xFF)) { widget->show(); } diff --git a/src/SB/Game/zHud.h b/src/SB/Game/zHud.h index 96e7b0ec8..2aec7f959 100644 --- a/src/SB/Game/zHud.h +++ b/src/SB/Game/zHud.h @@ -1,15 +1,17 @@ #ifndef ZHUD_H #define ZHUD_H -#include -#include "xString.h" +#include "xHud.h" #include "xHudMeter.h" #include "xHudModel.h" -#include "xHud.h" +#include "xString.h" + +#include extern const basic_rect screen_bounds; -struct special_data { +struct special_data +{ char* hud_model; S32 max_value; }; diff --git a/src/SB/Game/zLOD.cpp b/src/SB/Game/zLOD.cpp index 7270b0cfd..af4123330 100644 --- a/src/SB/Game/zLOD.cpp +++ b/src/SB/Game/zLOD.cpp @@ -1,13 +1,14 @@ #include "zLOD.h" -#include "xModel.h" -#include +#include "zBase.h" +#include "zEntDestructObj.h" #include "xEnt.h" #include "xMathInlines.h" +#include "xModel.h" -#include "zBase.h" -#include "zEntDestructObj.h" +#include +#include static U32 sTableCount; static zLODTable* sTableList; diff --git a/src/SB/Game/zLasso.cpp b/src/SB/Game/zLasso.cpp index a1b347c85..c5a0e0404 100644 --- a/src/SB/Game/zLasso.cpp +++ b/src/SB/Game/zLasso.cpp @@ -2,9 +2,10 @@ #include "xMath3.h" #include "xMathInlines.h" +#include "xstransvc.h" + #include "iAnim.h" #include "iModel.h" -#include "xstransvc.h" #include "iParMgr.h" #include @@ -189,7 +190,7 @@ void zLasso_Update(zLasso* lasso, xEnt* ent, F32 dt) xVec3AddScaled(&lasso->crCenter, &lasso->tgCenter, interp); xVec3SubFrom(&lasso->crCenter, &lasso->anchor); } - + if (lasso->flags & 0x4) { fizzicalNormal(lasso, dt, &newPoint); @@ -372,19 +373,19 @@ static void fizzicalHonda(zLasso* lasso, F32 dt, xVec3* newPoint) xVec3AddScaled(&lasso->honda, &lasso->crNormal, -xVec3Dot(&lasso->crNormal, &lasso->honda)); xVec3Normalize(&lasso->honda, &lasso->honda); xVec3SMulBy(&lasso->honda, lasso->crRadius); - + if ((negativeHondaX != 0) && (lasso->honda.x > 0.0f)) { xSndPlay3D(xStrHash("sound_rope_windup"), 0.77f, 0.0f, 0U, 0x10000U, &lasso->anchor, 100.0f, SND_CAT_GAME, 0.0f); negativeHondaX = 0; } - + if (lasso->honda.x < 0.0f) { negativeHondaX = 1; } - + xVec3AddTo(&lasso->honda, &lasso->crCenter); } @@ -448,53 +449,63 @@ static void initVertMap(zLassoGuide* guide) S32 center = tris->vertIndex[0]; S32 init = tris->vertIndex[0]; - + if (((init != tris->vertIndex[4] && init != tris->vertIndex[5] && init != tris->vertIndex[6]) || - (init != tris->vertIndex[8] && init != tris->vertIndex[9] && init != tris->vertIndex[10])) && - ((init = tris->vertIndex[1], init != tris->vertIndex[4] && init != tris->vertIndex[5] && init != tris->vertIndex[6]) || + (init != tris->vertIndex[8] && init != tris->vertIndex[9] && + init != tris->vertIndex[10])) && + ((init = tris->vertIndex[1], + init != tris->vertIndex[4] && init != tris->vertIndex[5] && init != tris->vertIndex[6]) || (init != tris->vertIndex[8] && init != tris->vertIndex[9] && init != tris->vertIndex[10]))) { init = tris->vertIndex[2]; } - - if (init == tris->vertIndex[0]) { + + if (init == tris->vertIndex[0]) + { init = tris->vertIndex[1]; } - + S32 vertIdx = 0; S32 curr = init; S32 currTri; ushort* puVar5; - - do { + + do + { vertIdx = vertIdx + 1; guide->vertMap[vertIdx - 1] = curr; - - if (vertIdx == numTri) { + + if (vertIdx == numTri) + { vertIdx = 0; } - - while (true) { + + while (true) + { puVar5 = &tris->vertIndex[vertIdx]; currTri = puVar5[0]; - - if (curr == currTri || curr == puVar5[1] || curr == puVar5[2]) { + + if (curr == currTri || curr == puVar5[1] || curr == puVar5[2]) + { break; } - + vertIdx = vertIdx + 1; - if (vertIdx == numTri) { + if (vertIdx == numTri) + { vertIdx = 0; } } - - if ((curr != currTri && center != currTri)) { - currTri = puVar5[1]; - if ((curr != currTri && center != currTri)) { + + if ((curr != currTri && center != currTri)) + { + currTri = puVar5[1]; + if ((curr != currTri && center != currTri)) + { currTri = puVar5[2]; } } - + curr = currTri; } while (currTri != init); } diff --git a/src/SB/Game/zLasso.h b/src/SB/Game/zLasso.h index 3c753bd9b..336232c63 100644 --- a/src/SB/Game/zLasso.h +++ b/src/SB/Game/zLasso.h @@ -1,10 +1,11 @@ #ifndef ZLASSO_H #define ZLASSO_H +#include "zEnt.h" + #include "xMath3.h" #include "xModel.h" #include "xString.h" -#include "zEnt.h" struct zLasso { diff --git a/src/SB/Game/zLight.cpp b/src/SB/Game/zLight.cpp index aed7fd78a..c2de80718 100644 --- a/src/SB/Game/zLight.cpp +++ b/src/SB/Game/zLight.cpp @@ -1,14 +1,16 @@ #include "zLight.h" -#include "zLightEffect.h" + #include "zGlobals.h" -#include "../rwsdk/rwplcore.h" -#include "xShadow.h" +#include "zLightEffect.h" + #include "xPartition.h" +#include "xShadow.h" #include "xString.h" -#include "xPartition.h" -#include +#include + #include +#include static _zLight* sLight[32]; S32 sLightTotal; diff --git a/src/SB/Game/zLight.h b/src/SB/Game/zLight.h index 85429ecb2..6875b4199 100644 --- a/src/SB/Game/zLight.h +++ b/src/SB/Game/zLight.h @@ -5,6 +5,7 @@ #include "xEnt.h" #include "xEnv.h" + #include "iLight.h" // Size: 0x38 @@ -59,7 +60,6 @@ void zLightSetVolume(zVolume* vol); void zLightDestroyAll(); void zLightDestroy(_zLight* param_1); void zLightUpdate(xBase* to, xScene*, F32 dt); -S32 zLightEventCB(xBase* param_1, xBase* to, U32 toEvent, const float* param_4, - xBase* param_5); +S32 zLightEventCB(xBase* param_1, xBase* to, U32 toEvent, const float* param_4, xBase* param_5); #endif diff --git a/src/SB/Game/zLightEffect.cpp b/src/SB/Game/zLightEffect.cpp index f6cbfbd2f..30bcdb00b 100644 --- a/src/SB/Game/zLightEffect.cpp +++ b/src/SB/Game/zLightEffect.cpp @@ -2,8 +2,8 @@ #include "xMath.h" -#include #include +#include static F32 leGetRandom() { @@ -189,5 +189,5 @@ void zLightEffectCauldron(_zLight* zlight, F32 seconds) l->color.g = leBlendToCol(l->color.g, reg[2], amount); l->color.b = leBlendToCol(l->color.b, reg[3], amount); - iLightSetColor(l, &l->color); + iLightSetColor(l, &l->color); } diff --git a/src/SB/Game/zLightEffect.h b/src/SB/Game/zLightEffect.h index 19f2a694f..6ea778952 100644 --- a/src/SB/Game/zLightEffect.h +++ b/src/SB/Game/zLightEffect.h @@ -1,10 +1,12 @@ #ifndef ZLIGHTEFFECT_H #define ZLIGHTEFFECT_H -#include "iLight.h" -#include "xBase.h" #include "zLight.h" +#include "xBase.h" + +#include "iLight.h" + #include typedef void (*lightInitFunc)(_zLight*); diff --git a/src/SB/Game/zLightning.cpp b/src/SB/Game/zLightning.cpp index 069f6ff4d..43470368f 100644 --- a/src/SB/Game/zLightning.cpp +++ b/src/SB/Game/zLightning.cpp @@ -1,13 +1,15 @@ #include "zLightning.h" -#include "xDebug.h" #include "zGlobals.h" -#include "xstransvc.h" + +#include "xDebug.h" #include "xParEmitter.h" +#include "xstransvc.h" -#include #include +#include + #define NUM_LIGHTNING 48 _tagLightningAdd gLightningTweakAddInfo; @@ -106,10 +108,16 @@ void zLightningInit() sLFuncY[9].next = NULL; sLFuncZ[9].next = NULL; - for (S32 i = 0; i < 10; i++) { - xVec3Init(&sLFuncVal[i], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f)); - xVec3Init(&sLFuncSlope[i][0], sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), sLFuncSlopeRange * (2.0f * (xurand() - 0.5f))); - xVec3Init(&sLFuncSlope[i][1], sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), sLFuncSlopeRange * (2.0f * (xurand() - 0.5f))); + for (S32 i = 0; i < 10; i++) + { + xVec3Init(&sLFuncVal[i], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), + 2.0f * (xurand() - 0.5f)); + xVec3Init(&sLFuncSlope[i][0], sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), + sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), + sLFuncSlopeRange * (2.0f * (xurand() - 0.5f))); + xVec3Init(&sLFuncSlope[i][1], sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), + sLFuncSlopeRange * (2.0f * (xurand() - 0.5f)), + sLFuncSlopeRange * (2.0f * (xurand() - 0.5f))); sLFuncEnd[i] = 0.25f * (xurand() - 0.5f) + (i + 1); } @@ -162,45 +170,73 @@ void zLightningInit() sLightningChangeCB.on_change = &lightningTweakChangeType; xDebugAddTweak("Lightning|\01\01Go", "Start Lightning", &sLightningStartCB, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\01\01JerkFrequency", &sLFuncJerkFreq, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\01\01ShiftSpeed", &sLFuncShift, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\01\02MinPStep", &sLFuncMinPStep, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\01\03MaxPStep", &sLFuncMaxPStep, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\01\03MinScale", &sLFuncMinScale, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\02\01MaxScale", &sLFuncMaxScale, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\02\01ScalePerLength", &sLFuncScalePerLength, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\02\02MinSpan", &sLFuncMinSpan, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\02\02SpanPerLength", &sLFuncSpanPerLength, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\02\03SlopeRange", &sLFuncSlopeRange, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Globals|\02\03UVSpeed", &sLFuncUVSpeed, -1000000000.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Time", &gLightningTweakAddInfo.time, 0.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\01Total Points", &gLightningTweakAddInfo.total_points, 2, 16, NULL, NULL, 0x2); - - xDebugAddSelectTweak("Lightning|\01Type", &gLightningTweakAddInfo.type, lightning_type_names, NULL, 4, &sLightningChangeCB, NULL, 0x2); - + xDebugAddTweak("Lightning|\01Globals|\01\01JerkFrequency", &sLFuncJerkFreq, 0.0f, 1000000000.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\01\01ShiftSpeed", &sLFuncShift, 0.0f, 1000000000.0f, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\01\02MinPStep", &sLFuncMinPStep, 0.0f, 1000000000.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\01\03MaxPStep", &sLFuncMaxPStep, 0.0f, 1000000000.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\01\03MinScale", &sLFuncMinScale, 0.0f, 1000000000.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\02\01MaxScale", &sLFuncMaxScale, 0.0f, 1000000000.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\02\01ScalePerLength", &sLFuncScalePerLength, 0.0f, + 1000000000.0f, NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\02\02MinSpan", &sLFuncMinSpan, 0.0f, 1000000000.0f, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\02\02SpanPerLength", &sLFuncSpanPerLength, 0.0f, + 1000000000.0f, NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\02\03SlopeRange", &sLFuncSlopeRange, 0.0f, 1000000000.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Globals|\02\03UVSpeed", &sLFuncUVSpeed, -1000000000.0f, + 1000000000.0f, NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\01Time", &gLightningTweakAddInfo.time, 0.0f, 1000000000.0f, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|\01Total Points", &gLightningTweakAddInfo.total_points, 2, 16, NULL, + NULL, 0x2); + + xDebugAddSelectTweak("Lightning|\01Type", &gLightningTweakAddInfo.type, lightning_type_names, + NULL, 4, &sLightningChangeCB, NULL, 0x2); + tweak_info info; lightningTweakChangeType((const tweak_info&)info); - xDebugAddFlagTweak("Lightning|\02Flag|Rot Scalar", &gLightningTweakAddInfo.flags, 0x8, NULL, NULL, 0x2); - xDebugAddFlagTweak("Lightning|\02Flag|No Fade Out", &gLightningTweakAddInfo.flags, 0x1000, NULL, NULL, 0x2); - xDebugAddFlagTweak("Lightning|\02Flag|Arc", &gLightningTweakAddInfo.flags, 0x20, NULL, NULL, 0x2); - xDebugAddFlagTweak("Lightning|\02Flag|Vertical Orientation", &gLightningTweakAddInfo.flags, 0x200, NULL, NULL, 0x2); - xDebugAddFlagTweak("Lightning|\02Flag|Taper Thickness At End", &gLightningTweakAddInfo.flags, 0x400, NULL, NULL, 0x2); - xDebugAddFlagTweak("Lightning|\02Flag|Taper Thickness At Start", &gLightningTweakAddInfo.flags, 0x800, NULL, NULL, 0x2); + xDebugAddFlagTweak("Lightning|\02Flag|Rot Scalar", &gLightningTweakAddInfo.flags, 0x8, NULL, + NULL, 0x2); + xDebugAddFlagTweak("Lightning|\02Flag|No Fade Out", &gLightningTweakAddInfo.flags, 0x1000, NULL, + NULL, 0x2); + xDebugAddFlagTweak("Lightning|\02Flag|Arc", &gLightningTweakAddInfo.flags, 0x20, NULL, NULL, + 0x2); + xDebugAddFlagTweak("Lightning|\02Flag|Vertical Orientation", &gLightningTweakAddInfo.flags, + 0x200, NULL, NULL, 0x2); + xDebugAddFlagTweak("Lightning|\02Flag|Taper Thickness At End", &gLightningTweakAddInfo.flags, + 0x400, NULL, NULL, 0x2); + xDebugAddFlagTweak("Lightning|\02Flag|Taper Thickness At Start", &gLightningTweakAddInfo.flags, + 0x800, NULL, NULL, 0x2); xDebugAddTweak("Lightning|\02Start|x", &sTweakStart.x, -50.0f, 50.0f, NULL, NULL, 0x2); xDebugAddTweak("Lightning|\02Start|y", &sTweakStart.y, -50.0f, 50.0f, NULL, NULL, 0x2); xDebugAddTweak("Lightning|\02Start|z", &sTweakStart.z, -50.0f, 50.0f, NULL, NULL, 0x2); xDebugAddTweak("Lightning|\03End|x", &sTweakEnd.x, -50.0f, 50.0f, NULL, NULL, 0x2); xDebugAddTweak("Lightning|\03End|y", &sTweakEnd.y, -50.0f, 50.0f, NULL, NULL, 0x2); xDebugAddTweak("Lightning|\03End|z", &sTweakEnd.z, -50.0f, 50.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\04Color|\01R", &gLightningTweakAddInfo.color.r, 0x0, 0xFF, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\04Color|\02G", &gLightningTweakAddInfo.color.g, 0x0, 0xFF, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\04Color|\03B", &gLightningTweakAddInfo.color.b, 0x0, 0xFF, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|\04Color|\04A", &gLightningTweakAddInfo.color.a, 0x0, 0xFF, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|Lengths|Rot Radius", &gLightningTweakAddInfo.rot_radius, -1000000000.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|Lengths|Arc Height", &gLightningTweakAddInfo.arc_height, -1000000000.0f, 1000000000.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|Lengths|Thickness", &gLightningTweakAddInfo.thickness, 0.0f, 100.0f, NULL, NULL, 0x2); - xDebugAddTweak("Lightning|Randomness|Rand Radius", &gLightningTweakAddInfo.rand_radius, 0.0f, 1000000000.0f, NULL, NULL, 0x2); + xDebugAddTweak("Lightning|\04Color|\01R", &gLightningTweakAddInfo.color.r, 0x0, 0xFF, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|\04Color|\02G", &gLightningTweakAddInfo.color.g, 0x0, 0xFF, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|\04Color|\03B", &gLightningTweakAddInfo.color.b, 0x0, 0xFF, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|\04Color|\04A", &gLightningTweakAddInfo.color.a, 0x0, 0xFF, NULL, + NULL, 0x2); + xDebugAddTweak("Lightning|Lengths|Rot Radius", &gLightningTweakAddInfo.rot_radius, + -1000000000.0f, 1000000000.0f, NULL, NULL, 0x2); + xDebugAddTweak("Lightning|Lengths|Arc Height", &gLightningTweakAddInfo.arc_height, + -1000000000.0f, 1000000000.0f, NULL, NULL, 0x2); + xDebugAddTweak("Lightning|Lengths|Thickness", &gLightningTweakAddInfo.thickness, 0.0f, 100.0f, + NULL, NULL, 0x2); + xDebugAddTweak("Lightning|Randomness|Rand Radius", &gLightningTweakAddInfo.rand_radius, 0.0f, + 1000000000.0f, NULL, NULL, 0x2); } static zLightning* FindFreeLightning() @@ -241,10 +277,10 @@ zLightning* zLightningAdd(_tagLightningAdd* add) if (new_lightning->type != LYT_TYPE_FUNC) { new_lightning->legacy.total_points = add->total_points; - new_lightning->legacy.end_points = add->end_points; + new_lightning->legacy.end_points = add->end_points; new_lightning->legacy.arc_height = add->arc_height; new_lightning->legacy.rand_radius = add->rand_radius; - + S32 zeusOnStraightPoint = TRUE; F32 currot = 0.0f; @@ -304,19 +340,18 @@ zLightning* zLightningAdd(_tagLightningAdd* add) S32 j = 0; for (i = 0; i < new_lightning->legacy.total_points; i++) { - new_lightning[i].legacy.thickness[0] = add->thickness * 0.5f; if (add->flags & 0x400) { new_lightning[i].legacy.thickness[0] *= 1.0f - pos; } - + if (add->flags & 0x800) { new_lightning[i].legacy.thickness[0] *= pos; } - + if ((add->flags & 0x400) && (add->flags & 0x800)) { new_lightning[i].legacy.thickness[0] *= 4.0f; @@ -330,7 +365,8 @@ zLightning* zLightningAdd(_tagLightningAdd* add) } else { - new_lightning[i].legacy.point[0] = add->end[i - (add->total_points - add->end_points)]; + new_lightning[i].legacy.point[0] = + add->end[i - (add->total_points - add->end_points)]; } } else @@ -372,9 +408,12 @@ zLightning* zLightningAdd(_tagLightningAdd* add) else { xVec3Copy(new_lightning[i].legacy.point, &unk_r1_20); - xVec3AddScaled(new_lightning->legacy.point, &new_lightning->legacy.arc_normal, new_lightning->legacy.zeus.normal_offset); - xVec3AddScaled(new_lightning->legacy.point, &arc_orthogonal, -new_lightning->legacy.zeus.back_offset); - xVec3AddScaled(new_lightning->legacy.point, &dir, -new_lightning->legacy.zeus.side_offset); + xVec3AddScaled(new_lightning->legacy.point, &new_lightning->legacy.arc_normal, + new_lightning->legacy.zeus.normal_offset); + xVec3AddScaled(new_lightning->legacy.point, &arc_orthogonal, + -new_lightning->legacy.zeus.back_offset); + xVec3AddScaled(new_lightning->legacy.point, &dir, + -new_lightning->legacy.zeus.side_offset); zeusOnStraightPoint = TRUE; } @@ -387,7 +426,9 @@ zLightning* zLightningAdd(_tagLightningAdd* add) F32 scalar = 4.0f * pos + pos * pos * -4.0f; if (scalar > 0.0f) { - xVec3AddScaled(&new_lightning[j].legacy.base_point[0], &new_lightning->legacy.arc_normal, scalar * new_lightning->legacy.arc_height); + xVec3AddScaled(&new_lightning[j].legacy.base_point[0], + &new_lightning->legacy.arc_normal, + scalar * new_lightning->legacy.arc_height); } } @@ -443,20 +484,18 @@ static void UpdateLightning(zLightning* l, F32 dt) if (l->type != LYT_TYPE_FUNC) { - - if (l->type == LYT_TYPE_LINE || l->type == LYT_TYPE_ZEUS) { S32 i; F32 full = l->legacy.rand_radius * dt; F32 half = 0.5f * full; - + for (i = 1; i < l->legacy.total_points - 1; i++) { l->legacy.point[i].x = (full * xurand() + -half) + l->legacy.base_point[i].x; l->legacy.point[i].y = (full * xurand() + -half) + l->legacy.base_point[i].y; l->legacy.point[i].z = (full * xurand() + -half) + l->legacy.base_point[i].z; - + if (l->flags & 0x20) { // TODO: Fix float op order and grouping @@ -470,12 +509,13 @@ static void UpdateLightning(zLightning* l, F32 dt) else if (l->type == LYT_TYPE_ROTATING) { xVec3 dir; - xVec3Sub(&dir, &l->legacy.base_point[l->legacy.total_points - 1], &l->legacy.base_point[0]); + xVec3Sub(&dir, &l->legacy.base_point[l->legacy.total_points - 1], + &l->legacy.base_point[0]); xVec3Normalize(&dir, &dir); F32 full = l->legacy.rand_radius * dt; F32 half = 0.5f * full; - + for (S32 i = 1; i < l->legacy.total_points - 1; i++) { xMat3x3 mat3; @@ -486,7 +526,7 @@ static void UpdateLightning(zLightning* l, F32 dt) F32 sc2; } - + F32 sc1; // S32 i; } @@ -497,9 +537,10 @@ static void UpdateLightning(zLightning* l, F32 dt) info.custom_flags = 0xD00; U32 rand = xrand(); - info.pos = l->legacy.point[(rand / l->legacy.total_points) * l->legacy.total_points - rand]; + info.pos = + l->legacy.point[(rand / l->legacy.total_points) * l->legacy.total_points - rand]; xrand(); - + xParEmitterEmitCustom(sSparkEmitter, dt, &info); } } @@ -572,9 +613,12 @@ void zLightningUpdate(F32 dt) picker = 0; } - xVec3Init(&sLFuncVal[picker], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f)); - xVec3Init(&sLFuncSlope[picker][0], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f)); - xVec3Init(&sLFuncSlope[picker][1], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f)); + xVec3Init(&sLFuncVal[picker], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), + 2.0f * (xurand() - 0.5f)); + xVec3Init(&sLFuncSlope[picker][0], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), + 2.0f * (xurand() - 0.5f)); + xVec3Init(&sLFuncSlope[picker][1], 2.0f * (xurand() - 0.5f), 2.0f * (xurand() - 0.5f), + 2.0f * (xurand() - 0.5f)); sLFuncEnd[picker] = 0.25f * (xurand() * 0.5f) + (picker + 1); diff --git a/src/SB/Game/zLightning.h b/src/SB/Game/zLightning.h index 224fb1160..2d8707a17 100644 --- a/src/SB/Game/zLightning.h +++ b/src/SB/Game/zLightning.h @@ -1,10 +1,11 @@ #ifndef ZLIGHTNING_H #define ZLIGHTNING_H +#include "zFX.h" + #include "xMath3.h" -#include "iColor.h" -#include "zFX.h" +#include "iColor.h" struct _tagLightningAdd { diff --git a/src/SB/Game/zMain.cpp b/src/SB/Game/zMain.cpp index 98fed79aa..f85eb1cf3 100644 --- a/src/SB/Game/zMain.cpp +++ b/src/SB/Game/zMain.cpp @@ -1,33 +1,38 @@ -#include "zEntPlayer.h" -#include "zGlobals.h" #include "zMain.h" -#include -#include - -#include "iSystem.h" -#include "xMemMgr.h" -#include "zVar.h" #include "zAssetTypes.h" -#include "xTRC.h" -#include "iTime.h" -#include "zDispatcher.h" -#include "xserializer.h" -#include "xScrFX.h" -#include "xFX.h" -#include "xParMgr.h" -#include "zParCmd.h" -#include "zCameraTweak.h" -#include "zShrapnel.h" -#include "zNPCMgr.h" -#include "xCamera.h" #include "zCamera.h" +#include "zCameraTweak.h" #include "zCutsceneMgr.h" +#include "zDispatcher.h" +#include "zEntPickup.h" +#include "zEntPlayer.h" #include "zEntPlayerBungeeState.h" #include "zEntPlayerOOBState.h" +#include "zGlobals.h" #include "zMenu.h" -#include "iTime.h" +#include "zNPCMgr.h" +#include "zParCmd.h" +#include "zShrapnel.h" +#include "zVar.h" + +#include "xCamera.h" +#include "xDebug.h" +#include "xFX.h" +#include "xMemMgr.h" +#include "xParMgr.h" +#include "xScrFX.h" +#include "xTRC.h" +#include "xserializer.h" #include "xstransvc.h" +#include "xutil.h" + +#include "iSystem.h" +#include "iTime.h" + +#include +#include +#include zGlobals globals; xGlobals* xglobals; diff --git a/src/SB/Game/zMain.h b/src/SB/Game/zMain.h index f47820442..14c699cd5 100644 --- a/src/SB/Game/zMain.h +++ b/src/SB/Game/zMain.h @@ -1,9 +1,9 @@ #ifndef ZMAIN_H #define ZMAIN_H -#include #include "xIni.h" -#include "xserializer.h" + +#include enum eStartupErrors { @@ -28,4 +28,4 @@ static void zMainReadINI(); void zMainFirstScreen(int); static void zMainLoadFontHIP(); -#endif \ No newline at end of file +#endif diff --git a/src/SB/Game/zMenu.cpp b/src/SB/Game/zMenu.cpp index 13983de96..44f7c8482 100644 --- a/src/SB/Game/zMenu.cpp +++ b/src/SB/Game/zMenu.cpp @@ -1,33 +1,33 @@ #include "zMenu.h" -#include - -#include "iColor.h" -#include "iSystem.h" -#include "iTime.h" -#include "iTRC.h" +#include "zCamera.h" +#include "zFMV.h" +#include "zGame.h" +#include "zGameExtras.h" +#include "zGameState.h" +#include "zGlobals.h" +#include "zMusic.h" +#include "zSaveLoad.h" #include "xCutscene.h" #include "xDebug.h" #include "xEvent.h" #include "xMath.h" #include "xPad.h" -#include "xsavegame.h" -#include "xScrFx.h" #include "xSFX.h" -#include "xSnd.h" +#include "xScrFx.h" #include "xSkyDome.h" +#include "xSnd.h" #include "xString.h" #include "xTRC.h" +#include "xsavegame.h" -#include "zCamera.h" -#include "zFMV.h" -#include "zGame.h" -#include "zGameExtras.h" -#include "zGameState.h" -#include "zGlobals.h" -#include "zMusic.h" -#include "zSaveLoad.h" +#include "iColor.h" +#include "iSystem.h" +#include "iTRC.h" +#include "iTime.h" + +#include bool menu_fmv_played; diff --git a/src/SB/Game/zMovePoint.cpp b/src/SB/Game/zMovePoint.cpp index 6bd002c13..2842cb7a8 100644 --- a/src/SB/Game/zMovePoint.cpp +++ b/src/SB/Game/zMovePoint.cpp @@ -1,4 +1,5 @@ #include "zMovePoint.h" + #include "zNPCSupplement.h" #include "xEvent.h" diff --git a/src/SB/Game/zMovePoint.h b/src/SB/Game/zMovePoint.h index 388ec8559..85b646f40 100644 --- a/src/SB/Game/zMovePoint.h +++ b/src/SB/Game/zMovePoint.h @@ -1,10 +1,10 @@ #ifndef ZMOVEPOINT_H #define ZMOVEPOINT_H -#include "xMovePoint.h" - #include "zScene.h" +#include "xMovePoint.h" + #include struct zMovePoint : xMovePoint diff --git a/src/SB/Game/zMusic.cpp b/src/SB/Game/zMusic.cpp index 3f6e49952..c3add3eee 100644 --- a/src/SB/Game/zMusic.cpp +++ b/src/SB/Game/zMusic.cpp @@ -1,12 +1,15 @@ -#include #include "zMusic.h" -#include "xSnd.h" -#include "xMath.h" -#include "xString.h" -#include "zGlobals.h" + #include "zGameState.h" +#include "zGlobals.h" #include "zScene.h" + +#include "xMath.h" +#include "xSnd.h" +#include "xString.h" + #include +#include #define TRACK_COUNT 2 diff --git a/src/SB/Game/zMusic.h b/src/SB/Game/zMusic.h index fd3790cc7..def3420f5 100644 --- a/src/SB/Game/zMusic.h +++ b/src/SB/Game/zMusic.h @@ -1,9 +1,10 @@ #ifndef ZMUSIC_H #define ZMUSIC_H -#include #include "xBase.h" +#include + struct zMusicSituation { S32 track; diff --git a/src/SB/Game/zNPCFXCinematic.cpp b/src/SB/Game/zNPCFXCinematic.cpp index aafd8353d..651ae88fb 100644 --- a/src/SB/Game/zNPCFXCinematic.cpp +++ b/src/SB/Game/zNPCFXCinematic.cpp @@ -1,11 +1,12 @@ -#include "xVec3.h" -#include "xMath3.h" -#include "xParEmitter.h" - #include "zNPCFXCinematic.h" -#include "zParPTank.h" + #include "zNPCTypeBossSB2.h" +#include "zParPTank.h" + +#include "xMath3.h" +#include "xParEmitter.h" +#include #include // TODO: NEEDS REWRITEN / CORRECTED @@ -449,7 +450,8 @@ void zNPCFXShutdown() { } -void NCINBeNosey::Init(const zCutsceneMgr* m, NCINEntry* e, S32 i) // TODO: investigate missing member +void NCINBeNosey::Init(const zCutsceneMgr* m, NCINEntry* e, + S32 i) // TODO: investigate missing member { this->use_fxtab = e; this->use_csnmgr = m; @@ -728,7 +730,8 @@ void NCIN_BombTrail_Upd(const zCutsceneMgr* mgr, NCINEntry* e, S32 i) } } -void NCIN_BombTrail_AR(const zCutsceneMgr* mgr, NCINEntry* e, RpAtomic* a, RwMatrixTag* t, U32 i1, U32 i2) +void NCIN_BombTrail_AR(const zCutsceneMgr* mgr, NCINEntry* e, RpAtomic* a, RwMatrixTag* t, U32 i1, + U32 i2) { if (i1 == 0x4) { @@ -744,7 +747,8 @@ void NCIN_BoneTrail_Upd(const zCutsceneMgr* mgr, NCINEntry* e, S32 i) } } -void NCIN_BoneTrail_AR(const zCutsceneMgr* mgr, NCINEntry* e, RpAtomic* a, RwMatrixTag* t, U32 i1, U32 i2) +void NCIN_BoneTrail_AR(const zCutsceneMgr* mgr, NCINEntry* e, RpAtomic* a, RwMatrixTag* t, U32 i1, + U32 i2) { if (i1 == 0x7) { diff --git a/src/SB/Game/zNPCFXCinematic.h b/src/SB/Game/zNPCFXCinematic.h index 52213c688..db44f8a7b 100644 --- a/src/SB/Game/zNPCFXCinematic.h +++ b/src/SB/Game/zNPCFXCinematic.h @@ -1,15 +1,17 @@ #ifndef ZNPCFXCINEMATIC_H #define ZNPCFXCINEMATIC_H -#include #include "zCutsceneMgr.h" -#include "zNPCSupplement.h" -#include "xVec3.h" #include "zLightning.h" #include "zNPCHazard.h" +#include "zNPCSupplement.h" #include "zParEmitter.h" #include "zShrapnel.h" + +#include "xVec3.h" + #include "rwcore.h" +#include void zNPCFXStartup(); void zNPCFXShutdown(); diff --git a/src/SB/Game/zNPCGlyph.cpp b/src/SB/Game/zNPCGlyph.cpp index 726855a4d..2e24fe714 100644 --- a/src/SB/Game/zNPCGlyph.cpp +++ b/src/SB/Game/zNPCGlyph.cpp @@ -1,10 +1,12 @@ #include "zNPCGlyph.h" -#include "zNPCSupport.h" + #include "zGlobals.h" +#include "zNPCSupport.h" #include "zRenderState.h" + #include "xMath.h" -#include "xMathInlines.h" #include "xMath3.h" +#include "xMathInlines.h" #include "xstransvc.h" #include diff --git a/src/SB/Game/zNPCGoalAmbient.cpp b/src/SB/Game/zNPCGoalAmbient.cpp index be4f30b7d..335b7567b 100644 --- a/src/SB/Game/zNPCGoalAmbient.cpp +++ b/src/SB/Game/zNPCGoalAmbient.cpp @@ -1,13 +1,16 @@ -#include +#include "zNPCGoalAmbient.h" + +#include "zGlobals.h" +#include "zNPCSndTable.h" +#include "zNPCSupplement.h" #include "xMath.h" #include "xMath3.h" -#include "xVec3.h" -#include "zNPCGoalAmbient.h" -#include "zNPCSndTable.h" #include "xMathInlines.h" -#include "zNPCSupplement.h" -#include "zGlobals.h" +#include "xVec3.h" + +#include +#include S32 zNPCGoalJellyBumped::Enter(F32 dt, void* updCtxt) { diff --git a/src/SB/Game/zNPCGoalAmbient.h b/src/SB/Game/zNPCGoalAmbient.h index 937c26be3..ed8e98b3c 100644 --- a/src/SB/Game/zNPCGoalAmbient.h +++ b/src/SB/Game/zNPCGoalAmbient.h @@ -1,13 +1,12 @@ #ifndef ZNPCGOALAMBIENT_H #define ZNPCGOALAMBIENT_H -#include "zNPCGoalAmbient.h" +#include "zLightning.h" #include "zNPCGoalCommon.h" #include "zNPCGoalStd.h" #include "zNPCSndTable.h" -#include "zNPCTypeAmbient.h" #include "zNPCSupport.h" -#include "zLightning.h" +#include "zNPCTypeAmbient.h" xFactoryInst* GOALCreate_Ambient(S32 who, RyzMemGrow* grow, void*); diff --git a/src/SB/Game/zNPCGoalBoss.cpp b/src/SB/Game/zNPCGoalBoss.cpp index 3aba06c7a..82e6501ac 100644 --- a/src/SB/Game/zNPCGoalBoss.cpp +++ b/src/SB/Game/zNPCGoalBoss.cpp @@ -1,9 +1,9 @@ #include "zNPCGoalBoss.h" #include "zNPCGoals.h" -#include "zNPCTypeBossSandy.h" -#include "zNPCTypeBossSB1.h" #include "zNPCTypeBossPatrick.h" +#include "zNPCTypeBossSB1.h" +#include "zNPCTypeBossSandy.h" xFactoryInst* GOALCreate_Boss(S32 who, RyzMemGrow* grow, void*) { diff --git a/src/SB/Game/zNPCGoalCommon.h b/src/SB/Game/zNPCGoalCommon.h index 2e760b47a..334c9a71f 100644 --- a/src/SB/Game/zNPCGoalCommon.h +++ b/src/SB/Game/zNPCGoalCommon.h @@ -1,11 +1,12 @@ #ifndef ZNPCGOALCOMMON_H #define ZNPCGOALCOMMON_H +#include "zNPCTypeCommon.h" + #include "xBehaveMgr.h" #include "xDynAsset.h" #include "xEnt.h" #include "xNPCBasic.h" -#include "zNPCTypeCommon.h" struct zNPCGoalCommon : xGoal { diff --git a/src/SB/Game/zNPCGoalDuplotron.cpp b/src/SB/Game/zNPCGoalDuplotron.cpp index b1b8e04ff..0c7d740d5 100644 --- a/src/SB/Game/zNPCGoalDuplotron.cpp +++ b/src/SB/Game/zNPCGoalDuplotron.cpp @@ -1,12 +1,12 @@ #include "zNPCGoalDuplotron.h" +#include "zGlobals.h" #include "zNPCGoals.h" #include "zNPCTypeDuplotron.h" -#include "zGlobals.h" +#include "xEvent.h" #include "xMath.h" #include "xMathInlines.h" -#include "xEvent.h" #include "xScrFx.h" xFactoryInst* GOALCreate_Duplotron(S32 who, RyzMemGrow* grow, void*) diff --git a/src/SB/Game/zNPCGoalRobo.cpp b/src/SB/Game/zNPCGoalRobo.cpp index 64fa3c23b..bc1507081 100644 --- a/src/SB/Game/zNPCGoalRobo.cpp +++ b/src/SB/Game/zNPCGoalRobo.cpp @@ -1,27 +1,31 @@ +#include "zNPCGoalRobo.h" + +#include "zGameExtras.h" +#include "zGlobals.h" +#include "zNPCGoalCommon.h" +#include "zNPCGoalStd.h" +#include "zNPCGoals.h" +#include "zNPCHazard.h" +#include "zNPCSndLists.h" +#include "zNPCSupplement.h" +#include "zNPCSupport.h" +#include "zNPCTypeCommon.h" +#include "zNPCTypeRobot.h" + #include "xColor.h" #include "xCounter.h" #include "xDraw.h" #include "xEnt.h" #include "xFX.h" -#include "xModel.h" -#include "xScrFx.h" -#include "xVec3.h" #include "xMath.h" #include "xMath3.h" #include "xMathInlines.h" -#include "zNPCGoalRobo.h" -#include "zNPCGoals.h" -#include "zNPCGoalStd.h" -#include "zNPCHazard.h" -#include "zNPCSndLists.h" -#include "zNPCSupport.h" -#include "zNPCTypeCommon.h" -#include "zNPCTypeRobot.h" -#include "zGlobals.h" -#include "zNPCGoalCommon.h" -#include "zGameExtras.h" -#include "zNPCSupplement.h" +#include "xModel.h" +#include "xScrFx.h" +#include "xVec3.h" + #include +#include enum en_copcntr { diff --git a/src/SB/Game/zNPCGoalScript.cpp b/src/SB/Game/zNPCGoalScript.cpp index 62e4adb60..ecdf436b3 100644 --- a/src/SB/Game/zNPCGoalScript.cpp +++ b/src/SB/Game/zNPCGoalScript.cpp @@ -1,7 +1,7 @@ #include "zNPCGoalScript.h" -#include "zNPCGoals.h" #include "zNPCGoalStd.h" +#include "zNPCGoals.h" #include "xEvent.h" @@ -71,7 +71,7 @@ S32 zNPCGoalScript::Exit(F32 dt, void* updCtxt) } S32 zNPCGoalScript::SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget, S32* handled) + xBase* toParamWidget, S32* handled) { return xGoal::SysEvent(from, to, toEvent, toParam, toParamWidget, handled); } diff --git a/src/SB/Game/zNPCGoalScript.h b/src/SB/Game/zNPCGoalScript.h index 36a86f4a5..2b869dead 100644 --- a/src/SB/Game/zNPCGoalScript.h +++ b/src/SB/Game/zNPCGoalScript.h @@ -15,7 +15,7 @@ struct zNPCGoalScript : zNPCGoalCommon virtual S32 Enter(F32 dt, void* updCtxt); virtual S32 Exit(F32 dt, void* updCtxt); virtual S32 SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget, S32* handled); + xBase* toParamWidget, S32* handled); virtual S32 NPCMessage(NPCMsg* mail); }; diff --git a/src/SB/Game/zNPCGoalStd.cpp b/src/SB/Game/zNPCGoalStd.cpp index ffa4fcd16..65ef7593c 100644 --- a/src/SB/Game/zNPCGoalStd.cpp +++ b/src/SB/Game/zNPCGoalStd.cpp @@ -1,10 +1,12 @@ -#include "xMath.h" -#include "xMathInlines.h" -#include "zGlobals.h" #include "zNPCGoalStd.h" + +#include "zGlobals.h" #include "zNPCGoals.h" #include "zNPCSupport.h" +#include "xMath.h" +#include "xMathInlines.h" + #include xFactoryInst* GOALCreate_Standard(S32 who, RyzMemGrow* grow, void*) diff --git a/src/SB/Game/zNPCGoalTiki.cpp b/src/SB/Game/zNPCGoalTiki.cpp index e8d17eab4..fe22cb90c 100644 --- a/src/SB/Game/zNPCGoalTiki.cpp +++ b/src/SB/Game/zNPCGoalTiki.cpp @@ -2,10 +2,10 @@ #include "zNPCGoals.h" #include "zNPCTypeTiki.h" +#include "zNPCTypes.h" #include "zRumble.h" #include "xEvent.h" -#include "zNPCTypes.h" xFactoryInst* GOALCreate_Tiki(S32 who, RyzMemGrow* grow, void*) { diff --git a/src/SB/Game/zNPCGoalVillager.cpp b/src/SB/Game/zNPCGoalVillager.cpp index 71c07c331..8aa42afcd 100644 --- a/src/SB/Game/zNPCGoalVillager.cpp +++ b/src/SB/Game/zNPCGoalVillager.cpp @@ -1,19 +1,22 @@ -#include +#include "zNPCGoalVillager.h" -#include "xJaw.h" -#include "xMath.h" -#include "xMathInlines.h" -#include "xutil.h" #include "zEntPickup.h" #include "zGameExtras.h" #include "zGlobals.h" -#include "zNPCGoalVillager.h" -#include "zNPCTypeVillager.h" -#include "zNPCGoals.h" #include "zGoo.h" +#include "zNPCGoals.h" +#include "zNPCTypeVillager.h" #include "zSurface.h" + +#include "xJaw.h" +#include "xMath.h" +#include "xMathInlines.h" +#include "xutil.h" + #include "iMath.h" +#include + xFactoryInst* GOALCreate_Villager(S32 who, RyzMemGrow* grow, void*) { xGoal* goal = NULL; diff --git a/src/SB/Game/zNPCGoalVillager.h b/src/SB/Game/zNPCGoalVillager.h index ed9813798..f83e37f8b 100644 --- a/src/SB/Game/zNPCGoalVillager.h +++ b/src/SB/Game/zNPCGoalVillager.h @@ -1,11 +1,12 @@ #ifndef ZNPCGOALVILLAGER_H #define ZNPCGOALVILLAGER_H -#include "xSFX.h" #include "zNPCGlyph.h" #include "zNPCGoalCommon.h" #include "zNPCGoalStd.h" +#include "xSFX.h" + struct zNPCGoalCheer : zNPCGoalLoopAnim { zNPCGoalCheer(S32 goalID) : zNPCGoalLoopAnim(goalID) diff --git a/src/SB/Game/zNPCGoals.cpp b/src/SB/Game/zNPCGoals.cpp index 5c19fb03b..30bc2f818 100644 --- a/src/SB/Game/zNPCGoals.cpp +++ b/src/SB/Game/zNPCGoals.cpp @@ -1,17 +1,17 @@ #include "zNPCGoals.h" -#include "zNPCGoalStd.h" -#include "zNPCGoalScript.h" -#include "zNPCGoalVillager.h" -#include "zNPCGoalRobo.h" -#include "zNPCGoalTiki.h" -#include "zNPCGoalDuplotron.h" #include "zNPCGoalAmbient.h" -#include "zNPCGoalSubBoss.h" -#include "zNPCTypeDutchman.h" #include "zNPCGoalBoss.h" -#include "zNPCTypeBossSB2.h" +#include "zNPCGoalDuplotron.h" +#include "zNPCGoalRobo.h" +#include "zNPCGoalScript.h" +#include "zNPCGoalStd.h" +#include "zNPCGoalSubBoss.h" +#include "zNPCGoalTiki.h" +#include "zNPCGoalVillager.h" #include "zNPCTypeBossPlankton.h" +#include "zNPCTypeBossSB2.h" +#include "zNPCTypeDutchman.h" void zNPCGoals_RegisterTypes(xFactory* fac) { diff --git a/src/SB/Game/zNPCHazard.cpp b/src/SB/Game/zNPCHazard.cpp index c6674836f..ef0667785 100644 --- a/src/SB/Game/zNPCHazard.cpp +++ b/src/SB/Game/zNPCHazard.cpp @@ -1,17 +1,18 @@ #include "zNPCHazard.h" -#include -#include - #include "zGlobals.h" -#include "zNPCTypeCommon.h" -#include "zNPCTypes.h" #include "zNPCSupplement.h" #include "zNPCSupport.h" +#include "zNPCTypeCommon.h" +#include "zNPCTypes.h" + #include "xMath.h" #include "xMathInlines.h" #include "xUtil.h" +#include +#include + extern U32 g_hash_hazanim[3]; extern char* g_strz_hazanim[3]; extern UVAModelInfo g_haz_uvAnimInfo[30]; diff --git a/src/SB/Game/zNPCHazard.h b/src/SB/Game/zNPCHazard.h index 10867353f..6cfee5c7d 100644 --- a/src/SB/Game/zNPCHazard.h +++ b/src/SB/Game/zNPCHazard.h @@ -3,12 +3,12 @@ #include "zLightning.h" -#include "xMath3.h" #include "xCollide.h" +#include "xMath3.h" #include "xShadow.h" -#include #include +#include struct UVAModelInfo { @@ -159,7 +159,8 @@ enum en_haznote HAZ_NOTE_FORCE = 0x7fffffff }; -enum en_hazmodel { +enum en_hazmodel +{ NPC_HAZMDL_BOOMBALL_BUBBLE, NPC_HAZMDL_BOOMBALL_SMOKE, NPC_HAZMDL_FODBOMB, diff --git a/src/SB/Game/zNPCMessenger.cpp b/src/SB/Game/zNPCMessenger.cpp index b15eded36..2cc6a523e 100644 --- a/src/SB/Game/zNPCMessenger.cpp +++ b/src/SB/Game/zNPCMessenger.cpp @@ -1,14 +1,17 @@ #include "zNPCMessenger.h" -#include "math.h" -#include "xEnt.h" -#include "xordarray.h" -#include "xMathInlines.h" #include "zGlobals.h" #include "zNPCMgr.h" #include "zNPCTypeCommon.h" #include "zNPCTypeRobot.h" #include "zNPCTypes.h" + +#include "xEnt.h" +#include "xMathInlines.h" +#include "xordarray.h" + +#include "math.h" +#include #include static NPCPSData g_postoffice = {}; diff --git a/src/SB/Game/zNPCMessenger.h b/src/SB/Game/zNPCMessenger.h index 065e2be1f..c569674e0 100644 --- a/src/SB/Game/zNPCMessenger.h +++ b/src/SB/Game/zNPCMessenger.h @@ -1,12 +1,14 @@ #ifndef ZNPCMESSENGER_H #define ZNPCMESSENGER_H -#include -#include "xBase.h" -#include "xVec3.h" #include "zMovePoint.h" #include "zNPCTypes.h" +#include "xBase.h" +#include "xVec3.h" + +#include + struct zNPCCommon; enum en_NPC_MSG_ID diff --git a/src/SB/Game/zNPCMgr.cpp b/src/SB/Game/zNPCMgr.cpp index 28d66922b..466d31995 100644 --- a/src/SB/Game/zNPCMgr.cpp +++ b/src/SB/Game/zNPCMgr.cpp @@ -1,22 +1,23 @@ #include "zNPCMgr.h" -#include "xLightKit.h" -#include "xRMemData.h" + +#include "zGlobals.h" +#include "zNPCGoals.h" +#include "zNPCMessenger.h" +#include "zNPCSpawner.h" +#include "zNPCTypeBoss.h" #include "zNPCTypeCommon.h" +#include "zNPCTypeDuplotron.h" #include "zNPCTypeRobot.h" -#include "zNPCTypeVillager.h" #include "zNPCTypeSubBoss.h" -#include "zNPCTypeBoss.h" -#include "zNPCTypeDuplotron.h" -#include "zNPCTypes.h" -#include "zNPCSpawner.h" -#include "zNPCMessenger.h" -#include "zNPCGoals.h" #include "zNPCTypeTiki.h" -#include "zGlobals.h" -#include "xFactory.h" +#include "zNPCTypeVillager.h" +#include "zNPCTypes.h" #include "zRenderState.h" #include "xBehaveMgr.h" +#include "xFactory.h" +#include "xLightKit.h" +#include "xRMemData.h" #include "xstransvc.h" #include @@ -26,6 +27,7 @@ static zNPCMgr* g_npcmgr; static S32 g_firstFrameUpdateAllNPC; +// clang-format off struct NPCBrainTableEntry { char* name; @@ -355,6 +357,7 @@ static struct NPCMTypeTable { NPC_TYPE_FISH_MALE, "fish_j_snow_bind03", 0 }, { NPC_TYPE_FISH, "fish_h_fried_bind", 0 } }; +// clang-format on zNPCMgr* zNPCMgrSelf() { @@ -729,4 +732,4 @@ S32 zNPCMgr_OrdComp_npcid(void* vkey, void* vitem) } return rc; -} \ No newline at end of file +} diff --git a/src/SB/Game/zNPCMgr.h b/src/SB/Game/zNPCMgr.h index ccc5f9f7d..937312f47 100644 --- a/src/SB/Game/zNPCMgr.h +++ b/src/SB/Game/zNPCMgr.h @@ -1,10 +1,11 @@ #ifndef ZNPCMGR_H #define ZNPCMGR_H -#include "xFactory.h" -#include "xBehaveMgr.h" #include "zNPCTypes.h" +#include "xBehaveMgr.h" +#include "xFactory.h" + #include struct zNPCMgr : RyzMemData diff --git a/src/SB/Game/zNPCSndTable.cpp b/src/SB/Game/zNPCSndTable.cpp index e191e15b3..6ddda67c9 100644 --- a/src/SB/Game/zNPCSndTable.cpp +++ b/src/SB/Game/zNPCSndTable.cpp @@ -1,11 +1,13 @@ #include "zNPCSndTable.h" -#include "iSnd.h" -#include "xString.h" -#include "xutil.h" #include "zGameExtras.h" #include "zNPCSndLists.h" +#include "xString.h" +#include "xutil.h" + +#include "iSnd.h" + #define SND_COUNT 26 static U32 g_hash_sndgroup[SND_COUNT]; diff --git a/src/SB/Game/zNPCSpawner.cpp b/src/SB/Game/zNPCSpawner.cpp index 22c013204..824e52151 100644 --- a/src/SB/Game/zNPCSpawner.cpp +++ b/src/SB/Game/zNPCSpawner.cpp @@ -1,15 +1,17 @@ #include "zNPCSpawner.h" -#include - #include "zEvent.h" -#include "xDraw.h" -#include "zNPCSupport.h" #include "zGlobals.h" -#include "xMathInlines.h" +#include "zNPCSupport.h" #include "zNPCTypeRobot.h" + +#include "xDraw.h" +#include "xMathInlines.h" #include "xUtil.h" +#include +#include + static SMDepot g_smdepot = {}; static S32 g_drawSpawnBounds; diff --git a/src/SB/Game/zNPCSpawner.h b/src/SB/Game/zNPCSpawner.h index 6eb318af1..e3f9379ac 100644 --- a/src/SB/Game/zNPCSpawner.h +++ b/src/SB/Game/zNPCSpawner.h @@ -2,13 +2,12 @@ #define ZNPCSPAWNER_H #include "zMovePoint.h" +#include "zNPCTypeCommon.h" #include "xRMemData.h" #include "xordarray.h" #include "xutil.h" -#include "zNPCTypeCommon.h" - enum en_SM_WAVE_MODE { SM_WAVE_CONTINUOUS, diff --git a/src/SB/Game/zNPCSupplement.cpp b/src/SB/Game/zNPCSupplement.cpp index 9a05455c8..f6a977ebd 100644 --- a/src/SB/Game/zNPCSupplement.cpp +++ b/src/SB/Game/zNPCSupplement.cpp @@ -1,21 +1,25 @@ #include "zNPCSupplement.h" -#include "zNPCSupport.h" -#include "zNPCTypeRobot.h" + #include "zGame.h" #include "zGameExtras.h" #include "zGlobals.h" -#include "xCutsceneMgr.h" +#include "zNPCSupport.h" +#include "zNPCTypeRobot.h" +#include "xCutsceneMgr.h" #include "xFX.h" #include "xMath.h" + #include "iMath.h" -#include #include +#include + static xShadowCache g_shadCaches[16]; static NPARMgmt g_npar_mgmt[12]; +// clang-format off static NPARInfo g_npar_info[12] = { {}, { @@ -55,9 +59,9 @@ static NPARInfo g_npar_info[12] = { static const NPARParmOilBub g_parm_oilbub[4] = { { - 1.2f, - {255, 255, 255, 160}, - {0.0f, 2.0f, 0.0f}, + 1.2f, + {255, 255, 255, 160}, + {0.0f, 2.0f, 0.0f}, {0.1f, 0.4f} }, { @@ -330,6 +334,7 @@ static const NPARParmFahrwerkz g_parm_fahrwerkz[4] = { 80 }, }; +// clang-format on extern S32 g_gameExtrasFlags; extern S32 g_mon; // month @@ -740,7 +745,8 @@ void NPARMgmt::UserDataSet(void** param_1) user_data = param_1; } -void NPARParmVisSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmVisSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = xurand() * 0.5f + 0.5f; F32 samecalc = tym_lifespan * fac_rand; @@ -766,7 +772,8 @@ void NPARParmVisSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* par->nparmode = pmod; } -void NPARParmDogBreath::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmDogBreath::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = xurand() * 0.5f + 0.5f; F32 samecalc = tym_lifespan * fac_rand; @@ -793,8 +800,8 @@ void NPARParmDogBreath::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* void NPAR_EmitFireworks(en_nparmode pmod, const xVec3* pos, const xVec3* vel) { - NPARData *pNVar1; - NPARMgmt *mgmt = NPAR_FindParty(NPAR_TYP_FIREWORKS); + NPARData* pNVar1; + NPARMgmt* mgmt = NPAR_FindParty(NPAR_TYP_FIREWORKS); if ((mgmt != NULL) && (pNVar1 = mgmt->NextAvail(), pNVar1 != NULL)) { g_parm_fahrwerkz[pmod].ConfigPar(pNVar1, pmod, pos, vel); @@ -806,7 +813,6 @@ void NPAR_EmitFWExhaust(const xVec3* pos, const xVec3* vel) NPAR_EmitFireworks(NPAR_MODE_FWEXHAUST, pos, vel); } - void NPAR_EmitVisSplash(en_nparmode pmod, const xVec3* vel, const xVec3* pos) { NPARData* par; @@ -817,7 +823,6 @@ void NPAR_EmitVisSplash(en_nparmode pmod, const xVec3* vel, const xVec3* pos) } } - void NPAR_EmitOilBubble(en_nparmode pmod, const xVec3* pos, const xVec3* vel) { NPARData* par; @@ -828,7 +833,6 @@ void NPAR_EmitOilBubble(en_nparmode pmod, const xVec3* pos, const xVec3* vel) } } - // Equivalent: weird unnecessary use of mulli to index into g_parm_tubespiral. void NPAR_EmitTubeSpiral(const xVec3* pos, const xVec3* vel, F32 dt) { @@ -840,7 +844,6 @@ void NPAR_EmitTubeSpiral(const xVec3* pos, const xVec3* vel, F32 dt) } } - void NPAR_EmitTubeConfetti(const xVec3* pos, const xVec3* vel) { NPARData* par; @@ -862,24 +865,25 @@ void NPAR_EmitTubeSparklies(const xVec3* pos, const xVec3* vel) } // Equivalent: operands of single fmuls instruction swapped. -void NPARParmTubeConfetti::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmTubeConfetti::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = 0.5f * xurand() + 0.5f; par->fac_abuse = fac_rand; par->tmr_remain = tym_lifespan * fac_rand; - par->tym_exist = tym_lifespan * fac_rand; + par->tym_exist = tym_lifespan * fac_rand; par->pos = *pos; par->vel = *vel; par->xy_size[0] = siz_base[0]; par->xy_size[1] = siz_base[0]; par->color = colr_base; - + if (pmod == 0) { - par->color.red = xurand() * 95.0f + 160.0f; + par->color.red = xurand() * 95.0f + 160.0f; par->color.green = xurand() * 95.0f + 160.0f; - par->color.blue = xurand() * 95.0f + 160.0f; + par->color.blue = xurand() * 95.0f + 160.0f; par->color.alpha = colr_base.alpha; par->flg_popts |= 4; @@ -896,7 +900,7 @@ void NPARParmTubeConfetti::ConfigPar(NPARData* par, en_nparmode pmod, const xVec if (pmod == 0) { - F32 samecalc = 2.0f * (justTheRand - 0.5f ); + F32 samecalc = 2.0f * (justTheRand - 0.5f); par->uv_tl[0] = ((int)(samecalc * num_uvcell[1])) * du; // Multiplication operands swapped par->uv_tl[1] = (row_uvstart + (int)(samecalc * num_uvcell[0])) * dv; par->uv_br[0] = par->uv_tl[0] + du; @@ -918,19 +922,20 @@ void NPARParmTubeConfetti::ConfigPar(NPARData* par, en_nparmode pmod, const xVec } // Equivalent: operands of single fmuls instruction swapped. -void NPARParmFahrwerkz::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmFahrwerkz::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = 0.5f * xurand() + 0.5f; - + par->fac_abuse = fac_rand; par->tmr_remain = tym_lifespan * fac_rand; - par->tym_exist = tym_lifespan * fac_rand; + par->tym_exist = tym_lifespan * fac_rand; par->pos = *pos; par->vel = *vel; par->xy_size[0] = siz_base[0]; par->xy_size[1] = siz_base[0]; par->color = colr_base; - + F32 justTheRand = fac_rand; F32 du = 1.0f / num_uvcell[0]; @@ -938,7 +943,7 @@ void NPARParmFahrwerkz::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* if (pmod == 0) { - F32 samecalc = 2.0f * (justTheRand - 0.5f ); + F32 samecalc = 2.0f * (justTheRand - 0.5f); par->uv_tl[0] = ((int)(samecalc * num_uvcell[1])) * du; // Multiplication operands swapped par->uv_tl[1] = (row_uvstart + (int)(samecalc * num_uvcell[0])) * dv; par->uv_br[0] = par->uv_tl[0] + du; @@ -960,13 +965,14 @@ void NPARParmFahrwerkz::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* } // Equivalent: operands of single fmuls instruction swapped. -void NPARParmTarTarGunk::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmTarTarGunk::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = 0.5f * xurand() + 0.5f; par->fac_abuse = fac_rand; par->tmr_remain = tym_lifespan * fac_rand; - par->tym_exist = tym_lifespan * fac_rand; + par->tym_exist = tym_lifespan * fac_rand; par->pos = *pos; par->vel = *vel; par->xy_size[0] = siz_base[0]; @@ -980,7 +986,7 @@ void NPARParmTarTarGunk::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* if (pmod == 0) { - F32 samecalc = 2.0f * (justTheRand - 0.5f ); + F32 samecalc = 2.0f * (justTheRand - 0.5f); par->uv_tl[0] = ((int)(samecalc * num_uvcell[1])) * du; // Multiplication operands swapped par->uv_tl[1] = (row_uvstart + (int)(samecalc * num_uvcell[0])) * dv; par->uv_br[0] = par->uv_tl[0] + du; @@ -1002,13 +1008,14 @@ void NPARParmTarTarGunk::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* } // Equivalent: operands of single fmuls instruction swapped. -void NPARParmSleepyZeez::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmSleepyZeez::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = 0.5f * xurand() + 0.5f; par->fac_abuse = fac_rand; par->tmr_remain = tym_lifespan * fac_rand; - par->tym_exist = tym_lifespan * fac_rand; + par->tym_exist = tym_lifespan * fac_rand; par->pos = *pos; par->vel = *vel; par->xy_size[0] = siz_base[0]; @@ -1022,7 +1029,7 @@ void NPARParmSleepyZeez::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* if (pmod == 0) { - F32 samecalc = 2.0f * (justTheRand - 0.5f ); + F32 samecalc = 2.0f * (justTheRand - 0.5f); par->uv_tl[0] = ((int)(samecalc * num_uvcell[1])) * du; // Multiplication operands swapped par->uv_tl[1] = (row_uvstart + (int)(samecalc * num_uvcell[0])) * dv; par->uv_br[0] = par->uv_tl[0] + du; @@ -1043,7 +1050,8 @@ void NPARParmSleepyZeez::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* par->nparmode = pmod; } -void NPARParmChuckSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmChuckSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = xurand() * 0.5f + 0.5f; F32 samecalc = tym_lifespan * fac_rand; @@ -1068,7 +1076,7 @@ void NPARParmChuckSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3 par->uv_br[1] = 1.0f; par->flg_popts |= 2; } - else if ((pmod == NPAR_MODE_ALT_C) ||(pmod == NPAR_MODE_ALT_A) ||(pmod == NPAR_MODE_ALT_B)) + else if ((pmod == NPAR_MODE_ALT_C) || (pmod == NPAR_MODE_ALT_A) || (pmod == NPAR_MODE_ALT_B)) { par->uv_tl[0] = 0.0f; par->uv_tl[1] = 0.0f; @@ -1099,8 +1107,8 @@ void NPARParmChuckSplash::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3 //todo void NPAR_EmitDroplets(en_nparmode pmod, const xVec3* pos, const xVec3* vel) { - NPARData *pNVar1; - NPARMgmt *mgmt = (NPARMgmt *)NPAR_FindParty(NPAR_TYP_CHUCKSPLASH); + NPARData* pNVar1; + NPARMgmt* mgmt = (NPARMgmt*)NPAR_FindParty(NPAR_TYP_CHUCKSPLASH); if ((mgmt != NULL) && (pNVar1 = mgmt->NextAvail(), pNVar1 != NULL)) { g_parm_chucksplash[pmod].ConfigPar(pNVar1, pmod, pos, vel); @@ -1129,8 +1137,8 @@ void NPAR_EmitOilSplash(const xVec3* pos, const xVec3* vel) void NPAR_EmitTarTarGunk(en_nparmode pmod, const xVec3* pos, const xVec3* vel) { - NPARData *pNVar1; - NPARMgmt *mgmt = (NPARMgmt *)NPAR_FindParty(NPAR_TYP_TARTARGUNK); + NPARData* pNVar1; + NPARMgmt* mgmt = (NPARMgmt*)NPAR_FindParty(NPAR_TYP_TARTARGUNK); if ((mgmt != NULL) && (pNVar1 = mgmt->NextAvail(), pNVar1 != NULL)) { g_parm_tartargunk[pmod].ConfigPar(pNVar1, pmod, pos, vel); @@ -1139,8 +1147,8 @@ void NPAR_EmitTarTarGunk(en_nparmode pmod, const xVec3* pos, const xVec3* vel) void NPAR_EmitGloveDust(const xVec3* pos, const xVec3* vel) { - NPARData *pNVar1; - NPARMgmt *mgmt = (NPARMgmt *)NPAR_FindParty(NPAR_TYP_GLOVEDUST); + NPARData* pNVar1; + NPARMgmt* mgmt = (NPARMgmt*)NPAR_FindParty(NPAR_TYP_GLOVEDUST); if ((mgmt != NULL) && (pNVar1 = mgmt->NextAvail(), pNVar1 != NULL)) { g_parm_tartargunk[0].ConfigPar(pNVar1, NPAR_MODE_STD, pos, vel); @@ -1149,8 +1157,8 @@ void NPAR_EmitGloveDust(const xVec3* pos, const xVec3* vel) void NPAR_EmitSleepyZeez(const xVec3* pos, const xVec3* vel) { - NPARData *pNVar1; - NPARMgmt *mgmt = (NPARMgmt *)NPAR_FindParty(NPAR_TYP_SLEEPYZEEZ); + NPARData* pNVar1; + NPARMgmt* mgmt = (NPARMgmt*)NPAR_FindParty(NPAR_TYP_SLEEPYZEEZ); if ((mgmt != NULL) && (pNVar1 = mgmt->NextAvail(), pNVar1 != NULL)) { g_parm_tartargunk[0].ConfigPar(pNVar1, NPAR_MODE_STD, pos, vel); @@ -1189,11 +1197,11 @@ void NPAR_EmitVSSpray(const xVec3* pos, const xVec3* vel) void NPAR_EmitDoggyBreath(en_nparmode pmod, const xVec3* pos, const xVec3* vel) { - NPARData *pNVar1; - NPARMgmt *mgmt = (NPARMgmt *)NPAR_FindParty(NPAR_TYP_DOGBREATH); + NPARData* pNVar1; + NPARMgmt* mgmt = (NPARMgmt*)NPAR_FindParty(NPAR_TYP_DOGBREATH); if ((mgmt != NULL) && (pNVar1 = mgmt->NextAvail(), pNVar1 != NULL)) { - g_parm_dogbreath[pmod].ConfigPar(pNVar1,pmod,pos,vel); + g_parm_dogbreath[pmod].ConfigPar(pNVar1, pmod, pos, vel); } } @@ -1207,7 +1215,8 @@ void NPAR_EmitDoggyAttack(const xVec3* pos, const xVec3* vel) NPAR_EmitDoggyBreath(NPAR_MODE_ALT_B, pos, vel); } -void NPARParmGloveDust::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmGloveDust::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = xurand() * 0.5f + 0.5f; F32 samecalc = tym_lifespan * fac_rand; @@ -1232,7 +1241,8 @@ void NPARParmGloveDust::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* par->nparmode = pmod; } -void NPARParmTubeSpiral::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel, F32 dt) const +void NPARParmTubeSpiral::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel, F32 dt) const { par->fac_abuse = (xurand() * 0.5f + 0.5f); par->tmr_remain = dt; @@ -1260,13 +1270,14 @@ void NPAR_EmitTubeSpiralCin(const xVec3* pos, const xVec3* vel, float dt) } } -void NPARParmOilBub::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const +void NPARParmOilBub::ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, + const xVec3* vel) const { F32 fac_rand = (xurand() * 0.5f + 0.5f); F32 samecalc = tym_lifespan * fac_rand; - par->fac_abuse = fac_rand; + par->fac_abuse = fac_rand; par->tmr_remain = samecalc; - par->tym_exist = samecalc; + par->tym_exist = samecalc; par->pos = *pos; par->vel = (vel != NULL) ? *vel : g_O3; F32 uVar2 = siz_base[0]; @@ -1297,7 +1308,7 @@ void NPAR_EmitH2OSpray(const xVec3* pos, const xVec3* vel) void NPAR_EmitH2OTrail(const xVec3* pos) { - NPAR_EmitDroplets(NPAR_MODE_TRAIL, pos, (xVec3 *)&g_O3); + NPAR_EmitDroplets(NPAR_MODE_TRAIL, pos, (xVec3*)&g_O3); } static void NPCC_ShadowCacheReset() diff --git a/src/SB/Game/zNPCSupplement.h b/src/SB/Game/zNPCSupplement.h index dfeafc782..f9dea1806 100644 --- a/src/SB/Game/zNPCSupplement.h +++ b/src/SB/Game/zNPCSupplement.h @@ -1,18 +1,20 @@ #ifndef ZNPCSUPPLEMENT_H #define ZNPCSUPPLEMENT_H -#include "iColor.h" +#include "zLightning.h" +#include "zNPCTypeCommon.h" #include "xMath2.h" #include "xPtankPool.h" #include "xShadow.h" #include "xVec3.h" -#include "zNPCTypeCommon.h" -#include "zLightning.h" -#include -#include +#include "iColor.h" + #include +#include + +#include enum en_nparptyp { @@ -202,7 +204,8 @@ class NPARParmGloveDust void ConfigPar(NPARData* par, en_nparmode pmod, const xVec3* pos, const xVec3* vel) const; }; -struct NPARParmMonsoonRain { +struct NPARParmMonsoonRain +{ F32 tym_lifespan; RwRGBA colr_base; F32 siz_base[2]; diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index a78316142..41e4e88df 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -1,22 +1,24 @@ #include "zNPCSupport.h" -#include -#include -#include - #include "zGlobals.h" -#include "zNPCHazard.h" +#include "zNPCFXCinematic.h" #include "zNPCGlyph.h" -#include "zNPCSupplement.h" +#include "zNPCHazard.h" #include "zNPCMgr.h" +#include "zNPCSupplement.h" #include "zNPCTypeRobot.h" -#include "zNPCFXCinematic.h" -#include "xMathInlines.h" +#include "xCollide.h" #include "xMath3.h" -#include "xUtil.h" +#include "xMathInlines.h" #include "xQuickCull.h" -#include "xCollide.h" +#include "xUtil.h" +#include "xstransvc.h" + +#include + +#include +#include #define MAX_FIREWORK 32 diff --git a/src/SB/Game/zNPCTypeAmbient.cpp b/src/SB/Game/zNPCTypeAmbient.cpp index 0b4b5fc26..d88c5f24d 100644 --- a/src/SB/Game/zNPCTypeAmbient.cpp +++ b/src/SB/Game/zNPCTypeAmbient.cpp @@ -1,18 +1,19 @@ -#include - -#include "xVec3.h" -#include "xMath3.h" +#include "zNPCTypeAmbient.h" #include "zGlobals.h" +#include "zGrid.h" #include "zNPCGoalAmbient.h" +#include "zNPCGoals.h" #include "zNPCSndLists.h" -#include "zNPCTypeAmbient.h" #include "zNPCTypes.h" -#include -#include "macros.h" + +#include "xMath3.h" #include "xMathInlines.h" -#include "zNPCGoals.h" -#include "zGrid.h" +#include "xVec3.h" +#include "xutil.h" + +#include "macros.h" +#include U32 g_hash_ambianim[12] = { 0 }; char* g_strz_ambianim[12] = { diff --git a/src/SB/Game/zNPCTypeBoss.cpp b/src/SB/Game/zNPCTypeBoss.cpp index 48f1e41ae..c77abbe5d 100644 --- a/src/SB/Game/zNPCTypeBoss.cpp +++ b/src/SB/Game/zNPCTypeBoss.cpp @@ -1,11 +1,11 @@ #include "zNPCTypeBoss.h" -#include "zNPCTypes.h" -#include "zNPCTypeBossSandy.h" #include "zNPCTypeBossPatrick.h" +#include "zNPCTypeBossPlankton.h" #include "zNPCTypeBossSB1.h" #include "zNPCTypeBossSB2.h" -#include "zNPCTypeBossPlankton.h" +#include "zNPCTypeBossSandy.h" +#include "zNPCTypes.h" #include "xString.h" diff --git a/src/SB/Game/zNPCTypeBoss.h b/src/SB/Game/zNPCTypeBoss.h index 5839f9476..26744055d 100644 --- a/src/SB/Game/zNPCTypeBoss.h +++ b/src/SB/Game/zNPCTypeBoss.h @@ -1,8 +1,8 @@ #ifndef ZNPCTYPEBOSS_H #define ZNPCTYPEBOSS_H -#include "zNPCTypeCommon.h" #include "zNPCSupport.h" +#include "zNPCTypeCommon.h" struct zNPCBoss : zNPCCommon { diff --git a/src/SB/Game/zNPCTypeBossPatrick.cpp b/src/SB/Game/zNPCTypeBossPatrick.cpp index e31136bda..561f93e54 100644 --- a/src/SB/Game/zNPCTypeBossPatrick.cpp +++ b/src/SB/Game/zNPCTypeBossPatrick.cpp @@ -1,27 +1,28 @@ -#include -#include "string.h" +#include "zNPCTypeBossPatrick.h" -#include "iModel.h" +#include "zCamera.h" +#include "zEntDestructObj.h" +#include "zEntSimpleObj.h" +#include "zGlobals.h" +#include "zGrid.h" +#include "zLightning.h" +#include "zNPCGoals.h" +#include "zNPCTypeRobot.h" +#include "zRenderState.h" #include "xCollide.h" #include "xDebug.h" #include "xMath.h" #include "xMath3.h" -#include "xstransvc.h" +#include "xMathInlines.h" #include "xSnd.h" #include "xVec3.h" +#include "xstransvc.h" -#include "zCamera.h" -#include "zEntSimpleObj.h" -#include "zEntDestructObj.h" -#include "zGlobals.h" -#include "zGrid.h" -#include "zNPCTypeBossPatrick.h" -#include "zRenderState.h" -#include "zNPCGoals.h" -#include "zLightning.h" -#include "zNPCTypeRobot.h" -#include +#include "iModel.h" + +#include "string.h" +#include #define f831 1.0f #define f832 0.0f diff --git a/src/SB/Game/zNPCTypeBossPatrick.h b/src/SB/Game/zNPCTypeBossPatrick.h index 47cc96ed4..bfe0dde06 100644 --- a/src/SB/Game/zNPCTypeBossPatrick.h +++ b/src/SB/Game/zNPCTypeBossPatrick.h @@ -1,14 +1,14 @@ #ifndef ZNPCTYPEBOSSPATRICK_H #define ZNPCTYPEBOSSPATRICK_H -#include "zNPCTypeBoss.h" -#include "zNPCGoalCommon.h" -#include "zPlatform.h" #include "zCutsceneMgr.h" #include "zEntPickup.h" +#include "zNPCGoalCommon.h" +#include "zNPCTypeBoss.h" +#include "zNPCTypeVillager.h" +#include "zPlatform.h" #include "xCamera.h" -#include "zNPCTypeVillager.h" class newsfishSound { diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index b270d2f4b..a5744a5c5 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -1,6 +1,8 @@ #include "zNPCTypeBossPlankton.h" + #include "xDebug.h" +#include #include #define f1585 1.0f diff --git a/src/SB/Game/zNPCTypeBossPlankton.h b/src/SB/Game/zNPCTypeBossPlankton.h index 205e92d85..4ee995068 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.h +++ b/src/SB/Game/zNPCTypeBossPlankton.h @@ -1,17 +1,16 @@ #ifndef ZNPCTYPEBOSSPLANKTON_H #define ZNPCTYPEBOSSPLANKTON_H +#include "zEntDestructObj.h" +#include "zNPCGoalCommon.h" +#include "zNPCGoals.h" #include "zNPCTypeBoss.h" #include "zNPCTypeVillager.h" -#include "zNPCGoalCommon.h" -#include "zEntDestructObj.h" #include "xDecal.h" #include "xLaserBolt.h" -#include "xTimer.h" -#include "zNPCGoals.h" #include "xParEmitter.h" -#include "xLaserBolt.h" +#include "xTimer.h" namespace auto_tweak { diff --git a/src/SB/Game/zNPCTypeBossSB1.cpp b/src/SB/Game/zNPCTypeBossSB1.cpp index 08b27adaa..4b2930ffd 100644 --- a/src/SB/Game/zNPCTypeBossSB1.cpp +++ b/src/SB/Game/zNPCTypeBossSB1.cpp @@ -1,18 +1,19 @@ -#include -#include -#include +#include "zNPCTypeBossSB1.h" -#include "iMath.h" -#include "iModel.h" +#include "zGlobals.h" +#include "zGrid.h" +#include "zNPCGoals.h" +#include "zThrown.h" +#include "xDebug.h" #include "xDraw.h" #include "xMathInlines.h" -#include "zGrid.h" -#include "zNPCGoals.h" -#include "zNPCTypeBossSB1.h" -#include "zThrown.h" -#include "zGlobals.h" +#include "iMath.h" +#include "iModel.h" + +#include +#include static xVec3 BossArmTags[8] = { // { 11.507f, 4.523f, 2.53f }, diff --git a/src/SB/Game/zNPCTypeBossSB1.h b/src/SB/Game/zNPCTypeBossSB1.h index 34e55fe5f..bffa433a4 100644 --- a/src/SB/Game/zNPCTypeBossSB1.h +++ b/src/SB/Game/zNPCTypeBossSB1.h @@ -1,8 +1,8 @@ #ifndef ZNPCTYPEBOSSSB1_H #define ZNPCTYPEBOSSSB1_H -#include "zNPCTypeBoss.h" #include "zNPCGoalCommon.h" +#include "zNPCTypeBoss.h" #include "xFX.h" diff --git a/src/SB/Game/zNPCTypeBossSB2.cpp b/src/SB/Game/zNPCTypeBossSB2.cpp index caac06720..19f91e16f 100644 --- a/src/SB/Game/zNPCTypeBossSB2.cpp +++ b/src/SB/Game/zNPCTypeBossSB2.cpp @@ -1,29 +1,32 @@ #include "zNPCTypeBossSB2.h" -#include "PowerPC_EABI_Support/MSL_C++/MSL_Common/Include/new.h" -#include "xLightKit.h" -#include "zNPCGoalCommon.h" -#include -#include "string.h" -#include "iModel.h" -#include "xCollide.h" -#include "xMath.h" -#include "xMath3.h" -#include "xstransvc.h" -#include "xSnd.h" -#include "xVec3.h" -#include "xDebug.h" #include "zCamera.h" -#include "zEntSimpleObj.h" #include "zEntDestructObj.h" +#include "zEntSimpleObj.h" #include "zGlobals.h" #include "zGrid.h" -#include "zNPCTypeBossPatrick.h" -#include "zRenderState.h" #include "zLightning.h" +#include "zNPCGoalCommon.h" +#include "zNPCTypeBossPatrick.h" #include "zNPCTypeRobot.h" -#include +#include "zRenderState.h" + +#include "xCollide.h" +#include "xDebug.h" +#include "xLightKit.h" +#include "xMath.h" +#include "xMath3.h" +#include "xMathInlines.h" +#include "xSnd.h" +#include "xVec3.h" +#include "xstransvc.h" + +#include "iModel.h" + +#include "PowerPC_EABI_Support/MSL_C++/MSL_Common/Include/new.h" +#include "string.h" +#include #define ANIM_Unknown 0 //0x0 #define ANIM_Idle01 1 // 0x4 @@ -1028,9 +1031,9 @@ xAnimTable* ZNPC_AnimTable_BossSB2() ANIM_ChopLeftBegin, ANIM_ChopLeftLoop, ANIM_ChopLeftEnd, - ANIM_ChopRightBegin, - ANIM_ChopRightLoop, - ANIM_ChopRightEnd, + ANIM_ChopRightBegin, + ANIM_ChopRightLoop, + ANIM_ChopRightEnd, ANIM_SwipeLeftBegin, ANIM_SwipeLeftLoop, ANIM_SwipeLeftEnd, @@ -1041,9 +1044,9 @@ xAnimTable* ZNPC_AnimTable_BossSB2() ANIM_KarateStart, ANIM_KarateLoop, ANIM_KarateEnd, - ANIM_Dizzy01, + ANIM_Dizzy01, }; - + xAnimTable* table = xAnimTableNew("zNPCB_SB2_Karate", NULL, 0); //24 new state @@ -1148,7 +1151,7 @@ void zNPCB_SB2::Init(xEntAsset* asset) m = this->model; this->models[0] = this->model; - + this->models[1] = m->Next; this->models[2] = m->Next; this->models[3] = m->Next; @@ -1176,7 +1179,7 @@ void zNPCB_SB2::Init(xEntAsset* asset) void zNPCB_SB2::Setup() { - xEnt* ent; + xEnt* ent; xSphere o; this->create_glow_light(); @@ -1204,7 +1207,7 @@ void zNPCB_SB2::Setup() this->scan_cronies(); (xBase*)&this->newsfish->id = zSceneFindObject(xStrHash("NPC_NEWSCASTER")); - + if (this->newsfish->id != NULL) { this->newsfish->TalkOnScreen(1); @@ -1232,7 +1235,7 @@ void zNPCB_SB2::Reset() { this->newsfish->Reset(); } - + reset_sound(); zNPCCommon::Reset(); memset(&flag.face_player, 0 , 0x10); @@ -1351,7 +1354,7 @@ void zNPCB_SB2::decompose() { } -void zNPCB_SB2::show_nodes() +void zNPCB_SB2::show_nodes() { // Haven't found 0x74 S32 i; @@ -1374,7 +1377,7 @@ void zNPCB_SB2::ouchie() set_vulnerable(false); psy_instinct->GoalSet(NPC_GOAL_BOSSSB2HIT, 1); } - + } void zNPCB_SB2::Render() @@ -1440,9 +1443,9 @@ S32 zNPCB_SB2::player_on_ground() const void zNPCB_SB2::emit_slug(zNPCB_SB2::slug_enum which) { slug_data& slug = slugs[which]; - F32 launch_ang; + F32 launch_ang; F32 accel_time; - + if (slug.ent->id != 0) { slug.stage = (zNPCB_SB2::slug_stage)1; @@ -1459,8 +1462,8 @@ void zNPCB_SB2::emit_slug(zNPCB_SB2::slug_enum which) void zNPCB_SB2::fire_slug(zNPCB_SB2::slug_enum which, zNPCB_SB2::platform_data& target) { - slug_data& slug = slugs[which]; - xVec3 offset; + slug_data& slug = slugs[which]; + xVec3 offset; F32 idist; slug.stage = SLUG_DELAY; @@ -1585,7 +1588,7 @@ xFactoryInst* zNPCGoalBossSB2Hit::create(S32 who, RyzMemGrow* grow, void* info) return new (who, grow) zNPCGoalBossSB2Hit(who, (zNPCB_SB2&)*info); } -S32 zNPCGoalBossSB2Hit::Enter(F32 dt, void* updCtxt) +S32 zNPCGoalBossSB2Hit::Enter(F32 dt, void* updCtxt) { // Function needs set up differently // im just dumb diff --git a/src/SB/Game/zNPCTypeBossSB2.h b/src/SB/Game/zNPCTypeBossSB2.h index e7d735c12..1a53c12d2 100644 --- a/src/SB/Game/zNPCTypeBossSB2.h +++ b/src/SB/Game/zNPCTypeBossSB2.h @@ -1,10 +1,10 @@ #ifndef ZNPCTYPEBOSSSB2_H #define ZNPCTYPEBOSSSB2_H -#include "zNPCTypeBoss.h" -#include "zNPCTypeBossPlankton.h" #include "zNPCGoalCommon.h" #include "zNPCGoals.h" +#include "zNPCTypeBoss.h" +#include "zNPCTypeBossPlankton.h" struct zNPCNewsFish; diff --git a/src/SB/Game/zNPCTypeBossSandy.cpp b/src/SB/Game/zNPCTypeBossSandy.cpp index 0c197b496..a91678c56 100644 --- a/src/SB/Game/zNPCTypeBossSandy.cpp +++ b/src/SB/Game/zNPCTypeBossSandy.cpp @@ -1,23 +1,25 @@ -#include "xVec3Inlines.h" -#include - -#include "xAnim.h" -#include "xVec3.h" -#include "xEvent.h" -#include "xCamera.h" -#include "xMath3.h" -#include "xDebug.h" -#include "xJaw.h" +#include "zNPCTypeBossSandy.h" +#include "zCamera.h" #include "zEnt.h" #include "zFX.h" #include "zGlobals.h" -#include "zNPCSndTable.h" +#include "zGrid.h" #include "zNPCSndLists.h" -#include "zNPCTypeBossSandy.h" +#include "zNPCSndTable.h" + +#include "xAnim.h" +#include "xCamera.h" +#include "xDebug.h" +#include "xEvent.h" +#include "xJaw.h" #include "xMarkerAsset.h" -#include "zCamera.h" -#include "zGrid.h" +#include "xMath3.h" +#include "xVec3.h" +#include "xVec3Inlines.h" + +#include +#include extern const char bossSandyStrings[]; @@ -356,20 +358,25 @@ void zNPCBSandy::Init(xEntAsset* asset) this->wireLight[1] = 0; xDebugAddTweak("NPC|zNPCBSandy|Newsfish", "Speak", &newsfish_cb, 0, 0); - xDebugAddSelectTweak("NPC|zNPCBSandy|NewsfishComment", &sCurrNFSound, 0, &sNFSoundValue[0], 0x1e, 0, 0, 0); + xDebugAddSelectTweak("NPC|zNPCBSandy|NewsfishComment", &sCurrNFSound, 0, &sNFSoundValue[0], + 0x1e, 0, 0, 0); xDebugAddTweak("NPC|zNPCBSandy|Shockwave|Do It", "Go", &shockwave_cb, 0, 0); this->shockwaveGrowthRate = 20.0f; this->shockwaveMaxRadius = 10.0f; - xDebugAddTweak("NPC|zNPCBSandy|Shockwave|GrowthRate", &this->shockwaveGrowthRate, 0.0f, 1000000000.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|Shockwave|MaxRadius", &this->shockwaveMaxRadius, 0.0f, 1000000000.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|Shockwave|GrowthRate", &this->shockwaveGrowthRate, 0.0f, + 1000000000.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|Shockwave|MaxRadius", &this->shockwaveMaxRadius, 0.0f, + 1000000000.0f, 0, 0, 0); this->edropShockwaveTime = 2.25f; this->edropTurnMinTime = 1.0f; - xDebugAddTweak("NPC|zNPCBSandy|ElbowDrop|ShockwaveTime", &this->edropShockwaveTime, 0.0f, 1000000000.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|ElbowDrop|TurnTime", &this->edropTurnMinTime, 0.0f, 1000000000.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|ElbowDrop|ShockwaveTime", &this->edropShockwaveTime, 0.0f, + 1000000000.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|ElbowDrop|TurnTime", &this->edropTurnMinTime, 0.0f, + 1000000000.0f, 0, 0, 0); } void zNPCBSandy::Setup() @@ -507,20 +514,29 @@ void zNPCBSandy::Reset() this->headBoulder->localCenter.y = 0.036f; this->headBoulder->localCenter.z = 0.11f; - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|radius", &this->headBoulder->bound.sph.r, 0.1f, 10.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|x", &this->headBoulder->bound.sph.center.x, -10.0f, 10.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|y", &this->headBoulder->bound.sph.center.y, -10.0f, 10.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|z", &this->headBoulder->bound.sph.center.z, -10.0f, 10.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|x", &this->headBoulder->localCenter.x, -10.0f, 10.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|y", &this->headBoulder->localCenter.y, -10.0f, 10.0f, 0, 0, 0); - xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|z", &this->headBoulder->localCenter.z, -10.0f, 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|radius", &this->headBoulder->bound.sph.r, 0.1f, + 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|x", &this->headBoulder->bound.sph.center.x, + -10.0f, 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|y", &this->headBoulder->bound.sph.center.y, + -10.0f, 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|z", &this->headBoulder->bound.sph.center.z, + -10.0f, 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|x", &this->headBoulder->localCenter.x, + -10.0f, 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|y", &this->headBoulder->localCenter.y, + -10.0f, 10.0f, 0, 0, 0); + xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|z", &this->headBoulder->localCenter.z, + -10.0f, 10.0f, 0, 0, 0); this->hangingScoreboard = (xEnt*)zSceneFindObject(xStrHash("SO_SCOREBOARD")); this->bustedScoreboard = (xEnt*)zSceneFindObject(xStrHash("SCOREBOARD_BUSTED")); this->crashedScoreboard = (xEnt*)zSceneFindObject(xStrHash("SCOREBOARD_HAZARD")); this->scoreboardShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_shrapnel"), 0); - this->sboardSecondShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_secondary_shrapnel"), 0); - this->sboardThirdShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_tertiary_shrapnel"), 0); + this->sboardSecondShrap = + (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_secondary_shrapnel"), 0); + this->sboardThirdShrap = + (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_tertiary_shrapnel"), 0); this->lightRigShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scaffolding_shrapnel"), 0); this->lightRig[0] = (xEnt*)zSceneFindObject(xStrHash("SO_LIGHTRIG01")); this->lightRig[1] = (xEnt*)zSceneFindObject(xStrHash("SO_LIGHTRIG010")); @@ -567,7 +583,7 @@ void zNPCBSandy::Reset() strcmp(this->ropeObject[0][0]->model->Anim->Table->StateList->Name, "Idle01"); strcpy(objName, "ROPE_0_LO"); - this-> ropeObjectLo[0] = (xEnt*)zSceneFindObject(xStrHash(objName)); + this->ropeObjectLo[0] = (xEnt*)zSceneFindObject(xStrHash(objName)); this->ropeSbDamaged = (xEnt*)zSceneFindObject(xStrHash("ROPE_4_LO_DAMAGED")); strcpy(objName, "TURNBUCKLE_OBJ_00"); this->turnbuckle[0] = (xEnt*)zSceneFindObject(xStrHash(objName)); @@ -765,15 +781,24 @@ void zNPCBSandy::InitFX() this->maxLightningWait[0] = 0.0f; this->maxLightningWait[1] = 0.0f; - xMat4x3Copy((xMat4x3*)&this->sparkTransform[0][0], (xMat4x3*)&this->hangingScoreboard->model->Mat); - xMat4x3Copy((xMat4x3*)&this->sparkTransform[0][1], (xMat4x3*)&this->hangingScoreboard->model->Mat); - xMat4x3Copy((xMat4x3*)&this->sparkTransform[1][0], (xMat4x3*)&this->crashedScoreboard->model->Mat); - xVec3SMul((xVec3*)&this->sparkTransform[1][1], (xVec3*)&this->crashedScoreboard->model->Mat, 0.8f); - xVec3SMul((xVec3*)&this->sparkTransform[1][1].up, (xVec3*)&this->crashedScoreboard->model->Mat->at, -0.8f); - xVec3SMul((xVec3*)&this->sparkTransform[1][1].at, (xVec3*)&this->crashedScoreboard->model->Mat->up, 0.8f); - xVec3Copy((xVec3*)&this->sparkTransform[1][1].pos, (xVec3*)&this->crashedScoreboard->model->Mat->pos); - xVec3AddScaled((xVec3*)&this->sparkTransform[1][1].pos, (xVec3*)&this->crashedScoreboard->model->Mat->up, 4.5f); - xVec3AddScaled((xVec3*)&this->sparkTransform[1][1].pos, (xVec3*)&this->crashedScoreboard->model->Mat->at, 5.0f); + xMat4x3Copy((xMat4x3*)&this->sparkTransform[0][0], + (xMat4x3*)&this->hangingScoreboard->model->Mat); + xMat4x3Copy((xMat4x3*)&this->sparkTransform[0][1], + (xMat4x3*)&this->hangingScoreboard->model->Mat); + xMat4x3Copy((xMat4x3*)&this->sparkTransform[1][0], + (xMat4x3*)&this->crashedScoreboard->model->Mat); + xVec3SMul((xVec3*)&this->sparkTransform[1][1], (xVec3*)&this->crashedScoreboard->model->Mat, + 0.8f); + xVec3SMul((xVec3*)&this->sparkTransform[1][1].up, + (xVec3*)&this->crashedScoreboard->model->Mat->at, -0.8f); + xVec3SMul((xVec3*)&this->sparkTransform[1][1].at, + (xVec3*)&this->crashedScoreboard->model->Mat->up, 0.8f); + xVec3Copy((xVec3*)&this->sparkTransform[1][1].pos, + (xVec3*)&this->crashedScoreboard->model->Mat->pos); + xVec3AddScaled((xVec3*)&this->sparkTransform[1][1].pos, + (xVec3*)&this->crashedScoreboard->model->Mat->up, 4.5f); + xVec3AddScaled((xVec3*)&this->sparkTransform[1][1].pos, + (xVec3*)&this->crashedScoreboard->model->Mat->at, 5.0f); xVec3Init((xVec3*)&this->endPoints[0][0], -2.0f, 2.0f, 0.0f); xVec3Init((xVec3*)&this->endPoints[0][1], 2.0f, 2.0f, 0.0f); diff --git a/src/SB/Game/zNPCTypeBossSandy.h b/src/SB/Game/zNPCTypeBossSandy.h index 3433aa561..347b5d99c 100644 --- a/src/SB/Game/zNPCTypeBossSandy.h +++ b/src/SB/Game/zNPCTypeBossSandy.h @@ -1,15 +1,15 @@ #ifndef ZNPCTYPEBOSSSANDY_H #define ZNPCTYPEBOSSSANDY_H -#include "zNPCTypeBoss.h" -#include "zNPCTypeVillager.h" -#include "zNPCGoalCommon.h" #include "zCutsceneMgr.h" #include "zEntPickup.h" +#include "zNPCGoalCommon.h" +#include "zNPCTypeBoss.h" +#include "zNPCTypeVillager.h" +#include "xCamera.h" #include "xEntBoulder.h" #include "xFX.h" -#include "xCamera.h" #include "xModel.h" struct BossDamageEffectRecord diff --git a/src/SB/Game/zNPCTypeCommon.cpp b/src/SB/Game/zNPCTypeCommon.cpp index 4b0eab249..72bb6167b 100644 --- a/src/SB/Game/zNPCTypeCommon.cpp +++ b/src/SB/Game/zNPCTypeCommon.cpp @@ -1,21 +1,30 @@ #include "zNPCTypeCommon.h" -#include -#include -#include - -#include "xDebug.h" -#include "xDraw.h" -#include "zGameExtras.h" -#include "xMathInlines.h" -#include "xString.h" - #include "zAssetTypes.h" #include "zCombo.h" #include "zEntButton.h" +#include "zEntCruiseBubble.h" #include "zEntTeleportBox.h" +#include "zGame.h" +#include "zGameExtras.h" +#include "zGlobals.h" #include "zGrid.h" #include "zNPCFXCinematic.h" +#include "zNPCGoals.h" +#include "zNPCSupport.h" +#include "zRumble.h" + +#include "xDebug.h" +#include "xDraw.h" +#include "xMathInlines.h" +#include "xString.h" +#include "xutil.h" + +#include "iCollide.h" + +#include +#include +#include #define Unknown 0 #define LassoGuide_Grab01 1 diff --git a/src/SB/Game/zNPCTypeCommon.h b/src/SB/Game/zNPCTypeCommon.h index 901f3c240..091fe0f60 100644 --- a/src/SB/Game/zNPCTypeCommon.h +++ b/src/SB/Game/zNPCTypeCommon.h @@ -1,19 +1,19 @@ #ifndef ZNPCTYPECOMMON_H #define ZNPCTYPECOMMON_H -#include "xNPCBasic.h" -#include "xDynAsset.h" -#include "xListItem.h" -#include "xEntDrive.h" +#include "zMovePoint.h" +#include "zNPCMessenger.h" +#include "zNPCSndTable.h" +#include "zShrapnel.h" + #include "xBehaveMgr.h" +#include "xDynAsset.h" #include "xEnt.h" +#include "xEntDrive.h" +#include "xListItem.h" +#include "xNPCBasic.h" #include "xSFX.h" -#include "zNPCSndTable.h" -#include "zMovePoint.h" -#include "zShrapnel.h" -#include "zNPCMessenger.h" - #define XRAY3_USE_MIN (1 << 10) #define XRAY3_USE_MAX (1 << 11) diff --git a/src/SB/Game/zNPCTypeDuplotron.cpp b/src/SB/Game/zNPCTypeDuplotron.cpp index 68553f642..c258f6ad6 100644 --- a/src/SB/Game/zNPCTypeDuplotron.cpp +++ b/src/SB/Game/zNPCTypeDuplotron.cpp @@ -1,10 +1,12 @@ -#include "xGroup.h" -#include "xMathInlines.h" +#include "zNPCTypeDuplotron.h" + #include "zGlobals.h" #include "zNPCGoalCommon.h" #include "zNPCGoals.h" #include "zNPCSupport.h" -#include "zNPCTypeDuplotron.h" + +#include "xGroup.h" +#include "xMathInlines.h" #define ANIM_Unknown 0 #define ANIM_Idle01 1 diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 3f22c47d9..3c3eaea15 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -1,9 +1,14 @@ -#include "xVec3.h" -#include "xMath3.h" -#include "xDebug.h" -#include "zGlobals.h" + #include "zNPCTypeDutchman.h" +#include "zGlobals.h" + +#include "xDebug.h" +#include "xMath3.h" + +#include "iDraw.h" + +#include #include #define f1605 0.0f @@ -973,19 +978,19 @@ xAnimTable* ZNPC_AnimTable_Dutchman() // clang-format off S32 ourAnims[13] = { ANIM_Idle01, - ANIM_Fidget01, - ANIM_Fidget02, - ANIM_Fidget03, - ANIM_Taunt01, - ANIM_Death01, - ANIM_AttackWindup01, + ANIM_Fidget01, + ANIM_Fidget02, + ANIM_Fidget03, + ANIM_Taunt01, + ANIM_Death01, + ANIM_AttackWindup01, ANIM_AttackLoop01, - ANIM_AttackEnd01, - ANIM_Attack02Windup01, - ANIM_Attack02Loop01, + ANIM_AttackEnd01, + ANIM_Attack02Windup01, + ANIM_Attack02Loop01, ANIM_Attack02End01, ANIM_LassoGrab01, - + }; // clang-format on xAnimTable* table = xAnimTableNew("zNPCDutchman", NULL, 0); diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index d73bc5d38..9c714fac4 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -1,14 +1,15 @@ #ifndef ZNPCTYPEDUTCHMAN_H #define ZNPCTYPEDUTCHMAN_H -#include "zNPCTypeSubBoss.h" +#include "zCamera.h" #include "zNPCGoalCommon.h" +#include "zNPCGoals.h" +#include "zNPCTypeCommon.h" +#include "zNPCTypeSubBoss.h" + #include "containers.h" #include "xBehaviour.h" -#include "zNPCTypeCommon.h" -#include "zNPCGoals.h" #include "xCamera.h" -#include "zCamera.h" #include "xMath3.h" namespace auto_tweak diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index b0ac1775f..c94ec46cc 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -1,9 +1,11 @@ #include "zNPCTypeKingJelly.h" -#include "xColor.h" #include "zNPCGoalCommon.h" -#include + +#include "xColor.h" + #include "string.h" +#include #define f1868 1.0f #define f1869 0.0f diff --git a/src/SB/Game/zNPCTypeKingJelly.h b/src/SB/Game/zNPCTypeKingJelly.h index a3136aa02..7ea6a18e3 100644 --- a/src/SB/Game/zNPCTypeKingJelly.h +++ b/src/SB/Game/zNPCTypeKingJelly.h @@ -1,14 +1,15 @@ #ifndef ZNPCTYPEKINGJELLY_H #define ZNPCTYPEKINGJELLY_H -#include "zNPCTypeSubBoss.h" #include "zNPCGoalCommon.h" #include "zNPCGoals.h" -#include "xEnt.h" +#include "zNPCTypeAmbient.h" +#include "zNPCTypeSubBoss.h" + #include "containers.h" #include "xBehaviour.h" -#include "zNPCTypeAmbient.h" #include "xCamera.h" +#include "xEnt.h" namespace auto_tweak { diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 881800a4a..19a5d3962 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -1,12 +1,14 @@ #include "zNPCTypePrawn.h" -#include "rwcore.h" -#include "xDebug.h" - -#include "xMemMgr.h" #include "zEntCruiseBubble.h" #include "zNPCTypeCommon.h" #include "zRenderState.h" + +#include "xDebug.h" +#include "xMemMgr.h" + +#include "rwcore.h" +#include #include #define f1052 1.0f @@ -297,7 +299,6 @@ namespace } } - void television::render_static() { } @@ -583,12 +584,12 @@ xAnimTable* ZNPC_AnimTable_Prawn() ANIM_Fidget02, ANIM_Taunt01, ANIM_AttackWindup01, - ANIM_AttackLoop01, + ANIM_AttackLoop01, ANIM_AttackLoop01, ANIM_AttackEnd01, ANIM_Damage01, ANIM_Damage02, - + }; // clang-format on xAnimTable* table = xAnimTableNew("zNPCPrawn", NULL, 0); diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index 7da86069d..3bd38ceff 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -1,15 +1,16 @@ #ifndef ZNPCTYPEPRAWN_H #define ZNPCTYPEPRAWN_H -#include "zNPCTypeSubBoss.h" +#include "zCamera.h" +#include "zDiscoFloor.h" #include "zNPCGoalCommon.h" #include "zNPCGoals.h" -#include "zDiscoFloor.h" #include "zNPCSpawner.h" +#include "zNPCTypeSubBoss.h" + #include "containers.h" #include "xBehaviour.h" #include "xSnd.h" -#include "zCamera.h" struct sound_data_type { diff --git a/src/SB/Game/zNPCTypeRobot.cpp b/src/SB/Game/zNPCTypeRobot.cpp index 74fe706de..f5f92cb35 100644 --- a/src/SB/Game/zNPCTypeRobot.cpp +++ b/src/SB/Game/zNPCTypeRobot.cpp @@ -1,17 +1,18 @@ #include "zNPCTypeRobot.h" -#include "zNPCSupplement.h" -#include "zNPCSupport.h" -#include "zNPCSndLists.h" + +#include "zGlobals.h" #include "zNPCGoalRobo.h" -#include "zNPCTypes.h" #include "zNPCGoalStd.h" -#include "zGlobals.h" #include "zNPCGoals.h" +#include "zNPCSndLists.h" +#include "zNPCSupplement.h" +#include "zNPCSupport.h" +#include "zNPCTypes.h" -#include "xFactory.h" -#include "xMath.h" #include "xAnim.h" #include "xBehaviour.h" +#include "xFactory.h" +#include "xMath.h" #include diff --git a/src/SB/Game/zNPCTypeRobot.h b/src/SB/Game/zNPCTypeRobot.h index 4b1f2b421..6695440f3 100644 --- a/src/SB/Game/zNPCTypeRobot.h +++ b/src/SB/Game/zNPCTypeRobot.h @@ -1,13 +1,13 @@ #ifndef ZNPCTYPEROBOT_H #define ZNPCTYPEROBOT_H -#include "xPad.h" -#include "xModel.h" - -#include "zNPCTypeCommon.h" -#include "zNPCSupport.h" #include "zNPCGlyph.h" #include "zNPCHazard.h" +#include "zNPCSupport.h" +#include "zNPCTypeCommon.h" + +#include "xModel.h" +#include "xPad.h" typedef struct zNPCRobot; extern char* g_strz_roboanim[41]; @@ -192,7 +192,6 @@ struct zNPCFodBomb : zNPCRobot void Setup(); void BlinkerReset(); void BlinkerUpdate(F32 dt, F32 pct_timeRemain); - }; struct zNPCFodBzzt : zNPCRobot diff --git a/src/SB/Game/zNPCTypeSubBoss.cpp b/src/SB/Game/zNPCTypeSubBoss.cpp index a74dd0d7e..f6e5f58b4 100644 --- a/src/SB/Game/zNPCTypeSubBoss.cpp +++ b/src/SB/Game/zNPCTypeSubBoss.cpp @@ -1,9 +1,9 @@ #include "zNPCTypeSubBoss.h" -#include "zNPCTypes.h" -#include "zNPCTypeKingJelly.h" #include "zNPCTypeDutchman.h" +#include "zNPCTypeKingJelly.h" #include "zNPCTypePrawn.h" +#include "zNPCTypes.h" U32 g_hash_subbanim[ANIM_COUNT] = {}; diff --git a/src/SB/Game/zNPCTypeSubBoss.h b/src/SB/Game/zNPCTypeSubBoss.h index 9a1508521..ecd916076 100644 --- a/src/SB/Game/zNPCTypeSubBoss.h +++ b/src/SB/Game/zNPCTypeSubBoss.h @@ -1,8 +1,8 @@ #ifndef ZNPCTYPESUBBOSS_H #define ZNPCTYPESUBBOSS_H -#include "zNPCTypeCommon.h" #include "zNPCSupport.h" +#include "zNPCTypeCommon.h" struct zNPCSubBoss : zNPCCommon //Size of zNPCSubBoss: 0x2B4 { diff --git a/src/SB/Game/zNPCTypeTest.cpp b/src/SB/Game/zNPCTypeTest.cpp index 2a340b3f9..59f38f4af 100644 --- a/src/SB/Game/zNPCTypeTest.cpp +++ b/src/SB/Game/zNPCTypeTest.cpp @@ -2,8 +2,8 @@ #include "zNPCTypes.h" -#include "xString.h" #include "xMath.h" +#include "xString.h" #define ANIM_COUNT 11 @@ -76,14 +76,14 @@ xAnimTable* ZNPC_AnimTable_Test() { if (i < ANIM_COUNT - 1) { - xAnimTableNewTransition(table, names[i], names[i + 1], NULL, NULL, 0, 0, 0.0f, 0.0f, - 1, 0, 0.15f, NULL); + xAnimTableNewTransition(table, names[i], names[i + 1], NULL, NULL, 0, 0, 0.0f, 0.0f, 1, + 0, 0.15f, NULL); } if (i > 1) { - xAnimTableNewTransition(table, names[i], names[1], NULL, NULL, 0, 0, 0.0f, 0.0f, 1, - 0, 0.15f, NULL); + xAnimTableNewTransition(table, names[i], names[1], NULL, NULL, 0, 0, 0.0f, 0.0f, 1, 0, + 0.15f, NULL); } } diff --git a/src/SB/Game/zNPCTypeTiki.cpp b/src/SB/Game/zNPCTypeTiki.cpp index 703531b17..28b9f8256 100644 --- a/src/SB/Game/zNPCTypeTiki.cpp +++ b/src/SB/Game/zNPCTypeTiki.cpp @@ -1,21 +1,22 @@ -#include "iAnim.h" -#include "iCollide.h" - -#include "xDebug.h" -#include "xScrFx.h" -#include "xVec3.h" -#include "xutil.h" +#include "zNPCTypeTiki.h" #include "zEntButton.h" #include "zGlobals.h" #include "zGoo.h" -#include "zNPCGoals.h" #include "zNPCGoalTiki.h" +#include "zNPCGoals.h" #include "zNPCHazard.h" #include "zNPCSupplement.h" -#include "zNPCTypeTiki.h" #include "zSurface.h" +#include "xDebug.h" +#include "xScrFx.h" +#include "xVec3.h" +#include "xutil.h" + +#include "iAnim.h" +#include "iCollide.h" + #define ANIM_COUNT 2 #define NUM_PARENTS 4 #define NUM_CHILDREN 4 diff --git a/src/SB/Game/zNPCTypeVillager.cpp b/src/SB/Game/zNPCTypeVillager.cpp index a58e9c32e..811c189ad 100644 --- a/src/SB/Game/zNPCTypeVillager.cpp +++ b/src/SB/Game/zNPCTypeVillager.cpp @@ -1,17 +1,20 @@ #include "zNPCTypeVillager.h" -#include "xBehaveMgr.h" -#include "xJaw.h" -#include "xMathInlines.h" #include "zGameExtras.h" #include "zGlobals.h" #include "zNPCGoalVillager.h" -#include "zNPCSupplement.h" #include "zNPCGoals.h" +#include "zNPCSupplement.h" #include "zRenderState.h" + +#include "xBehaveMgr.h" #include "xDebug.h" +#include "xJaw.h" +#include "xMathInlines.h" #include "xUtil.h" +#include + #define Unknown 0 #define Idle01 1 #define Move01 2 diff --git a/src/SB/Game/zNPCTypeVillager.h b/src/SB/Game/zNPCTypeVillager.h index 4e13633bf..932eb7a8c 100644 --- a/src/SB/Game/zNPCTypeVillager.h +++ b/src/SB/Game/zNPCTypeVillager.h @@ -1,12 +1,13 @@ #ifndef ZNPCTYPEVILLAGER_H #define ZNPCTYPEVILLAGER_H -#include "xBehaviour.h" #include "zNPCSndLists.h" #include "zNPCSupport.h" #include "zNPCTypeCommon.h" -#include "zTaskBox.h" #include "zPlatform.h" +#include "zTaskBox.h" + +#include "xBehaviour.h" #include "xShadow.h" struct HiThere : ztaskbox::callback diff --git a/src/SB/Game/zNPCTypes.cpp b/src/SB/Game/zNPCTypes.cpp index c98a3047e..ab64edde9 100644 --- a/src/SB/Game/zNPCTypes.cpp +++ b/src/SB/Game/zNPCTypes.cpp @@ -1,14 +1,14 @@ #include "zNPCTypes.h" +#include "zNPCTypeAmbient.h" +#include "zNPCTypeBoss.h" #include "zNPCTypeCommon.h" -#include "zNPCTypeRobot.h" -#include "zNPCTypeTiki.h" #include "zNPCTypeDuplotron.h" -#include "zNPCTypeVillager.h" -#include "zNPCTypeAmbient.h" +#include "zNPCTypeRobot.h" #include "zNPCTypeSubBoss.h" -#include "zNPCTypeBoss.h" #include "zNPCTypeTest.h" +#include "zNPCTypeTiki.h" +#include "zNPCTypeVillager.h" void zNPCTypes_StartupTypes() { diff --git a/src/SB/Game/zParCmd.cpp b/src/SB/Game/zParCmd.cpp index dd1269a54..f349b749a 100644 --- a/src/SB/Game/zParCmd.cpp +++ b/src/SB/Game/zParCmd.cpp @@ -1,17 +1,17 @@ #include "zParCmd.h" -#include -#include -#include +#include "zGlobals.h" +#include "zScene.h" +#include "zVolume.h" -#include "xParCmd.h" #include "xMath.h" #include "xMathInlines.h" +#include "xParCmd.h" #include "xString.h" -#include "zGlobals.h" -#include "zScene.h" -#include "zVolume.h" +#include +#include +#include static zVolume* sClipVolume[32]; static S32 sClipVolumeTotal; diff --git a/src/SB/Game/zParEmitter.cpp b/src/SB/Game/zParEmitter.cpp index 4142917ec..2282530a0 100644 --- a/src/SB/Game/zParEmitter.cpp +++ b/src/SB/Game/zParEmitter.cpp @@ -1,10 +1,12 @@ #include "zParEmitter.h" -#include #include "zBase.h" #include "zGlobals.h" + #include "xString.h" +#include + zParEmitter* zParEmitterFind(U32 asset_id) { zScene* s = globals.sceneCur; diff --git a/src/SB/Game/zParEmitter.h b/src/SB/Game/zParEmitter.h index 2dce49f74..70aa43ab9 100644 --- a/src/SB/Game/zParEmitter.h +++ b/src/SB/Game/zParEmitter.h @@ -1,9 +1,10 @@ #ifndef ZPAREMITTER_H #define ZPAREMITTER_H -#include #include "xParEmitter.h" +#include + struct zParEmitter : xParEmitter { }; diff --git a/src/SB/Game/zParPTank.cpp b/src/SB/Game/zParPTank.cpp index 9a131a508..7014b709c 100644 --- a/src/SB/Game/zParPTank.cpp +++ b/src/SB/Game/zParPTank.cpp @@ -1,10 +1,7 @@ #include "zParPTank.h" -#include -#include -#include - -#include "iColor.h" +#include "zGame.h" +#include "zGlobals.h" #include "xClimate.h" #include "xMath.h" @@ -12,12 +9,16 @@ #include "xMemMgr.h" #include "xParEmitter.h" #include "xPtankPool.h" -#include "xstransvc.h" #include "xString.h" #include "xVec3.h" +#include "xstransvc.h" -#include "zGame.h" -#include "zGlobals.h" +#include "iColor.h" + +#include + +#include +#include // NOTE (Square) // There's something slightly off in this file. Functions appear to be equivalent but it's hard to diff --git a/src/SB/Game/zPendulum.cpp b/src/SB/Game/zPendulum.cpp index bb83e3b47..680bcd522 100644 --- a/src/SB/Game/zPendulum.cpp +++ b/src/SB/Game/zPendulum.cpp @@ -1,6 +1,7 @@ #include "zPendulum.h" -#include "zGlobals.h" + #include "zCollGeom.h" +#include "zGlobals.h" #include "zShrapnel.h" #include "xEnt.h" diff --git a/src/SB/Game/zPendulum.h b/src/SB/Game/zPendulum.h index 0f2d1dd59..cd9dd7869 100644 --- a/src/SB/Game/zPendulum.h +++ b/src/SB/Game/zPendulum.h @@ -1,10 +1,10 @@ #ifndef ZPENDULUM_H #define ZPENDULUM_H -#include "xEntMotion.h" - #include "zEnt.h" +#include "xEntMotion.h" + #include struct _zPendulum : zEnt @@ -24,7 +24,6 @@ void zPendulum_Reset(_zPendulum* pend, xScene* sc); void zPendulum_Update(_zPendulum* pend, xScene* sc, F32 dt); void zPendulum_Move(_zPendulum* pend, xScene* sc, F32 dt, xEntFrame* frame); void zPendulumTranslate(xEnt* xent, xVec3* dpos, xMat4x3* dmat); -S32 zPendulumEventCB(xBase* from, xBase* to, U32 event, const F32* toParam, - xBase* toParamWidget); +S32 zPendulumEventCB(xBase* from, xBase* to, U32 event, const F32* toParam, xBase* toParamWidget); #endif diff --git a/src/SB/Game/zPickupTable.cpp b/src/SB/Game/zPickupTable.cpp index 258965bb8..a7941fa98 100644 --- a/src/SB/Game/zPickupTable.cpp +++ b/src/SB/Game/zPickupTable.cpp @@ -1,6 +1,7 @@ #include "zPickupTable.h" #include "zGlobals.h" + #include "xString.h" struct PickupTranslEntry diff --git a/src/SB/Game/zPlatform.cpp b/src/SB/Game/zPlatform.cpp index bd260178d..eeda4c1ca 100644 --- a/src/SB/Game/zPlatform.cpp +++ b/src/SB/Game/zPlatform.cpp @@ -1,23 +1,24 @@ #include "zPlatform.h" + +#include "zCollGeom.h" #include "zEnt.h" #include "zEntPlayer.h" -#include "xEntDrive.h" -#include "xScrFx.h" -#include "zParEmitter.h" -#include "zRumble.h" #include "zFX.h" -#include "zCollGeom.h" +#include "zGlobals.h" #include "zGoo.h" -#include "xSkyDome.h" +#include "zParEmitter.h" +#include "zRumble.h" #include "zShrapnel.h" -#include "xEntMotionAsset.h" +#include "xCollide.h" +#include "xEntDrive.h" +#include "xEntMotionAsset.h" #include "xMath.h" #include "xMath3.h" #include "xMathInlines.h" +#include "xScrFx.h" +#include "xSkyDome.h" #include "xstransvc.h" -#include "zGlobals.h" -#include "xCollide.h" #include @@ -58,9 +59,12 @@ void zPlatform_Init(zPlatform* plat, xEntAsset* asset) plat->passet = passet; plat->subType = passet->type; - if (plat->linkCount) { + if (plat->linkCount) + { plat->link = (xLinkAsset*)(emasset + 1); - } else { + } + else + { plat->link = NULL; } @@ -77,7 +81,8 @@ void zPlatform_Init(zPlatform* plat, xEntAsset* asset) plat->pauseMult = 1.0f; plat->pauseDelta = 0.0f; - if (plat->subType == ePlatformTypeBreakaway) { + if (plat->subType == ePlatformTypeBreakaway) + { plat->collis = (xEntCollis*)xMemAllocSize(sizeof(xEntCollis)); plat->collis->chk = 0; plat->collis->pen = 0; @@ -86,19 +91,25 @@ void zPlatform_Init(zPlatform* plat, xEntAsset* asset) void* buf = NULL; U32 size = 0; - if (passet->ba.bustModelID) { + if (passet->ba.bustModelID) + { buf = xSTFindAsset(passet->ba.bustModelID, &size); } - if (buf) { + if (buf) + { xEntLoadModel(plat, (RpAtomic*)buf); plat->bm = plat->model; - } else { + } + else + { plat->bm = NULL; } plat->model = plat->am; plat->collModel = NULL; - } else if (plat->subType == ePlatformTypeSpringboard) { + } + else if (plat->subType == ePlatformTypeSpringboard) + { void* spring_anim; void* idle_anim; xAnimFile* spring_file; @@ -108,13 +119,15 @@ void zPlatform_Init(zPlatform* plat, xEntAsset* asset) spring_anim = passet->sb.animID[0] ? xSTFindAsset(passet->sb.animID[0], NULL) : NULL; idle_anim = passet->sb.animID[1] ? xSTFindAsset(passet->sb.animID[1], NULL) : NULL; - if (spring_anim || idle_anim) { + if (spring_anim || idle_anim) + { gxAnimUseGrowAlloc = 1; plat->atbl = xAnimTableNew("", NULL, 0); xAnimTableNewStateDefault(plat->atbl, "Idle", 0x10, 0); - if (spring_anim) { + if (spring_anim) + { xAnimTableNewStateDefault(plat->atbl, "Spring", 0x20, 0); xAnimTableNewTransitionDefault(plat->atbl, "Spring", "Idle", 0, 0.1f); @@ -122,10 +135,13 @@ void zPlatform_Init(zPlatform* plat, xEntAsset* asset) xAnimTableAddFile(plat->atbl, spring_file, "Spring"); } - if (idle_anim) { + if (idle_anim) + { idle_file = xAnimFileNew(idle_anim, "", 0, NULL); xAnimTableAddFile(plat->atbl, idle_file, "Idle"); - } else { + } + else + { xAnimTableAddFile(plat->atbl, spring_file, "Idle"); plat->atbl->StateList[0].Speed = 0.0f; } @@ -134,17 +150,20 @@ void zPlatform_Init(zPlatform* plat, xEntAsset* asset) xAnimPoolAlloc(&globals.sceneCur->mempool, plat, plat->atbl, plat->model); } - } else if (plat->subType == ePlatformTypeFM) { + } + else if (plat->subType == ePlatformTypeFM) + { plat->fmrt = (zPlatFMRunTime*)xMemAllocSize(sizeof(zPlatFMRunTime)); } xEntMotionInit(&plat->motion, plat, emasset); - + xEntDriveInit(&plat->drv, plat); plat->drv.flags = 0x1; if (plat->asset->modelInfoID == xStrHash("teeter_totter_pat") || - plat->asset->modelInfoID == xStrHash("teeter_totter_pat_bind")) { + plat->asset->modelInfoID == xStrHash("teeter_totter_pat_bind")) + { plat->plat_flags |= 0x2; } } @@ -174,7 +193,8 @@ void zPlatform_Load(zPlatform* ent, xSerial* s) void zPlatform_Reset(zPlatform* plat, xScene* sc) { - if (plat->subType == ePlatformTypeBreakaway) { + if (plat->subType == ePlatformTypeBreakaway) + { plat->model = plat->am; plat->collModel = NULL; } @@ -186,28 +206,40 @@ void zPlatform_Reset(zPlatform* plat, xScene* sc) plat->plat_flags = 0x1; - if (plat->subType == ePlatformTypeER) { + if (plat->subType == ePlatformTypeER) + { plat->state = 3; - } else if (plat->subType == ePlatformTypeBreakaway) { + } + else if (plat->subType == ePlatformTypeBreakaway) + { plat->tmr = plat->passet->ba.ba_delay; plat->state = 0; - plat->pflags &= (U8)~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY); + plat->pflags &= (U8) ~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY); plat->collis->chk = 0; xVec3Copy(&plat->frame->vel, &g_O3); plat->bound.mat = (xMat4x3*)plat->model->Mat; - } else if (plat->subType == ePlatformTypeMech) { + } + else if (plat->subType == ePlatformTypeMech) + { plat->state = plat->motion.mech.state; - } else if (plat->subType == ePlatformTypeSpringboard) { + } + else if (plat->subType == ePlatformTypeSpringboard) + { plat->tmr = -1.0f; plat->ctr = 0; - } else if (plat->subType == ePlatformTypePaddle) { + } + else if (plat->subType == ePlatformTypePaddle) + { plat->tmr = 1e-9f; plat->state = 2; plat->ctr = plat->passet->paddle.startOrient; - } else if (plat->subType == ePlatformTypeFM) { - for (S32 i = 0; i < 12; i++) { + } + else if (plat->subType == ePlatformTypeFM) + { + for (S32 i = 0; i < 12; i++) + { plat->fmrt->flags = 0; plat->fmrt->tmrs[i] = 0.0f; plat->fmrt->ttms[i] = 0.0f; @@ -218,13 +250,15 @@ void zPlatform_Reset(zPlatform* plat, xScene* sc) } } - if (plat->motion.type == k_XENTMOTIONTYPE_MP) { + if (plat->motion.type == k_XENTMOTIONTYPE_MP) + { plat->src = plat->motion.mp.src; } - plat->chkby &= (U8)~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC | XENT_COLLTYPE_DYN); + plat->chkby &= (U8) ~(XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC | XENT_COLLTYPE_DYN); - if (plat->passet->flags & 0x4) { + if (plat->passet->flags & 0x4) + { plat->chkby |= (XENT_COLLTYPE_PLYR | XENT_COLLTYPE_NPC); } @@ -232,7 +266,8 @@ void zPlatform_Reset(zPlatform* plat, xScene* sc) plat->moving = 0; if (plat->asset->modelInfoID == xStrHash("teeter_totter_pat") || - plat->asset->modelInfoID == xStrHash("teeter_totter_pat_bind")) { + plat->asset->modelInfoID == xStrHash("teeter_totter_pat_bind")) + { plat->plat_flags |= 0x2; } @@ -242,18 +277,24 @@ void zPlatform_Reset(zPlatform* plat, xScene* sc) static S32 zMechIsStartingForth(zPlatform* plat, U16 state) { - if (plat->motion.asset->mech.type == k_XENTMOTIONMECH_ROT_THEN_SLIDE) { + if (plat->motion.asset->mech.type == k_XENTMOTIONMECH_ROT_THEN_SLIDE) + { return state == 1; - } else { + } + else + { return state == 0; } } static S32 zMechIsStartingBack(zPlatform* plat, U16 state) { - if (plat->motion.asset->mech.type == k_XENTMOTIONMECH_ROT_THEN_SLIDE) { + if (plat->motion.asset->mech.type == k_XENTMOTIONMECH_ROT_THEN_SLIDE) + { return state == 4; - } else { + } + else + { return state == 3; } } @@ -261,58 +302,77 @@ static S32 zMechIsStartingBack(zPlatform* plat, U16 state) static F32 SolvePaddleMotion(zPlatform* plat, F32* time, F32 tmr) { xPlatformPaddleData* paddle = &plat->passet->paddle; - + F32 destOrient = paddle->orient[plat->ctr]; F32 srcOrient; - if (plat->state == 1 || plat->state == 3) { - if (plat->ctr + 1 == paddle->countOrient) { + if (plat->state == 1 || plat->state == 3) + { + if (plat->ctr + 1 == paddle->countOrient) + { srcOrient = paddle->orientLoop; - } else { + } + else + { srcOrient = paddle->orient[plat->ctr + 1]; } - } else if (plat->state == 2 || plat->state == 4) { - if (plat->ctr == 0) { + } + else if (plat->state == 2 || plat->state == 4) + { + if (plat->ctr == 0) + { destOrient = paddle->orientLoop; srcOrient = paddle->orient[paddle->countOrient - 1]; - } else { + } + else + { srcOrient = paddle->orient[plat->ctr - 1]; } - } else { + } + else + { return destOrient; } - + F32 absDelta = xabs(destOrient - srcOrient); - if (plat->state == 3 || plat->state == 4) { + if (plat->state == 3 || plat->state == 4) + { time[0] = 0.0f; time[1] = 0.2f; time[2] = 0.0f; - if (tmr >= 0.0f) { - if (tmr > 0.1f) tmr = 0.2f - tmr; + if (tmr >= 0.0f) + { + if (tmr > 0.1f) + tmr = 0.2f - tmr; F32 stutterAmount = 100.0f * tmr; - if (destOrient < srcOrient) stutterAmount = -stutterAmount; + if (destOrient < srcOrient) + stutterAmount = -stutterAmount; return destOrient + stutterAmount; } - + return destOrient; } - + F32 A = 0.0f; F32 D = 0.0f; F32 distA, distC, distD; - if (paddle->accelTime && paddle->decelTime) { + if (paddle->accelTime && paddle->decelTime) + { A = paddle->rotateSpeed / paddle->accelTime; D = paddle->rotateSpeed / paddle->decelTime; time[0] = xsqrt(2.0f * D * absDelta / (A * D + A * A)); - if (time[0] < paddle->accelTime) { + if (time[0] < paddle->accelTime) + { time[1] = 0.0f; time[2] = A * time[0] / D; - } else { + } + else + { distA = 0.5f * paddle->rotateSpeed * paddle->accelTime; distD = 0.5f * paddle->rotateSpeed * paddle->decelTime; distC = absDelta - distA - distD; @@ -321,54 +381,76 @@ static F32 SolvePaddleMotion(zPlatform* plat, F32* time, F32 tmr) time[1] = distC / paddle->rotateSpeed; time[2] = paddle->decelTime; } - } else if (paddle->accelTime) { + } + else if (paddle->accelTime) + { A = paddle->rotateSpeed / paddle->accelTime; time[0] = xsqrt(2.0f * absDelta / A); time[2] = 0.0f; - if (time[0] < paddle->accelTime) { + if (time[0] < paddle->accelTime) + { time[1] = 0.0f; - } else { + } + else + { distA = 0.5f * paddle->rotateSpeed * paddle->accelTime; distC = absDelta - distA; time[0] = paddle->accelTime; time[1] = distC / paddle->rotateSpeed; } - } else if (paddle->decelTime) { + } + else if (paddle->decelTime) + { D = paddle->rotateSpeed / paddle->decelTime; time[0] = 0.0f; time[2] = xsqrt(2.0f * absDelta / D); - if (time[2] < paddle->decelTime) { + if (time[2] < paddle->decelTime) + { time[1] = 0.0f; - } else { + } + else + { distD = 0.5f * paddle->rotateSpeed * paddle->decelTime; distC = absDelta - distD; time[1] = distC / paddle->rotateSpeed; time[2] = paddle->decelTime; } - } else { + } + else + { time[0] = 0.0f; time[1] = absDelta / paddle->rotateSpeed; time[2] = 0.0f; } - if (tmr >= 0.0f) { + if (tmr >= 0.0f) + { F32 lerp; - if (time[2] && tmr <= time[2]) { + if (time[2] && tmr <= time[2]) + { lerp = 1.0f - 0.5f * D * tmr * tmr / absDelta; - } else { + } + else + { F32 ttot = time[0] + time[1] + time[2]; tmr = ttot - tmr; - if (tmr > ttot) tmr = ttot; + if (tmr > ttot) + tmr = ttot; - if (time[0] && (!time[1] || tmr <= time[0])) { + if (time[0] && (!time[1] || tmr <= time[0])) + { lerp = 0.5f * A * tmr * tmr / absDelta; - } else { + } + else + { tmr -= time[0]; - lerp = (0.5f * paddle->rotateSpeed * paddle->accelTime + tmr * paddle->rotateSpeed) / absDelta; + lerp = + (0.5f * paddle->rotateSpeed * paddle->accelTime + tmr * paddle->rotateSpeed) / + absDelta; } } @@ -422,39 +504,47 @@ void zPlatform_PaddleStartRotate(xEnt* entplat, S32 direction, S32 stutter) plat->tmr = time[0] + time[1] + time[2]; } -U32 zPlatform_PaddleCollide(xCollis* coll, const xVec3* hitsource, const xVec3* hitvel, U32 worldSpaceNorm) +U32 zPlatform_PaddleCollide(xCollis* coll, const xVec3* hitsource, const xVec3* hitvel, + U32 worldSpaceNorm) { zPlatform* plat = (zPlatform*)coll->optr; - if (plat->state != 0) { + if (plat->state != 0) + { return 0; } xVec3 locnorm; - if (worldSpaceNorm) { + if (worldSpaceNorm) + { xMat3x3Tolocal(&locnorm, (xMat3x3*)plat->model->Mat, &coll->norm); - } else { + } + else + { locnorm = coll->norm; } xVec3 lochitsrc; xMat4x3Tolocal(&lochitsrc, (xMat4x3*)plat->model->Mat, hitsource); - + xVec3 lochitvel; xMat3x3Tolocal(&lochitvel, (xMat3x3*)plat->model->Mat, hitvel); - if (xabs(locnorm.y) > xabs(locnorm.x) && xabs(locnorm.y) > xabs(locnorm.z)) { + if (xabs(locnorm.y) > xabs(locnorm.x) && xabs(locnorm.y) > xabs(locnorm.z)) + { return 0; } - if (xabs(lochitvel.y) > xabs(lochitvel.x) && xabs(lochitvel.y) > xabs(lochitvel.z)) { + if (xabs(lochitvel.y) > xabs(lochitvel.x) && xabs(lochitvel.y) > xabs(lochitvel.z)) + { return 0; } xVec3Normalize(&locnorm, &locnorm); xVec3Normalize(&lochitvel, &lochitvel); - + F32 hitdot = xVec3Dot(&locnorm, &lochitvel); - if (hitdot > -0.7071f) { + if (hitdot > -0.7071f) + { return 0; } @@ -467,7 +557,7 @@ U32 zPlatform_PaddleCollide(xCollis* coll, const xVec3* hitsource, const xVec3* xMat4x3Toworld(&hitsrcbot, (xMat4x3*)plat->model->Mat, &hitsrcbot); xMat4x3Toworld(&hitsrctop, (xMat4x3*)plat->model->Mat, &hitsrctop); - + xRay3 hitsrcray; hitsrcray.origin.x = hitsrcbot.x; hitsrcray.origin.y = hitsrcbot.y; @@ -478,51 +568,70 @@ U32 zPlatform_PaddleCollide(xCollis* coll, const xVec3* hitsource, const xVec3* hitsrcray.min_t = 0.0f; hitsrcray.max_t = xVec3Normalize(&hitsrcray.dir, &hitsrcray.dir); hitsrcray.flags = XRAY3_USE_MIN | XRAY3_USE_MAX; - + xCollis hitsrccoll; xRayHitsBound(&hitsrcray, &plat->bound, &hitsrccoll); - if (!(hitsrccoll.flags & k_HIT_IT)) { + if (!(hitsrccoll.flags & k_HIT_IT)) + { return 0; } - + S32 posX, posZ, direction; - if (xabs(lochitvel.x) < xabs(lochitvel.z)) { + if (xabs(lochitvel.x) < xabs(lochitvel.z)) + { posX = (lochitsrc.x > 0.0f); posZ = (lochitsrc.z > 0.0f); - if ((posX ^ posZ) == 0) { + if ((posX ^ posZ) == 0) + { direction = 1; - } else { + } + else + { direction = -1; } - } else { + } + else + { posX = (lochitsrc.x > 0.0f); posZ = (lochitsrc.z > 0.0f); - if ((posX ^ posZ) == 0) { + if ((posX ^ posZ) == 0) + { direction = -1; - } else { + } + else + { direction = 1; } } S32 stutter = 0; - if (direction == 1) { + if (direction == 1) + { if (!(plat->passet->paddle.paddleFlags & 0x1) || - (!(plat->passet->paddle.paddleFlags & 0x4) && plat->ctr + 1 == plat->passet->paddle.countOrient)) { + (!(plat->passet->paddle.paddleFlags & 0x4) && + plat->ctr + 1 == plat->passet->paddle.countOrient)) + { stutter = 1; } } - if (direction == -1) { + if (direction == -1) + { if (!(plat->passet->paddle.paddleFlags & 0x2) || - (!(plat->passet->paddle.paddleFlags & 0x4) && plat->ctr == 0)) { + (!(plat->passet->paddle.paddleFlags & 0x4) && plat->ctr == 0)) + { stutter = 1; } } - if (!stutter) { - if (direction > 0) { + if (!stutter) + { + if (direction > 0) + { zEntEvent(plat, eEventHit_PaddleLeft); - } else { + } + else + { zEntEvent(plat, eEventHit_PaddleRight); } } @@ -534,235 +643,329 @@ U32 zPlatform_PaddleCollide(xCollis* coll, const xVec3* hitsource, const xVec3* static void zPlatFM_Update(zPlatform* plat, xScene*, F32 dt) { - for (S32 i = 0; i < 12; i++) { + for (S32 i = 0; i < 12; i++) + { zPlatFMRunTime* fmrt = plat->fmrt; - + F32 tm = fmrt->tmrs[i]; - if (tm > 0.0f) { + if (tm > 0.0f) + { F32 ttm = fmrt->ttms[i]; F32 atm = fmrt->atms[i]; F32 dtm = fmrt->dtms[i]; F32 vm = fmrt->vms[i]; - + F32 ds; F32 etm = ttm - tm; - - if (tm > atm) { - if (atm > 0.0f) { - if (tm - dt < atm) { - if (dtm > 0.0f) { - if (tm - dt < dtm) { - if (tm - dt < 0.0f) { + + if (tm > atm) + { + if (atm > 0.0f) + { + if (tm - dt < atm) + { + if (dtm > 0.0f) + { + if (tm - dt < dtm) + { + if (tm - dt < 0.0f) + { F32 p = ttm - atm; F32 cfacc = 0.5f * (p + etm) * (p - etm) / p; F32 cfcs = atm - dtm; F32 cfdec = 0.5f * dtm; ds = cfacc + cfcs + cfdec; - } else { + } + else + { F32 p = ttm - atm; F32 cfacc = 0.5f * (p + etm) * (p - etm) / p; F32 cfcs = atm - dtm; F32 cfdec = 0.5f * (dtm + (tm - dt)) * (dtm - (tm - dt)) / dtm; ds = cfacc + cfcs + cfdec; } - } else { + } + else + { F32 p = ttm - atm; F32 cfacc = 0.5f * (p + etm) * (p - etm) / p; F32 cfcs = atm - (tm - dt); ds = cfacc + cfcs; } - } else { - if (tm - dt < 0.0f) { + } + else + { + if (tm - dt < 0.0f) + { F32 p = ttm - atm; F32 cfacc = 0.5f * (p + etm) * (p - etm) / p; F32 cfcs = atm; ds = cfacc + cfcs; - } else { + } + else + { F32 p = ttm - atm; F32 cfacc = 0.5f * (p + etm) * (p - etm) / p; F32 cfcs = atm - (tm - dt); ds = cfacc + cfcs; } } - } else { + } + else + { F32 p = ttm - atm; ds = (etm + 0.5f * dt) * dt / p; } - } else { - if (tm - dt < 0.0f) { + } + else + { + if (tm - dt < 0.0f) + { ds = (etm + 0.5f * tm) * tm / ttm; - } else { + } + else + { ds = (etm + 0.5f * dt) * dt / ttm; } } - } else { - if (tm < dtm) { - if (tm - dt < 0.0f) { + } + else + { + if (tm < dtm) + { + if (tm - dt < 0.0f) + { ds = 0.5f * tm * tm / dtm; - } else { + } + else + { ds = (tm - 0.5f * dt) * dt / dtm; } - } else { - if (dtm > 0.0f) { - if (tm - dt < dtm) { - if (tm - dt < 0.0f) { + } + else + { + if (dtm > 0.0f) + { + if (tm - dt < dtm) + { + if (tm - dt < 0.0f) + { F32 cfcs = tm - dtm; F32 cfdec = 0.5f * dtm; ds = cfcs + cfdec; - } else { + } + else + { F32 cfcs = tm - dtm; F32 cfdec = 0.5f * (dtm + (tm - dt)) * (dtm - (tm - dt)) / dtm; ds = cfcs + cfdec; } - } else { + } + else + { ds = dt; } - } else { - if (tm - dt < 0.0f) { + } + else + { + if (tm - dt < 0.0f) + { ds = tm; - } else { + } + else + { ds = dt; } } } } - + ds *= vm; fmrt->dss[i] -= ds; - + xMat4x3* pmat = (xMat4x3*)plat->model->Mat; - - if (i == 0) { + + if (i == 0) + { F32 translx = pmat->right.x * ds; F32 transly = pmat->right.y * ds; F32 translz = pmat->right.z * ds; pmat->pos.x += translx; pmat->pos.y += transly; pmat->pos.z += translz; - } else if (i == 1) { + } + else if (i == 1) + { F32 translx = pmat->up.x * ds; F32 transly = pmat->up.y * ds; F32 translz = pmat->up.z * ds; pmat->pos.x += translx; pmat->pos.y += transly; pmat->pos.z += translz; - } else if (i == 2) { + } + else if (i == 2) + { F32 translx = pmat->at.x * ds; F32 transly = pmat->at.y * ds; F32 translz = pmat->at.z * ds; pmat->pos.x += translx; pmat->pos.y += transly; pmat->pos.z += translz; - } else if (i == 3) { + } + else if (i == 3) + { pmat->pos.x += ds; - } else if (i == 4) { + } + else if (i == 4) + { pmat->pos.y += ds; - } else if (i == 5) { + } + else if (i == 5) + { pmat->pos.z += ds; - } else if (i == 6) { + } + else if (i == 6) + { xMat3x3 preR; xMat3x3RotX(&preR, ds); xMat3x3Mul(pmat, &preR, pmat); - } else if (i == 7) { + } + else if (i == 7) + { xMat3x3 preR; xMat3x3RotY(&preR, ds); xMat3x3Mul(pmat, &preR, pmat); - } else if (i == 8) { + } + else if (i == 8) + { xMat3x3 preR; xMat3x3RotZ(&preR, ds); xMat3x3Mul(pmat, &preR, pmat); - } else if (i == 9) { + } + else if (i == 9) + { xMat3x3 postR; xMat3x3RotX(&postR, ds); xMat3x3Mul(pmat, pmat, &postR); - } else if (i == 10) { + } + else if (i == 10) + { xMat3x3 postR; xMat3x3RotY(&postR, ds); xMat3x3Mul(pmat, pmat, &postR); - } else if (i == 11) { + } + else if (i == 11) + { xMat3x3 postR; xMat3x3RotZ(&postR, ds); xMat3x3Mul(pmat, pmat, &postR); } - + fmrt->tmrs[i] -= dt; - if (fmrt->tmrs[i] < 0.0f) { + if (fmrt->tmrs[i] < 0.0f) + { F32 rts = xsqrt(SQR(pmat->right.x) + SQR(pmat->right.y) + SQR(pmat->right.z)); F32 ups = xsqrt(SQR(pmat->up.x) + SQR(pmat->up.y) + SQR(pmat->up.z)); F32 ats = xsqrt(SQR(pmat->at.x) + SQR(pmat->at.y) + SQR(pmat->at.z)); - + { F32 inv_t = 100.0f; - if (pmat->pos.x < 0.0f) { + if (pmat->pos.x < 0.0f) + { pmat->pos.x = 0.01f * (S32)(pmat->pos.x * inv_t - 0.5f); - } else { + } + else + { pmat->pos.x = 0.01f * (S32)(pmat->pos.x * inv_t + 0.5f); } - if (pmat->pos.y < 0.0f) { + if (pmat->pos.y < 0.0f) + { pmat->pos.y = 0.01f * (S32)(pmat->pos.y * inv_t - 0.5f); - } else { + } + else + { pmat->pos.y = 0.01f * (S32)(pmat->pos.y * inv_t + 0.5f); } - if (pmat->pos.z < 0.0f) { + if (pmat->pos.z < 0.0f) + { pmat->pos.z = 0.01f * (S32)(pmat->pos.z * inv_t - 0.5f); - } else { + } + else + { pmat->pos.z = 0.01f * (S32)(pmat->pos.z * inv_t + 0.5f); } } - + { F32 inv_t = 100.0f; - if (pmat->right.x < 0.0f) { + if (pmat->right.x < 0.0f) + { pmat->right.x = 0.01f * (S32)(pmat->right.x * inv_t - 0.5f); - } else { + } + else + { pmat->right.x = 0.01f * (S32)(pmat->right.x * inv_t + 0.5f); } - if (pmat->right.y < 0.0f) { + if (pmat->right.y < 0.0f) + { pmat->right.y = 0.01f * (S32)(pmat->right.y * inv_t - 0.5f); - } else { + } + else + { pmat->right.y = 0.01f * (S32)(pmat->right.y * inv_t + 0.5f); } - if (pmat->right.z < 0.0f) { + if (pmat->right.z < 0.0f) + { pmat->right.z = 0.01f * (S32)(pmat->right.z * inv_t - 0.5f); - } else { + } + else + { pmat->right.z = 0.01f * (S32)(pmat->right.z * inv_t + 0.5f); } } - + F32 len; xVec3NormalizeMacro(&pmat->right, &pmat->right, &len); - + { F32 inv_t = 100.0f; - if (pmat->up.x < 0.0f) { + if (pmat->up.x < 0.0f) + { pmat->up.x = 0.01f * (S32)(pmat->up.x * inv_t - 0.5f); - } else { + } + else + { pmat->up.x = 0.01f * (S32)(pmat->up.x * inv_t + 0.5f); } - if (pmat->up.y < 0.0f) { + if (pmat->up.y < 0.0f) + { pmat->up.y = 0.01f * (S32)(pmat->up.y * inv_t - 0.5f); - } else { + } + else + { pmat->up.y = 0.01f * (S32)(pmat->up.y * inv_t + 0.5f); } - if (pmat->up.z < 0.0f) { + if (pmat->up.z < 0.0f) + { pmat->up.z = 0.01f * (S32)(pmat->up.z * inv_t - 0.5f); - } else { + } + else + { pmat->up.z = 0.01f * (S32)(pmat->up.z * inv_t + 0.5f); } } - + xVec3NormalizeMacro(&pmat->up, &pmat->up, &len); - - F32 rdotu = -(pmat->right.x * pmat->up.x + - pmat->right.y * pmat->up.y + + + F32 rdotu = -(pmat->right.x * pmat->up.x + pmat->right.y * pmat->up.y + pmat->right.z * pmat->up.z); - + pmat->up.x += pmat->right.x * rdotu; pmat->up.y += pmat->right.y * rdotu; pmat->up.z += pmat->right.z * rdotu; - + xVec3NormalizeMacro(&pmat->up, &pmat->up, &len); - + pmat->at.x = pmat->right.y * pmat->up.z - pmat->up.y * pmat->right.z; pmat->at.y = pmat->right.z * pmat->up.x - pmat->up.z * pmat->right.x; pmat->at.z = pmat->right.x * pmat->up.y - pmat->up.x * pmat->right.y; @@ -775,7 +978,7 @@ static void zPlatFM_Update(zPlatform* plat, xScene*, F32 dt) pmat->at.x *= ats; pmat->at.y *= ats; pmat->at.z *= ats; - + fmrt->flags &= ~(1 << i); fmrt->tmrs[i] = 0.0f; fmrt->ttms[i] = 0.0f; @@ -783,7 +986,7 @@ static void zPlatFM_Update(zPlatform* plat, xScene*, F32 dt) fmrt->dtms[i] = 0.0f; fmrt->vms[i] = 0.0f; fmrt->dss[i] = 0.0f; - + zEntEvent(plat, plat, eEventTranslLocalXDone + i); } } @@ -794,45 +997,55 @@ void zPlatform_Update(xEnt* entplat, xScene* sc, F32 dt) { zPlatform* plat = (zPlatform*)entplat; - if (plat->subType != ePlatformTypeBreakaway) { + if (plat->subType != ePlatformTypeBreakaway) + { plat->pauseMult = CLAMP(plat->pauseMult + plat->pauseDelta, 0.000001f, 1.0f); dt *= plat->pauseMult; } - if (plat->subType == ePlatformTypeBreakaway) { + if (plat->subType == ePlatformTypeBreakaway) + { plat->model->Alpha += 4.0f * dt; - if (plat->model->Alpha > 1.0f) { + if (plat->model->Alpha > 1.0f) + { plat->model->Alpha = 1.0f; } } xEntUpdate(plat, sc, dt); - if (plat->subType == ePlatformTypeER) { + if (plat->subType == ePlatformTypeER) + { U16 state = plat->motion.er.state; - if (plat->state == state || - xEntERIsExtending(&plat->motion) || - xEntERIsExtended(&plat->motion) || - xEntERIsRetracting(&plat->motion) || - xEntERIsRetracted(&plat->motion)) { - // do nothing + if (plat->state == state || xEntERIsExtending(&plat->motion) || + xEntERIsExtended(&plat->motion) || xEntERIsRetracting(&plat->motion) || + xEntERIsRetracted(&plat->motion)) + { + // do nothing } plat->state = state; - } else if (plat->subType == ePlatformTypeBreakaway) { - if (plat->state == 1 && !zEntPlayer_IsSneaking()) { + } + else if (plat->subType == ePlatformTypeBreakaway) + { + if (plat->state == 1 && !zEntPlayer_IsSneaking()) + { plat->state = 2; - if (plat->passet->ba.ba_delay) { - zPlatform_Tremble(plat, 0.06f, 8*PI, 1.0f + plat->passet->ba.ba_delay); + if (plat->passet->ba.ba_delay) + { + zPlatform_Tremble(plat, 0.06f, 8 * PI, 1.0f + plat->passet->ba.ba_delay); } } - if (plat->state == 2) { + if (plat->state == 2) + { plat->tmr -= dt; - if (plat->tmr <= 0.0f) { + if (plat->tmr <= 0.0f) + { zPlatform_BreakawayFallFX(plat, dt); plat->state = 3; plat->pflags |= 0x6; plat->tmr = plat->passet->ba.reset_delay; - if (plat->bm) { + if (plat->bm) + { plat->model = plat->bm; plat->collModel = plat->model; xMat4x3Copy((xMat4x3*)plat->bm->Mat, (xMat4x3*)plat->am->Mat); @@ -840,88 +1053,123 @@ void zPlatform_Update(xEnt* entplat, xScene* sc, F32 dt) } zEntEvent(plat, eEventBreak); } - } else if (plat->state == 3) { + } + else if (plat->state == 3) + { plat->tmr -= dt; - if (plat->collis->colls[0].flags & k_HIT_IT) { + if (plat->collis->colls[0].flags & k_HIT_IT) + { plat->state = 4; - plat->pflags &= (U8)~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY); + plat->pflags &= (U8) ~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY); plat->collis->chk = 0; xVec3Copy(&plat->frame->vel, &g_O3); - } else if (plat->tmr <= 0.0f) { - if (xBaseIsEnabled(plat)) { + } + else if (plat->tmr <= 0.0f) + { + if (xBaseIsEnabled(plat)) + { zEntEvent(plat, eEventReset); - } else { + } + else + { zPlatform_Reset(plat, sc); } plat->model->Alpha = 0.0f; plat->model->PipeFlags = (plat->model->PipeFlags & ~0xC) | 0x8; - } else if (plat->passet->ba.reset_delay - plat->tmr >= 25.0f) { + } + else if (plat->passet->ba.reset_delay - plat->tmr >= 25.0f) + { plat->state = 5; - plat->pflags &= (U8)~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY); + plat->pflags &= (U8) ~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY); plat->collis->chk = 0; xVec3Copy(&plat->frame->vel, &g_O3); } - } else if (plat->state == 4) { + } + else if (plat->state == 4) + { plat->tmr -= dt; - if (plat->tmr <= 0.0f) { - if (xBaseIsEnabled(plat)) { + if (plat->tmr <= 0.0f) + { + if (xBaseIsEnabled(plat)) + { zEntEvent(plat, eEventReset); - } else { + } + else + { zPlatform_Reset(plat, sc); } plat->model->Alpha = 0.0f; plat->model->PipeFlags = (plat->model->PipeFlags & ~0xC) | 0x8; } } - } else if (plat->subType == ePlatformTypeMech) { + } + else if (plat->subType == ePlatformTypeMech) + { U16 state = plat->motion.mech.state; - if (state != plat->state) { + if (state != plat->state) + { xEntMotionMechData* mkasst = &plat->motion.asset->mech; - if (plat->state == 2) { + if (plat->state == 2) + { zEntEvent(plat, eEventArriveHalfway); - } else if (state == 6 || state == 7 || - (!(mkasst->flags & k_XENTMOTIONMECH_ONCE) && (state == 0 || state == 1))) { + } + else if (state == 6 || state == 7 || + (!(mkasst->flags & k_XENTMOTIONMECH_ONCE) && (state == 0 || state == 1))) + { zEntEvent(plat, eEventArrive); } - if (zMechIsStartingForth(plat, state) || - zMechIsStartingBack(plat, state)) { + if (zMechIsStartingForth(plat, state) || zMechIsStartingBack(plat, state)) + { // do nothing } plat->state = state; } - } else if (plat->subType == ePlatformTypeSpringboard) { + } + else if (plat->subType == ePlatformTypeSpringboard) + { plat->tmr -= dt; - } else if (plat->subType == ePlatformTypeConvBelt) { + } + else if (plat->subType == ePlatformTypeConvBelt) + { xEntDrive* drv = &globals.player.drv; - if (plat == drv->odriver || plat == drv->driver) { + if (plat == drv->odriver || plat == drv->driver) + { F32 s = (plat == drv->driver) ? drv->s : drv->os; xEnt* p = drv->driven; - xVec3SMul(&p->frame->dpos, &xModelGetFrame(plat->model)->right, s * plat->passet->cb.speed * dt); + xVec3SMul(&p->frame->dpos, &xModelGetFrame(plat->model)->right, + s * plat->passet->cb.speed * dt); xVec3AddTo((xVec3*)&p->model->Mat->pos, &p->frame->dpos); } - } else if (plat->subType == ePlatformTypeTeeter) { + } + else if (plat->subType == ePlatformTypeTeeter) + { xEntDrive* drv = &globals.player.drv; - if (plat != drv->odriver && plat != drv->driver) { + if (plat != drv->odriver && plat != drv->driver) + { F32 ctilt = plat->frame->rot.axis.z; F32 itilt = plat->asset->ang.z; F32 dtilt = xabs(DEG2RAD(plat->passet->teet.invmass) * dt); - if (ctilt != itilt) { - if (ctilt < itilt) { + if (ctilt != itilt) + { + if (ctilt < itilt) + { dtilt = MIN(dtilt, itilt - ctilt); - } else if (ctilt > itilt) { + } + else if (ctilt > itilt) + { dtilt = MAX(-dtilt, itilt - ctilt); } plat->frame->rot.axis.z += dtilt; - xMat3x3Euler((xMat3x3*)plat->model->Mat, - plat->frame->rot.axis.x, - plat->frame->rot.axis.y, - plat->frame->rot.axis.z); + xMat3x3Euler((xMat3x3*)plat->model->Mat, plat->frame->rot.axis.x, + plat->frame->rot.axis.y, plat->frame->rot.axis.z); xVec3* scale = &plat->asset->scale; xVec3SMulBy((xVec3*)&plat->model->Mat->right, scale->x); xVec3SMulBy((xVec3*)&plat->model->Mat->up, scale->y); xVec3SMulBy((xVec3*)&plat->model->Mat->at, scale->z); } - } else { + } + else + { F32 s = (plat == drv->driver) ? drv->s : drv->os; xEnt* p = drv->driven; xVec3 lpos; @@ -931,24 +1179,29 @@ void zPlatform_Update(xEnt* entplat, xScene* sc, F32 dt) F32 mangle = xabs(plat->passet->teet.maxtilt); F32 eangle = dangle + cangle; F32 tangle = xabs(eangle) - mangle; - if (tangle > 0.0f) { - if (dangle < 0.0f) dangle += tangle; - else if (dangle > 0.0f) dangle -= tangle; + if (tangle > 0.0f) + { + if (dangle < 0.0f) + dangle += tangle; + else if (dangle > 0.0f) + dangle -= tangle; } plat->frame->rot.axis.z += dangle; - xMat3x3Euler((xMat3x3*)plat->model->Mat, - plat->frame->rot.axis.x, - plat->frame->rot.axis.y, - plat->frame->rot.axis.z); + xMat3x3Euler((xMat3x3*)plat->model->Mat, plat->frame->rot.axis.x, + plat->frame->rot.axis.y, plat->frame->rot.axis.z); xVec3* scale = &plat->asset->scale; xVec3SMulBy((xVec3*)&plat->model->Mat->right, scale->x); xVec3SMulBy((xVec3*)&plat->model->Mat->up, scale->y); xVec3SMulBy((xVec3*)&plat->model->Mat->at, scale->z); } - } else if (plat->subType == ePlatformTypePaddle) { - if (plat->tmr) { + } + else if (plat->subType == ePlatformTypePaddle) + { + if (plat->tmr) + { plat->tmr -= dt; - if (plat->tmr < 0.0f) { + if (plat->tmr < 0.0f) + { plat->tmr = 0.0f; plat->state = 0; } @@ -964,15 +1217,20 @@ void zPlatform_Update(xEnt* entplat, xScene* sc, F32 dt) xVec3SMulBy((xVec3*)&plat->model->Mat->up, scale->y); xVec3SMulBy((xVec3*)&plat->model->Mat->at, scale->z); } - } else if (plat->subType == ePlatformTypeFM) { - if (!(plat->plat_flags & 0x4)) { + } + else if (plat->subType == ePlatformTypeFM) + { + if (!(plat->plat_flags & 0x4)) + { zPlatFM_Update(plat, sc, dt); } } - if (plat->motion.type == k_XENTMOTIONTYPE_MP) { + if (plat->motion.type == k_XENTMOTIONTYPE_MP) + { xMovePoint* src = plat->motion.mp.src; - if (src != plat->src) { + if (src != plat->src) + { zEntEvent(plat, src, eEventArrive); plat->src = src; } @@ -983,31 +1241,49 @@ void zPlatform_Update(xEnt* entplat, xScene* sc, F32 dt) xVec3* pos = &plat->frame->mat.pos; xVec3* orot = &plat->frame->oldrot.axis; xVec3* rot = &plat->frame->rot.axis; - if (plat->subType == ePlatformTypeTeeter) { - if (orot->x != rot->x || orot->y != rot->y || orot->z != rot->z) { + if (plat->subType == ePlatformTypeTeeter) + { + if (orot->x != rot->x || orot->y != rot->y || orot->z != rot->z) + { moving = TRUE; - } else { + } + else + { moving = FALSE; } - } else if (plat->subType == ePlatformTypePaddle) { - if (plat->tmr != 0.0f) { + } + else if (plat->subType == ePlatformTypePaddle) + { + if (plat->tmr != 0.0f) + { moving = TRUE; - } else { + } + else + { moving = FALSE; } - } else { - if (opos->x != pos->x || opos->y != pos->y || opos->z != pos->z || - orot->x != rot->x || orot->y != rot->y || orot->z != rot->z) { + } + else + { + if (opos->x != pos->x || opos->y != pos->y || opos->z != pos->z || orot->x != rot->x || + orot->y != rot->y || orot->z != rot->z) + { moving = TRUE; - } else { + } + else + { moving = FALSE; } } - if (moving != plat->moving) { - if (moving) { + if (moving != plat->moving) + { + if (moving) + { zEntEvent(plat, eEventStartMoving); - } else { + } + else + { zEntEvent(plat, eEventStopMoving); } } @@ -1101,20 +1377,25 @@ void zPlatform_BreakawayFallFX(zPlatform* ent, F32 dt) info.pos.y += 0.5f; for (S32 iVar2 = 0; iVar2 < 25; iVar2++) { - xParEmitterEmitCustom(sEmitBreakaway, 1/30.f, &info); + xParEmitterEmitCustom(sEmitBreakaway, 1 / 30.f, &info); } } } void zPlatform_Mount(zPlatform* plat) { - if (plat->subType == ePlatformTypeBreakaway && plat->state == 0) { - if ((plat->passet->ba.breakflags & 0x1) && zEntPlayer_IsSneaking()) { + if (plat->subType == ePlatformTypeBreakaway && plat->state == 0) + { + if ((plat->passet->ba.breakflags & 0x1) && zEntPlayer_IsSneaking()) + { plat->state = 1; - } else { + } + else + { plat->state = 2; - if (plat->passet->ba.ba_delay) { - zPlatform_Tremble(plat, 0.06f, 8*PI, 1.0f + plat->passet->ba.ba_delay); + if (plat->passet->ba.ba_delay) + { + zPlatform_Tremble(plat, 0.06f, 8 * PI, 1.0f + plat->passet->ba.ba_delay); } } } @@ -1187,122 +1468,146 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB { zPlatform* plat = (zPlatform*)to; - switch (toEvent) { + switch (toEvent) + { case eEventOn: - if (!(plat->plat_flags & 0x1)) { + if (!(plat->plat_flags & 0x1)) + { plat->plat_flags |= 0x1; } break; case eEventOff: - if (plat->plat_flags & 0x1) { + if (plat->plat_flags & 0x1) + { plat->plat_flags &= ~0x1; } break; case eEventToggle: - if (plat->plat_flags & 0x1) { + if (plat->plat_flags & 0x1) + { plat->plat_flags &= ~0x1; - } else { + } + else + { plat->plat_flags |= 0x1; } break; case eEventRun: - if (plat->subType == ePlatformTypeBreakaway) { - if (plat->state == 0 || plat->state == 1) { + if (plat->subType == ePlatformTypeBreakaway) + { + if (plat->state == 0 || plat->state == 1) + { plat->state = 2; - if (plat->passet->ba.ba_delay) { - zPlatform_Tremble(plat, 0.06f, 8*PI, 1.0f + plat->passet->ba.ba_delay); + if (plat->passet->ba.ba_delay) + { + zPlatform_Tremble(plat, 0.06f, 8 * PI, 1.0f + plat->passet->ba.ba_delay); } } - } else if (plat->subType == ePlatformTypeFM) { + } + else if (plat->subType == ePlatformTypeFM) + { plat->plat_flags &= (U16)~0x4; - } else if (plat->subType == ePlatformTypePaddle) { + } + else if (plat->subType == ePlatformTypePaddle) + { S32 iParam0 = (S32)toParam[0]; - if (iParam0) { + if (iParam0) + { if (plat->state == 0 && ((plat->passet->paddle.paddleFlags & 0x4) || - !((iParam0 < 0) ? (plat->ctr == 0) : (plat->ctr + 1 == plat->passet->paddle.countOrient)))) { + !((iParam0 < 0) ? (plat->ctr == 0) : + (plat->ctr + 1 == plat->passet->paddle.countOrient)))) + { zPlatform_PaddleStartRotate(plat, iParam0, (S32)toParam[1]); } - } else { + } + else + { S32 destctr = (S32)toParam[1]; - if (destctr >= 0 && destctr < plat->passet->paddle.countOrient) { + if (destctr >= 0 && destctr < plat->passet->paddle.countOrient) + { plat->tmr = 1e-9f; plat->state = 2; plat->ctr = destctr; } } - } else { - if (plat->subType == ePlatformTypeMech && - globals.sceneCur->sceneID == 'PG12' && + } + else + { + if (plat->subType == ePlatformTypeMech && globals.sceneCur->sceneID == 'PG12' && (plat->asset->modelInfoID == xStrHash("skatepark_bumper") || - plat->asset->modelInfoID == xStrHash("skatepark_flipper"))) { - if (plat->asset->modelInfoID != xStrHash("skatepark_flipper")) { - xScrFXGlareAdd((xVec3*)&plat->model->Mat->pos, - 0.5f * xurand() + 0.5f, - 0.5f * xurand() + 0.5f, - 4.0f * xurand() + 3.0f, - 1.0f, 0.7f, 0.5f, 1.0f, - NULL); - xScrFXGlareAdd((xVec3*)&plat->model->Mat->pos, - 0.5f * xurand(), - 0.8f * xurand(), - 3.0f + xurand(), - xurand(), xurand(), xurand(), 1.0f, - NULL); + plat->asset->modelInfoID == xStrHash("skatepark_flipper"))) + { + if (plat->asset->modelInfoID != xStrHash("skatepark_flipper")) + { + xScrFXGlareAdd((xVec3*)&plat->model->Mat->pos, 0.5f * xurand() + 0.5f, + 0.5f * xurand() + 0.5f, 4.0f * xurand() + 3.0f, 1.0f, 0.7f, 0.5f, + 1.0f, NULL); + xScrFXGlareAdd((xVec3*)&plat->model->Mat->pos, 0.5f * xurand(), 0.8f * xurand(), + 3.0f + xurand(), xurand(), xurand(), xurand(), 1.0f, NULL); } - xSndPlay3D(xStrHash("Check1"), 0.77f, 0.0f, 128, 0, - (xVec3*)&plat->model->Mat->pos, 0.0f, - SND_CAT_GAME, 0.0f); - zRumbleStartDistance(globals.currentActivePad, - 10.0f * xurand(), 48.0f, + xSndPlay3D(xStrHash("Check1"), 0.77f, 0.0f, 128, 0, (xVec3*)&plat->model->Mat->pos, + 0.0f, SND_CAT_GAME, 0.0f); + zRumbleStartDistance(globals.currentActivePad, 10.0f * xurand(), 48.0f, eRumble_Medium, 0.35f); } if (plat->subType == ePlatformTypeMech && - (plat->motion.mech.state == 6 || plat->motion.mech.state == 7)) { + (plat->motion.mech.state == 6 || plat->motion.mech.state == 7)) + { xEntMotionReset(&plat->motion, globals.sceneCur); } xEntMotionRun(&plat->motion); } break; case eEventStop: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { plat->plat_flags |= 0x4; - } else { + } + else + { xEntMotionStop(&plat->motion); } break; case eEventTranslLocalX: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { zPlatFM_EventSetup(plat, toParam, 0); } break; case eEventTranslLocalY: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { zPlatFM_EventSetup(plat, toParam, 1); } break; case eEventTranslLocalZ: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { zPlatFM_EventSetup(plat, toParam, 2); } break; case eEventTranslWorldX: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { zPlatFM_EventSetup(plat, toParam, 3); } break; case eEventTranslWorldY: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { zPlatFM_EventSetup(plat, toParam, 4); } break; case eEventTranslWorldZ: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { zPlatFM_EventSetup(plat, toParam, 5); } break; case eEventRotLocalX: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { F32 tp[4]; tp[0] = DEG2RAD(toParam[0]); tp[1] = toParam[1]; @@ -1312,7 +1617,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB } break; case eEventRotLocalY: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { F32 tp[4]; tp[0] = DEG2RAD(toParam[0]); tp[1] = toParam[1]; @@ -1322,7 +1628,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB } break; case eEventRotLocalZ: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { F32 tp[4]; tp[0] = DEG2RAD(toParam[0]); tp[1] = toParam[1]; @@ -1332,7 +1639,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB } break; case eEventRotWorldX: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { F32 tp[4]; tp[0] = DEG2RAD(toParam[0]); tp[1] = toParam[1]; @@ -1342,7 +1650,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB } break; case eEventRotWorldY: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { F32 tp[4]; tp[0] = DEG2RAD(toParam[0]); tp[1] = toParam[1]; @@ -1352,7 +1661,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB } break; case eEventRotWorldZ: - if (plat->subType == ePlatformTypeFM) { + if (plat->subType == ePlatformTypeFM) + { F32 tp[4]; tp[0] = DEG2RAD(toParam[0]); tp[1] = toParam[1]; @@ -1362,12 +1672,14 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB } break; case eEventForward: - if (plat->subType == ePlatformTypeMech) { + if (plat->subType == ePlatformTypeMech) + { xEntMechForward(&plat->motion); } break; case eEventReverse: - if (plat->subType == ePlatformTypeMech) { + if (plat->subType == ePlatformTypeMech) + { xEntMechReverse(&plat->motion); } break; @@ -1377,20 +1689,23 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB case eEventVisible: case eEventFastVisible: xEntShow(plat); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOn(*plat, toParam[1], toParam[2]); } break; case eEventInvisible: case eEventFastInvisible: xEntHide(plat); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOff(*plat, toParam[1], toParam[2]); } break; case eEventCollision_Visible_On: xEntShow(plat); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOn(*plat, toParam[1], toParam[2]); } // fallthrough @@ -1400,7 +1715,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB break; case eEventCollision_Visible_Off: xEntHide(plat); - if (toParam && (S32)(0.5f + toParam[0]) == 77) { + if (toParam && (S32)(0.5f + toParam[0]) == 77) + { zFXPopOff(*plat, toParam[1], toParam[2]); } // fallthrough @@ -1424,12 +1740,14 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB zEntAnimEvent(plat, toEvent, toParam); break; case eEventSetSpeed: - if (plat->subType == ePlatformTypeMP) { + if (plat->subType == ePlatformTypeMP) + { xEntMPSetSpeed(&plat->motion, toParam[0]); } break; case eEventAccelerate: - if (plat->subType == ePlatformTypeMP) { + if (plat->subType == ePlatformTypeMP) + { xEntMPAccelerate(&plat->motion, toParam[0]); } break; @@ -1449,24 +1767,32 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB zFXGooEventMelt(plat); break; case eEventMount: - if (toParamWidget) { + if (toParamWidget) + { F32 mt = 0.00001f; - if (toParam[0]) mt = toParam[0]; + if (toParam[0]) + mt = toParam[0]; xEntDriveMount(&plat->drv, (xEnt*)toParamWidget, mt, NULL); } break; case eEventDismount: - if (toParamWidget) { + if (toParamWidget) + { F32 mt = 0.00001f; - if (toParam[0]) mt = toParam[0]; + if (toParam[0]) + mt = toParam[0]; xEntDriveDismount(&plat->drv, mt); } break; case eEventSetUpdateDistance: - if (globals.updateMgr) { - if (toParam[0] <= 0.0f) { + if (globals.updateMgr) + { + if (toParam[0] <= 0.0f) + { xUpdateCull_SetCB(globals.updateMgr, plat, xUpdateCull_AlwaysTrueCB, NULL); - } else { + } + else + { FloatAndVoid dist; dist.f = SQR(toParam[0]); xUpdateCull_SetCB(globals.updateMgr, plat, xUpdateCull_DistanceSquaredCB, dist.v); @@ -1476,7 +1802,8 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB case eEventLaunchShrapnel: { zShrapnelAsset* shrap = (zShrapnelAsset*)toParamWidget; - if (shrap && shrap->initCB) { + if (shrap && shrap->initCB) + { xVec3 currVel; xVec3Sub(&currVel, &plat->frame->mat.pos, &plat->frame->oldmat.pos); xVec3SMulBy(&currVel, 1.0f / globals.update_dt); @@ -1485,21 +1812,29 @@ S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xB break; } case eEventPlatPause: - if (plat->subType != ePlatformTypeBreakaway) { - if (toParam[0] == 0.0f) { + if (plat->subType != ePlatformTypeBreakaway) + { + if (toParam[0] == 0.0f) + { plat->pauseMult = 0.000001f; plat->pauseDelta = 0.0f; - } else { + } + else + { plat->pauseDelta = -1.0f / toParam[0]; } } break; case eEventPlatUnpause: - if (plat->subType != ePlatformTypeBreakaway) { - if (toParam[0] == 0.0f) { + if (plat->subType != ePlatformTypeBreakaway) + { + if (toParam[0] == 0.0f) + { plat->pauseMult = 1.0f; plat->pauseDelta = 0.0f; - } else { + } + else + { plat->pauseDelta = 1.0f / toParam[0]; } } diff --git a/src/SB/Game/zPlatform.h b/src/SB/Game/zPlatform.h index 1c1fcb926..96ee167f7 100644 --- a/src/SB/Game/zPlatform.h +++ b/src/SB/Game/zPlatform.h @@ -2,8 +2,9 @@ #define ZPLATFORM_H #include "zEnt.h" -#include "xEntMotion.h" + #include "xEntDrive.h" +#include "xEntMotion.h" enum en_ZPLATFORMTYPE { diff --git a/src/SB/Game/zPortal.cpp b/src/SB/Game/zPortal.cpp index 8ac82daf1..c5f49d132 100644 --- a/src/SB/Game/zPortal.cpp +++ b/src/SB/Game/zPortal.cpp @@ -1,10 +1,11 @@ -#include "xBase.h" -#include "xEvent.h" - #include "zPortal.h" + #include "zGlobals.h" #include "zScene.h" +#include "xBase.h" +#include "xEvent.h" + extern zGlobals globals; void zPortalInit(void* portal, void* passet) diff --git a/src/SB/Game/zRenderState.cpp b/src/SB/Game/zRenderState.cpp index 25c4b38b6..4f114a5db 100644 --- a/src/SB/Game/zRenderState.cpp +++ b/src/SB/Game/zRenderState.cpp @@ -1,9 +1,8 @@ #include "zRenderState.h" -#include "rwsdk/rwplcore.h" - #include "iCamera.h" +#include "rwsdk/rwplcore.h" #include volatile _SDRenderState sRS; diff --git a/src/SB/Game/zRumble.cpp b/src/SB/Game/zRumble.cpp index 17590cf10..5c4e181ac 100644 --- a/src/SB/Game/zRumble.cpp +++ b/src/SB/Game/zRumble.cpp @@ -1,9 +1,10 @@ -#include "xPad.h" -#include "xMath.h" - #include "zRumble.h" + #include "zGlobals.h" +#include "xMath.h" +#include "xPad.h" + #include void zRumbleStart(S32 pad_id, _tagSDRumbleType rumble_type, xEnt* ent) diff --git a/src/SB/Game/zRumble.h b/src/SB/Game/zRumble.h index 4c794635d..28bfe65e8 100644 --- a/src/SB/Game/zRumble.h +++ b/src/SB/Game/zRumble.h @@ -1,10 +1,11 @@ #ifndef ZRUMBLE_H #define ZRUMBLE_H -#include #include "xEnt.h" #include "xPad.h" +#include + enum _tagSDRumbleType { SDR_None, diff --git a/src/SB/Game/zSaveLoad.cpp b/src/SB/Game/zSaveLoad.cpp index 5347c233d..c815ff018 100644 --- a/src/SB/Game/zSaveLoad.cpp +++ b/src/SB/Game/zSaveLoad.cpp @@ -1,24 +1,25 @@ #include "zSaveLoad.h" -#include -#include -#include - -#include "iSystem.h" - -#include "zUI.h" -#include "zGlobals.h" -#include "zGameState.h" -#include "zHud.h" #include "zCamera.h" #include "zGame.h" -#include "xParMgr.h" +#include "zGameState.h" +#include "zGlobals.h" +#include "zHud.h" +#include "zUI.h" + #include "xCutscene.h" #include "xDebug.h" +#include "xParMgr.h" #include "xString.h" #include "xTRC.h" #include "xutil.h" +#include "iSystem.h" + +#include +#include +#include + zSaveLoadGame zSaveLoadGameTable[3]; U32 saveSuccess; diff --git a/src/SB/Game/zSaveLoad.h b/src/SB/Game/zSaveLoad.h index dccce1578..64fa8d30a 100644 --- a/src/SB/Game/zSaveLoad.h +++ b/src/SB/Game/zSaveLoad.h @@ -1,8 +1,9 @@ #ifndef ZSAVELOAD_H #define ZSAVELOAD_H -#include #include "xsavegame.h" + +#include struct st_XSAVEGAME_DATA; struct zSaveLoadGame @@ -21,7 +22,6 @@ struct zSaveLoadUI char* name; }; - extern zSaveLoadGame zSaveLoadGameTable[3]; void zUpdateThumbIcon(); @@ -68,7 +68,7 @@ S32 zSaveLoad_CardCheckSpaceSingle(S32 cardNumber); S32 zSaveLoad_CardCheckGamesSingle_doCheck(st_XSAVEGAME_DATA* xsgdata, S32 cardNumber); S32 zSaveLoad_CardCheckGamesSingle(S32 cardNumber); S32 zSaveLoad_CardCheckSlotEmpty_hasGame_doCheck(st_XSAVEGAME_DATA* xsgdata, S32 cardNumber, - S32 gameNumber); + S32 gameNumber); S32 zSaveLoad_CardCheckSlotEmpty_hasGame(S32 cardNumber, S32 gameNumber); S32 zSaveLoad_CardCheckSlotOverwrite_Free(S32 cardNumber, S32 gameNumber); S32 zSaveLoad_CardCheck(S32 cardNumber, S32 mode); @@ -96,10 +96,10 @@ S32 xSGT_SaveInfoCB(void* vp, st_XSAVEGAME_DATA* xsgdata, S32* need, S32* most); S32 xSGT_SaveProcCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt); S32 xSGT_SaveInfoPrefsCB(void* p1, st_XSAVEGAME_DATA* data, S32* i, S32* j); S32 xSGT_SaveProcPrefsCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt); -S32 xSGT_LoadLoadCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, - U32 ui, S32 i); -S32 xSGT_LoadPrefsCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, - U32 ui, S32 i); +S32 xSGT_LoadLoadCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32 ui, + S32 i); +S32 xSGT_LoadPrefsCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32 ui, + S32 i); U32 zSaveLoad_slotIsEmpty(U32 slot); #endif diff --git a/src/SB/Game/zScene.cpp b/src/SB/Game/zScene.cpp index 1aa7485af..4b4149594 100644 --- a/src/SB/Game/zScene.cpp +++ b/src/SB/Game/zScene.cpp @@ -1,107 +1,108 @@ #include "zScene.h" -#include "zEntTrigger.h" -#include "zMovePoint.h" -#include "zEntPickup.h" -#include "zEntSimpleObj.h" -#include "zPlatform.h" -#include "zPendulum.h" -#include "zEntHangable.h" -#include "zEntDestructObj.h" -#include "zEntButton.h" -#include "zPortal.h" +#include "zActionLine.h" +#include "zAnimList.h" +#include "zAssetTypes.h" +#include "zBusStop.h" #include "zCamMarker.h" -#include "zGust.h" -#include "zVolume.h" +#include "zCameraFly.h" +#include "zCameraTweak.h" +#include "zCollGeom.h" +#include "zCombo.h" #include "zConditional.h" -#include "zEnv.h" -#include "zUI.h" -#include "zUIFont.h" -#include "zLight.h" #include "zCutsceneMgr.h" -#include "zEGenerator.h" -#include "zScript.h" #include "zDiscoFloor.h" -#include "zEntTeleportBox.h" -#include "zBusStop.h" -#include "zTextBox.h" -#include "zTalkBox.h" -#include "zTaskBox.h" -#include "zTaxi.h" -#include "zEntPlayerBungeeState.h" -#include "zCameraFly.h" -#include "zCameraTweak.h" -#include "zNPCMgr.h" -#include "zGlobals.h" #include "zDispatcher.h" -#include "zThrown.h" -#include "zGrid.h" +#include "zEGenerator.h" +#include "zEntButton.h" +#include "zEntCruiseBubble.h" +#include "zEntDestructObj.h" +#include "zEntHangable.h" +#include "zEntPickup.h" +#include "zEntPlayerBungeeState.h" +#include "zEntPlayerOOBState.h" +#include "zEntSimpleObj.h" +#include "zEntTeleportBox.h" +#include "zEntTrigger.h" +#include "zEnv.h" #include "zFX.h" -#include "zSurface.h" -#include "zGoo.h" -#include "zParPTank.h" -#include "zAnimList.h" -#include "zParSys.h" -#include "zRenderState.h" +#include "zFeet.h" #include "zGame.h" -#include "zNPCGlyph.h" -#include "zNPCHazard.h" -#include "zEntPlayerOOBState.h" -#include "zActionLine.h" +#include "zGameExtras.h" #include "zGameState.h" -#include "zEntCruiseBubble.h" +#include "zGlobals.h" +#include "zGoo.h" +#include "zGrid.h" +#include "zGust.h" #include "zHud.h" -#include "zMenu.h" -#include "zNPCTypeBossSandy.h" -#include "zNPCTypeBossPatrick.h" -#include "zCombo.h" #include "zLOD.h" +#include "zLight.h" +#include "zMenu.h" +#include "zMovePoint.h" #include "zMusic.h" +#include "zNPCGlyph.h" +#include "zNPCHazard.h" +#include "zNPCMgr.h" +#include "zNPCTypeBossPatrick.h" +#include "zNPCTypeBossSandy.h" #include "zNPCTypeTiki.h" -#include "zGameExtras.h" -#include "zCollGeom.h" -#include "zFeet.h" #include "zParCmd.h" -#include "zAssetTypes.h" +#include "zParPTank.h" +#include "zParSys.h" +#include "zPendulum.h" +#include "zPlatform.h" +#include "zPortal.h" +#include "zRenderState.h" +#include "zScript.h" +#include "zSurface.h" +#include "zTalkBox.h" +#include "zTaskBox.h" +#include "zTaxi.h" +#include "zTextBox.h" +#include "zThrown.h" +#include "zUI.h" +#include "zUIFont.h" +#include "zVolume.h" -#include "xNPCBasic.h" -#include "xString.h" -#include "xstransvc.h" +#include "xCM.h" +#include "xCounter.h" +#include "xDecal.h" #include "xDynAsset.h" -#include "xParSys.h" -#include "xParEmitter.h" #include "xEntBoulder.h" -#include "xTimer.h" -#include "xCounter.h" -#include "xSFX.h" -#include "xGroup.h" -#include "xSurface.h" +#include "xFX.h" #include "xFog.h" -#include "xHudModel.h" +#include "xGroup.h" #include "xHudFontMeter.h" -#include "xHudUnitMeter.h" +#include "xHudModel.h" #include "xHudText.h" -#include "iModel.h" -#include "xutil.h" +#include "xHudUnitMeter.h" +#include "xMarkerAsset.h" +#include "xMath.h" +#include "xMathInlines.h" #include "xModelBucket.h" -#include "xFX.h" -#include "xDecal.h" -#include "xPtankPool.h" -#include "xSystem.h" -#include "xSkyDome.h" -#include "xShadow.h" +#include "xNPCBasic.h" +#include "xParEmitter.h" #include "xParMgr.h" +#include "xParSys.h" +#include "xPartition.h" +#include "xPtankPool.h" +#include "xSFX.h" #include "xScrFx.h" +#include "xShadow.h" +#include "xSkyDome.h" +#include "xString.h" +#include "xSurface.h" +#include "xSystem.h" #include "xTRC.h" -#include "xCM.h" -#include "xMath.h" +#include "xTimer.h" +#include "xstransvc.h" +#include "xutil.h" + #include "iMath.h" -#include "xMarkerAsset.h" -#include "xPartition.h" -#include "xMathInlines.h" +#include "iModel.h" -#include #include +#include U8 HACK_BASETYPE; static S32 bytesNeeded; diff --git a/src/SB/Game/zScene.h b/src/SB/Game/zScene.h index 142bcd747..4fbb9c4ff 100644 --- a/src/SB/Game/zScene.h +++ b/src/SB/Game/zScene.h @@ -1,13 +1,13 @@ #ifndef ZSCENE_H #define ZSCENE_H -#include "xScene.h" -#include "xClimate.h" - -#include "zPortal.h" +#include "zBase.h" #include "zEnt.h" #include "zEnv.h" -#include "zBase.h" +#include "zPortal.h" + +#include "xClimate.h" +#include "xScene.h" struct zEnt; diff --git a/src/SB/Game/zScript.cpp b/src/SB/Game/zScript.cpp index 7be166a59..b50cda581 100644 --- a/src/SB/Game/zScript.cpp +++ b/src/SB/Game/zScript.cpp @@ -1,10 +1,10 @@ -#include "xBase.h" - -#include "xEvent.h" - #include "zScript.h" -#include "zScene.h" + #include "zGlobals.h" +#include "zScene.h" + +#include "xBase.h" +#include "xEvent.h" #include diff --git a/src/SB/Game/zScript.h b/src/SB/Game/zScript.h index 034acad2c..ca274cc22 100644 --- a/src/SB/Game/zScript.h +++ b/src/SB/Game/zScript.h @@ -1,10 +1,11 @@ #ifndef ZSCRIPT_H #define ZSCRIPT_H -#include #include "xBase.h" #include "xDynAsset.h" +#include + struct xScriptEventAsset { F32 time; diff --git a/src/SB/Game/zShrapnel.cpp b/src/SB/Game/zShrapnel.cpp index 9e08c04aa..064dafdd4 100644 --- a/src/SB/Game/zShrapnel.cpp +++ b/src/SB/Game/zShrapnel.cpp @@ -1,14 +1,16 @@ -#include -#include "iModel.h" +#include "zShrapnel.h" + +#include "zGlobals.h" +#include "zLightning.h" #include "xColor.h" #include "xMathInlines.h" #include "xSnd.h" #include "xstransvc.h" -#include "zGlobals.h" -#include "zShrapnel.h" -#include "zLightning.h" +#include "iModel.h" + +#include static xMat4x3 tmpMat; static zFrag sFragPool[150]; diff --git a/src/SB/Game/zShrapnel.h b/src/SB/Game/zShrapnel.h index afdc81ec1..b58c073fe 100644 --- a/src/SB/Game/zShrapnel.h +++ b/src/SB/Game/zShrapnel.h @@ -1,16 +1,16 @@ #ifndef ZSHRAPNEL_H #define ZSHRAPNEL_H +#include "zLightning.h" +#include "zParEmitter.h" + +#include "xCollide.h" +#include "xCurveAsset.h" #include "xModel.h" #include "xParEmitter.h" -#include "xCurveAsset.h" -#include "xCollide.h" -#include "zParEmitter.h" -#include "zLightning.h" - -#include #include +#include typedef struct zFrag; typedef struct zShrapnelAsset; @@ -217,7 +217,7 @@ struct zShrapnelAsset struct zShrapnelInitTable { char* name; - void (*initCB)(zShrapnelAsset*, xModelInstance*, xVec3*, void(*)(zFrag*, zFragAsset*)); + void (*initCB)(zShrapnelAsset*, xModelInstance*, xVec3*, void (*)(zFrag*, zFragAsset*)); U32 ID; }; @@ -238,7 +238,8 @@ void zShrapnel_SetShrapnelAssetInitCB(zShrapnelAsset* sasset); void zShrapnel_Update(F32 dt); void zShrapnel_Reset(); void zShrapnel_Render(); -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*)); void zFragLoc_Setup(zFragLocation* loc, xModelInstance* parent); void zFragLoc_InitDir(zFragLocation* loc, xVec3* vec, xModelInstance* parent); void zFrag_DefaultInit(zFrag* frag, zFragAsset* fasset); @@ -256,7 +257,8 @@ void zFrag_ProjectileRenderer(); void zShrapnel_SceneInit(zScene*); void zFragLoc_InitMat(zFragLocation*, xMat4x3*, xModelInstance*); void zFragLoc_InitVec(zFragLocation*, xVec3*, xModelInstance*); -void zShrapnel_DefaultInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, void(*cb)(zFrag*, zFragAsset*)); +void zShrapnel_DefaultInit(zShrapnelAsset* shrap, xModelInstance* parent, xVec3* initVel, + void (*cb)(zFrag*, zFragAsset*)); void zFrag_ProjectileSetupPath(zFrag* frag, zFragProjectileAsset* passet); void zFrag_DefaultProjectileUpdate(zFrag* frag, F32 param_2); diff --git a/src/SB/Game/zSurface.cpp b/src/SB/Game/zSurface.cpp index 10f29cf2b..53aea2746 100644 --- a/src/SB/Game/zSurface.cpp +++ b/src/SB/Game/zSurface.cpp @@ -1,15 +1,16 @@ #include "zSurface.h" + #include "zScene.h" -#include "xstransvc.h" + #include "xCollide.h" -#include "xMathInlines.h" -#include "xGroup.h" #include "xDebug.h" +#include "xGroup.h" +#include "xMath.h" +#include "xMathInlines.h" +#include "xstransvc.h" -#include #include - -#include "xMath.h" +#include #define MAX_MAPPER 1 @@ -107,7 +108,6 @@ static void zSurfaceInitDefaultSurface() sDef_surf.moprops = &sDef_surf_props; sDef_surf_props.asset = &sDef_surf_asset; - sDef_surf_asset.game_damage_type = 0; sDef_surf_asset.game_sticky = 0; sDef_surf_asset.game_damage_flags = 0; @@ -120,11 +120,14 @@ static void zSurfaceInitDefaultSurface() void zSurfaceRegisterMapper(U32 assetId) { - if (sMapperCount >= MAX_MAPPER) return; - if (!assetId) return; + if (sMapperCount >= MAX_MAPPER) + return; + if (!assetId) + return; sMapper[sMapperCount] = (zMaterialMapAsset*)xSTFindAsset(assetId, NULL); - if (sMapper[sMapperCount]) { + if (sMapper[sMapperCount]) + { sMapperCount++; } } @@ -221,7 +224,8 @@ U8 zSurfaceOutOfBounds(const xSurface& s) F32 zSurfaceGetSlideStartAngle(const xSurface* surf) { - if (surf->moprops) { + if (surf->moprops) + { return DEG2RAD(((zSurfaceProps*)surf->moprops)->asset->sld_start); } @@ -321,11 +325,14 @@ void zSurfaceLoad(xSurface* ent, xSerial* s) void zSurfaceSetup(xSurface* s) { zSurfaceProps* pp = (zSurfaceProps*)s->moprops; - if (!pp) return; + if (!pp) + return; - for (S32 i = 0; i < 2; i++) { + for (S32 i = 0; i < 2; i++) + { pp->texanim[i].group_ptr = NULL; - if (pp->texanim[i].group) { + if (pp->texanim[i].group) + { pp->texanim[i].group_ptr = zSceneFindObject(pp->texanim[i].group); } } @@ -381,10 +388,10 @@ void zSurfaceUpdate(xBase* to, xScene* sc, F32 dt) } case 1: { - moprops->uvfx[j].trans.x = isin(2.0f * gFrameCount * (1.0f/60)); - moprops->uvfx[j].trans.y = isin(2.0f * gFrameCount * (1.0f/60)); - moprops->uvfx[j].scale.x = isin(2.0f * gFrameCount * (1.0f/60)); - moprops->uvfx[j].scale.y = isin(2.0f * gFrameCount * (1.0f/60)); + moprops->uvfx[j].trans.x = isin(2.0f * gFrameCount * (1.0f / 60)); + moprops->uvfx[j].trans.y = isin(2.0f * gFrameCount * (1.0f / 60)); + moprops->uvfx[j].scale.x = isin(2.0f * gFrameCount * (1.0f / 60)); + moprops->uvfx[j].scale.y = isin(2.0f * gFrameCount * (1.0f / 60)); break; } case 2: diff --git a/src/SB/Game/zSurface.h b/src/SB/Game/zSurface.h index faf1ff278..417c1f4c2 100644 --- a/src/SB/Game/zSurface.h +++ b/src/SB/Game/zSurface.h @@ -6,12 +6,11 @@ #include "xMath3.h" #include "xSurface.h" +#define SURF_TEXANIM_ON (1 << 0) +#define SURF_TEXANIM_ON2 (1 << 1) -#define SURF_TEXANIM_ON (1<<0) -#define SURF_TEXANIM_ON2 (1<<1) - -#define UVANIM_FLAG_ON (1<<0) -#define UVANIM_FLAG_ON2 (1<<1) +#define UVANIM_FLAG_ON (1 << 0) +#define UVANIM_FLAG_ON2 (1 << 1) struct zSurfMatFX { diff --git a/src/SB/Game/zTalkBox.cpp b/src/SB/Game/zTalkBox.cpp index 1c063d4dd..8e9ab5543 100644 --- a/src/SB/Game/zTalkBox.cpp +++ b/src/SB/Game/zTalkBox.cpp @@ -1,15 +1,17 @@ -#include "xstransvc.h" #include "zTalkBox.h" -#include "xDebug.h" + +#include "zBase.h" #include "zEntPlayer.h" #include "zGame.h" #include "zGlobals.h" #include "zMusic.h" -#include -#include "zGame.h" -#include "xSnd.h" + +#include "xDebug.h" #include "xEvent.h" -#include "zBase.h" +#include "xSnd.h" +#include "xstransvc.h" + +#include U32 xGroupGetCount(xGroup* g); xBase* xGroupGetItemPtr(xGroup* g, U32 index); diff --git a/src/SB/Game/zTalkBox.h b/src/SB/Game/zTalkBox.h index 56559e566..d878b8382 100644 --- a/src/SB/Game/zTalkBox.h +++ b/src/SB/Game/zTalkBox.h @@ -1,13 +1,14 @@ #ifndef ZTALKBOX_H #define ZTALKBOX_H -#include "zTextBox.h" +#include "zCutsceneMgr.h" #include "zNPCTypeCommon.h" -#include "xIni.h" +#include "zTextBox.h" + #include "containers.h" -#include "xScene.h" #include "xCamera.h" -#include "zCutsceneMgr.h" +#include "xIni.h" +#include "xScene.h" #include "xSnd.h" struct ztalkbox : xBase diff --git a/src/SB/Game/zTaskBox.cpp b/src/SB/Game/zTaskBox.cpp index 0c5819344..b44e94401 100644 --- a/src/SB/Game/zTaskBox.cpp +++ b/src/SB/Game/zTaskBox.cpp @@ -1,13 +1,13 @@ #include "zTaskBox.h" -#include "xEvent.h" -#include "xGroup.h" -#include "xstransvc.h" - #include "zBase.h" #include "zScene.h" #include "zTalkBox.h" +#include "xEvent.h" +#include "xGroup.h" +#include "xstransvc.h" + #include ztaskbox::talk_callback* ztaskbox::tcb; @@ -228,35 +228,35 @@ void ztaskbox::set_state(state_enum stage) switch (stage) { - case STATE_BEGIN: - if (!exists(stage)) - { - set_state(STATE_DESCRIPTION); - } - break; - case STATE_DESCRIPTION: - if (!exists(stage)) - { - set_state(STATE_REMINDER); - } - break; - case STATE_REMINDER: - case STATE_SUCCESS: - case STATE_FAILURE: - if (!exists(stage)) - { - set_state(STATE_END); - } - break; - case STATE_END: - if (!exists(stage)) - { - set_state(STATE_INVALID); - } - break; - default: - complete(); - break; + case STATE_BEGIN: + if (!exists(stage)) + { + set_state(STATE_DESCRIPTION); + } + break; + case STATE_DESCRIPTION: + if (!exists(stage)) + { + set_state(STATE_REMINDER); + } + break; + case STATE_REMINDER: + case STATE_SUCCESS: + case STATE_FAILURE: + if (!exists(stage)) + { + set_state(STATE_END); + } + break; + case STATE_END: + if (!exists(stage)) + { + set_state(STATE_INVALID); + } + break; + default: + complete(); + break; } } diff --git a/src/SB/Game/zTaskBox.h b/src/SB/Game/zTaskBox.h index cfb5e6032..0d8109b2f 100644 --- a/src/SB/Game/zTaskBox.h +++ b/src/SB/Game/zTaskBox.h @@ -1,12 +1,12 @@ #ifndef ZTASKBOX_H #define ZTASKBOX_H -#include "xBase.h" -#include "xDynAsset.h" - #include "zNPCTypeCommon.h" #include "zTalkBox.h" +#include "xBase.h" +#include "xDynAsset.h" + #include struct ztaskbox : xBase diff --git a/src/SB/Game/zTaxi.cpp b/src/SB/Game/zTaxi.cpp index 2fd12e07d..2165ef01b 100644 --- a/src/SB/Game/zTaxi.cpp +++ b/src/SB/Game/zTaxi.cpp @@ -1,12 +1,13 @@ -#include "xBase.h" -#include "xEvent.h" -#include "xstransvc.h" - #include "zTaxi.h" + #include "zEntPlayer.h" #include "zGlobals.h" #include "zScene.h" +#include "xBase.h" +#include "xEvent.h" +#include "xstransvc.h" + #include static ztalkbox::answer_enum sAnswer = ztalkbox::ANSWER_3; diff --git a/src/SB/Game/zTaxi.h b/src/SB/Game/zTaxi.h index 56d6603d0..6f8f681ac 100644 --- a/src/SB/Game/zTaxi.h +++ b/src/SB/Game/zTaxi.h @@ -1,12 +1,14 @@ #ifndef ZTAXI_H #define ZTAXI_H -#include -#include "xBase.h" -#include "xDynAsset.h" #include "zEnt.h" #include "zTalkBox.h" +#include "xBase.h" +#include "xDynAsset.h" + +#include + struct taxi_asset : xDynAsset { U32 marker; diff --git a/src/SB/Game/zTextBox.cpp b/src/SB/Game/zTextBox.cpp index cd27a79e2..14f7663bf 100644 --- a/src/SB/Game/zTextBox.cpp +++ b/src/SB/Game/zTextBox.cpp @@ -3,8 +3,8 @@ #include "zBase.h" #include "xEvent.h" -#include "xstransvc.h" #include "xTextAsset.h" +#include "xstransvc.h" #include diff --git a/src/SB/Game/zThrown.cpp b/src/SB/Game/zThrown.cpp index 73b75908e..5ceab82c0 100644 --- a/src/SB/Game/zThrown.cpp +++ b/src/SB/Game/zThrown.cpp @@ -1,14 +1,14 @@ #include "zThrown.h" -#include "zGlobals.h" -#include -#include - #include "zEvent.h" +#include "zGlobals.h" #include "zScene.h" #include "xMathInlines.h" +#include +#include + static zThrownStruct zThrownList[32]; static U32 zThrownCount; static U32 sThrowButtonMask; @@ -16,10 +16,11 @@ static F32 sSNDLandTimer; static U32 sFruitIsFreezy; static U32 sDebugDepth; -static LaunchStats l_normal = {10.0f, 15.0f, 0.2f}; +static LaunchStats l_normal = { 10.0f, 15.0f, 0.2f }; static CarryableStats c_normal = {}; -static CarryableStats c_fruit = {24.0f}; +static CarryableStats c_fruit = { 24.0f }; +// clang-format off static ThrowableStats zThrowableModels[23] = { {"__default__", zThrownCollide_DestructObj, &c_normal, &l_normal, {}, NULL, 0.0f, 0x0, 0x0, NULL}, {"tiki_wooden", zThrownCollide_DestructObj, &c_normal, &l_normal, {}, NULL, 0.0f, 0x0, 0x0, NULL}, @@ -45,7 +46,7 @@ static ThrowableStats zThrowableModels[23] = { {"boss_sa_head_bind", zThrownCollide_BSandyHead, &c_normal, &l_normal, {}, NULL, 0.0f, 0x0, 0x0, NULL}, {}, }; - +// clang-format on void zThrown_Setup(zScene* sc) { diff --git a/src/SB/Game/zThrown.h b/src/SB/Game/zThrown.h index f16aadbb2..5241d6b04 100644 --- a/src/SB/Game/zThrown.h +++ b/src/SB/Game/zThrown.h @@ -1,10 +1,12 @@ #ifndef ZTHROWN_H #define ZTHROWN_H -#include -#include "xEntDrive.h" #include "zShrapnel.h" +#include "xEntDrive.h" + +#include + struct zScene; struct zThrownStruct; @@ -69,7 +71,7 @@ void zThrownCollide_DestructObj(zThrownStruct* thrown, xEntCollis* collis, F32* void zThrownCollide_BSandyHead(zThrownStruct* thrown, xEntCollis* collis, F32* bounce, F32* friction); void zThrownCollide_Tiki(zThrownStruct* thrown, xEntCollis* collis, F32* bounce, F32* friction); -void zThrownCollide_StoneTiki(class zThrownStruct *, class xEntCollis *, float *, float *); +void zThrownCollide_StoneTiki(class zThrownStruct*, class xEntCollis*, float*, float*); void zThrown_AddFruit(xEnt* ent); S32 zThrown_IsFruit(xEnt* ent, F32* stackHeight); S32 zThrown_IsStacked(xEnt* ent); diff --git a/src/SB/Game/zUI.cpp b/src/SB/Game/zUI.cpp index 62085690e..9d8b684bb 100644 --- a/src/SB/Game/zUI.cpp +++ b/src/SB/Game/zUI.cpp @@ -1,11 +1,11 @@ #include "zUI.h" #include "zAnimList.h" -#include "zGlobals.h" -#include "zUIFont.h" -#include "zRenderState.h" #include "zGame.h" #include "zGameState.h" +#include "zGlobals.h" +#include "zRenderState.h" +#include "zUIFont.h" #include "xCounter.h" #include "xDebug.h" @@ -14,15 +14,15 @@ #include "xMath2.h" #include "xScrFx.h" #include "xSnd.h" -#include "xstransvc.h" #include "xString.h" #include "xTRC.h" +#include "xstransvc.h" #include "iMath.h" -#include -#include +#include #include +#include #define TASK_COUNT 8 #define TASK_COUNT_BOSS 2 @@ -1060,11 +1060,11 @@ S32 zUIEventCB(xBase*, xBase* to, U32 toEvent, const F32* toParam, xBase*) /************************** PAUSE MENU ********************************* * This array defines the angle and character that the player will start with * for each "task" in the game. - * + * * Each entry has the following format: - * + * * ang, player - * + * * ang - the starting angle in degrees * player - the starting character, can be one of the following values: * eCurrentPlayerSpongeBob (SpongeBob) diff --git a/src/SB/Game/zUI.h b/src/SB/Game/zUI.h index 134a92469..4af3fce69 100644 --- a/src/SB/Game/zUI.h +++ b/src/SB/Game/zUI.h @@ -3,8 +3,8 @@ #include "zEnt.h" -#include "xMgr.h" #include "xIni.h" +#include "xMgr.h" struct zUIAsset : xEntAsset { @@ -67,8 +67,7 @@ void zUIRenderAll(); void zUI_Render(xEnt* ent); S32 zUIEventCB(xBase*, xBase* to, U32 toEvent, const F32* toParam, xBase*); void zUI_ParseINI(xIniFile* ini); -S32 zUIPortalEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget); +S32 zUIPortalEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget); void zUI_ScenePortalSetToCurrentLevel(zScene* zsc); void zUI_ScenePortalInit(zScene* zsc); void zUI_PortalToKrabs(U32 taskNum); diff --git a/src/SB/Game/zUIFont.cpp b/src/SB/Game/zUIFont.cpp index 7009b6d0c..60f291e77 100644 --- a/src/SB/Game/zUIFont.cpp +++ b/src/SB/Game/zUIFont.cpp @@ -2,14 +2,14 @@ #include "zSaveLoad.h" -#include "xTextAsset.h" -#include "xstransvc.h" +#include "xColor.h" +#include "xEvent.h" +#include "xFont.h" #include "xMath2.h" #include "xString.h" -#include "xFont.h" #include "xTRC.h" -#include "xEvent.h" -#include "xColor.h" +#include "xTextAsset.h" +#include "xstransvc.h" static const basic_rect _855_0 = { 0, 0, 0, 0 }; // remove when decomping zUIFont_Render diff --git a/src/SB/Game/zUIFont.h b/src/SB/Game/zUIFont.h index 90a8ad58d..f3424924d 100644 --- a/src/SB/Game/zUIFont.h +++ b/src/SB/Game/zUIFont.h @@ -43,8 +43,7 @@ void zUIFont_Load(zUIFont* ent, xSerial* s); void zUIFont_Reset(zUIFont* ent); void zUIFont_PreUpdate(zUIFont* ent, xScene* sc, F32 dt); void zUIFont_Update(zUIFont* ent, xScene*, F32); -S32 zUIFontEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget); +S32 zUIFontEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget); void zUIFont_Render(xEnt* e); #endif diff --git a/src/SB/Game/zVar.cpp b/src/SB/Game/zVar.cpp index 7a11e8fb1..0583d4d24 100644 --- a/src/SB/Game/zVar.cpp +++ b/src/SB/Game/zVar.cpp @@ -1,18 +1,5 @@ #include "zVar.h" -#include -#include -#include -#include - -#include "iTime.h" - -#include "xFont.h" -#include "xString.h" -#include "xsavegame.h" -#include "xSnd.h" -#include "xutil.h" - #include "zEntPlayer.h" #include "zGlobals.h" #include "zMenu.h" @@ -20,6 +7,19 @@ #include "zScene.h" #include "zUI.h" +#include "xFont.h" +#include "xSnd.h" +#include "xString.h" +#include "xsavegame.h" +#include "xutil.h" + +#include "iTime.h" + +#include +#include +#include +#include + /* vars = { {"ActivePad", 9, &var_text_ActivePad}, @@ -176,24 +176,21 @@ namespace char* var_text_CurrentLevelCollectable() { static char buffer[0x0C]; - sprintf(buffer, "%d", - globals.player.Inv_LevelPickups_CurrentLevel); + sprintf(buffer, "%d", globals.player.Inv_LevelPickups_CurrentLevel); return buffer; } char* var_text_CurrentLevelPatsSocks() { static char buffer[0x0C]; - sprintf(buffer, "%d", - globals.player.Inv_PatsSock_CurrentLevel); + sprintf(buffer, "%d", globals.player.Inv_PatsSock_CurrentLevel); return buffer; } char* var_text_CurrentScene() { static char buffer[0x20]; - sprintf(buffer, "%s", - xUtil_idtag2string(globals.sceneCur->sceneID, 0)); + sprintf(buffer, "%s", xUtil_idtag2string(globals.sceneCur->sceneID, 0)); return buffer; } @@ -203,9 +200,9 @@ namespace iGetCurrFormattedTime(buffer); return buffer; } -} +} // namespace -const basic_rect screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f }; +const basic_rect screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f }; const basic_rect default_adjust = { 0.0f, 0.0f, 1.0f, 1.0f }; namespace @@ -228,8 +225,7 @@ namespace date[0x20 - 1] = '\0'; // Get the hour - sprintf(time, "%c%c", zSaveLoadGameTable[i].date[0xB], - zSaveLoadGameTable[i].date[0xC]); + sprintf(time, "%c%c", zSaveLoadGameTable[i].date[0xB], zSaveLoadGameTable[i].date[0xC]); // Get the AM/PM hour = atoi(time); @@ -319,6 +315,7 @@ namespace char* var_text_MCAccessType() { + // clang-format off static char* state_text[4] = { "Accessing", @@ -326,6 +323,7 @@ namespace "Saving data", "Formatting memory card" }; + // clang-format on return state_text[zSaveLoad_getMCAccessType()]; } @@ -368,23 +366,27 @@ namespace char* var_text_PlayerHeShe() { + // clang-format off static char* text[3] = { "{i:text_player_he}", "{i:text_player_he}", "{i:text_player_she}" }; + // clang-format on return text[gCurrentPlayer]; } char* var_text_PlayerName() { + // clang-format off static char* text[3] = { "{i:text_spongebob_name}", "{i:text_patrick_name}", "{i:text_sandy_name}" }; + // clang-format on return text[gCurrentPlayer]; } @@ -392,8 +394,8 @@ namespace { static char buffer[0x30]; xEntFrame* frame = globals.player.ent.frame; - sprintf(buffer, "%d,%d,%d", S32(frame->mat.pos.x), - S32(frame->mat.pos.y), S32(frame->mat.pos.z)); + sprintf(buffer, "%d,%d,%d", S32(frame->mat.pos.x), S32(frame->mat.pos.y), + S32(frame->mat.pos.z)); return buffer; } @@ -422,8 +424,7 @@ namespace } else { - sprintf(buffer, "%d {i:text_shinies}", - globals.player.Inv_Shiny); + sprintf(buffer, "%d {i:text_shinies}", globals.player.Inv_Shiny); } return buffer; } @@ -495,6 +496,7 @@ namespace return buffer; } + // clang-format off static var_type vars[0x27] = { { "ActivePad", 0x09, &var_text_ActivePad }, @@ -537,6 +539,7 @@ namespace { "SpaceNeeded", 0x0B, &var_text_SpaceNeeded }, { "TotalPatsSocks", 0x0E, &var_text_TotalPatsSocks } }; + // clang-format on var_type* find_var(const substr& str) { @@ -779,6 +782,7 @@ U32 zVarEntryCB_IsVisible(void* arg) return xEntIsVisible((xEnt*)arg) != 0; } +// clang-format off zVarEntry zVarEntryTable[19] = { { 0x00, 0x00, "Sound mode", zVarEntryCB_SndMode }, @@ -800,4 +804,5 @@ zVarEntry zVarEntryTable[19] = { 0x10, 0x00, "Is Enabled (0=No, 1=Yes)", zVarEntryCB_IsEnabled }, { 0x11, 0x00, "Is Visible (0=No, 1=Yes)", zVarEntryCB_IsVisible }, { 0x00, 0x00, NULL, NULL } -}; \ No newline at end of file +}; +// clang-format on diff --git a/src/SB/Game/zVar.h b/src/SB/Game/zVar.h index d38289f58..cb21f46f9 100644 --- a/src/SB/Game/zVar.h +++ b/src/SB/Game/zVar.h @@ -1,10 +1,10 @@ #ifndef ZVAR_H #define ZVAR_H -#include - #include "xString.h" +#include + struct zVarEntry { U32 entry; diff --git a/src/SB/Game/zVolume.cpp b/src/SB/Game/zVolume.cpp index 285187fd3..367675c0a 100644 --- a/src/SB/Game/zVolume.cpp +++ b/src/SB/Game/zVolume.cpp @@ -1,9 +1,10 @@ #include "zVolume.h" -#include "xstransvc.h" +#include "xEvent.h" #include "xMemMgr.h" +#include "xstransvc.h" + #include "iMath.h" -#include "xEvent.h" struct PreCalcOcclude { diff --git a/src/bink/include/radbase.h b/src/bink/include/radbase.h index e98456921..5b748f836 100644 --- a/src/bink/include/radbase.h +++ b/src/bink/include/radbase.h @@ -344,54 +344,39 @@ #define RAD_ALIGN_ADD_TYPE(var) RAD_ALIGN_TYPE var##align = RAD_ALIGN_DEF -// Each commented out line is required for our build - -// #define S8 signed char -// #define U8 unsigned char -// #define U32 unsigned long -// #define S32 signed long -// #define F32 float -// #define F64 double - -#if defined(__MWERKS__) || defined(__MRC__) || defined(GEKKO) -// #define U64 unsigned long long -// #define S64 signed long long -// #else -// #define U64 unsigned __int64 -// #define S64 signed __int64 -#endif - #ifdef __RAD32__ #define PTR4 -#define U16 unsigned short -#define S16 signed short #else #define PTR4 __far -#define U16 unsigned int -#define S16 signed int #endif -#ifndef RAD_NO_LOWERCASE_TYPES +// RAD SDK Type Definitions (using typedef instead of #define to avoid macro collisions) +typedef signed char S8; +typedef unsigned char U8; +typedef signed short S16; +typedef unsigned short U16; +typedef signed int S32; +typedef unsigned int U32; +typedef signed long long S64; +typedef unsigned long long U64; +typedef float F32; +typedef double F64; +#ifndef RAD_NO_LOWERCASE_TYPES #ifdef __RADNGC__ - #include - #else - -#define u8 U8 -#define s8 S8 -#define u16 U16 -#define s16 S16 -#define u32 U32 -#define s32 S32 -#define u64 U64 -#define s64 S64 -#define f32 F32 -#define f64 F64 - +typedef U8 u8; +typedef S8 s8; +typedef U16 u16; +typedef S16 s16; +typedef U32 u32; +typedef S32 s32; +typedef U64 u64; +typedef S64 s64; +typedef F32 f32; +typedef F64 f64; #endif - #endif #endif