Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"oscontext.h": "c",
"radcb.h": "c",
"popmal.h": "c",
"osalloc.h": "c"
"osalloc.h": "c",
"cmath": "cpp"
},
// Disable C/C++ IntelliSense, use clangd instead
"C_Cpp.intelliSenseEngine": "default",
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def MatchingFor(*versions):
Object(NonMatching, "SB/Core/x/xBound.cpp"),
Object(NonMatching, "SB/Core/x/xCamera.cpp"),
Object(NonMatching, "SB/Core/x/xClimate.cpp"),
Object(NonMatching, "SB/Core/x/xCollide.cpp"),
Object(NonMatching, "SB/Core/x/xCollide.cpp", extra_cflags=["-sym on"]),
Object(Matching, "SB/Core/x/xCollideFast.cpp"),
Object(Matching, "SB/Core/x/xColor.cpp"),
Object(Matching, "SB/Core/x/xCounter.cpp"),
Expand Down
82 changes: 82 additions & 0 deletions include/rwsdk/rpcollbsptree.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// RpCollBSPTree is part of the RpCollis plugin in RW 3.4 and 3.5, but it's not exposed in the public API.
// BFBB had full source code access to the RenderWare SDK and used RpCollBSPTree for some collision checks.
// These definitions are based on the ones found in the BFBB PS2 DWARF data.
//
// Note: RpCollBSPTree was refactored as RpCollTree and added to the public API in RW 3.6.
// TSSM (SpongeBob Movie) and later games used RpCollTree instead of RpCollBSPTree.

#pragma once

#include <rpcollis.h>

typedef struct RpV3dGradient RpV3dGradient;
struct RpV3dGradient
{
RwReal dydx;
RwReal dzdx;
RwReal dxdy;
RwReal dzdy;
RwReal dxdz;
RwReal dydz;
};

typedef struct RpCollBSPBranchNode RpCollBSPBranchNode;
struct RpCollBSPBranchNode
{
RwUInt16 type;
RwUInt8 leftType;
RwUInt8 rightType;
RwUInt16 leftNode;
RwUInt16 rightNode;
RwReal leftValue;
RwReal rightValue;
};

typedef struct RpCollBSPLeafNode RpCollBSPLeafNode;
struct RpCollBSPLeafNode
{
RwUInt16 numPolygons;
RwUInt16 firstPolygon;
};

typedef struct RpCollBSPTriangle RpCollBSPTriangle;
struct RpCollBSPTriangle
{
RwUInt16 vertIndex[3];
RwInt16 index;
};

typedef struct RpCollBSPTree RpCollBSPTree;
struct RpCollBSPTree
{
RwUInt32 numLeafNodes;
RpCollBSPBranchNode* branchNodes;
RpCollBSPLeafNode* leafNodes;
RwUInt8 pad[4];
};

typedef struct RpCollisionData RpCollisionData;
struct RpCollisionData
{
RwInt32 flags;
RpCollBSPTree* tree;
RwInt32 numTriangles;
RwUInt16* triangleMap;
};

#define RpCollisionGeometryGetData(_geometry) \
(RWPLUGINOFFSET(RpCollisionData*, _geometry, _rpCollisionGeometryDataOffset) ? \
*RWPLUGINOFFSET(RpCollisionData*, _geometry, _rpCollisionGeometryDataOffset) : \
NULL)

#ifdef __cplusplus
extern "C"
{
#endif

extern RwInt32 _rpCollisionGeometryDataOffset;
extern RwInt32 _rpCollisionWorldSectorDataOffset;

#ifdef __cplusplus
}
#endif
2 changes: 2 additions & 0 deletions src/SB/Core/gc/iCollide.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

void iBoxForModelLocal(xBox* o, const xModelInstance* m);
void iBoxForModel(xBox* o, const xModelInstance* m);
RpCollisionTriangle* sphereHitsEnvCB(RpIntersection* isx, RpWorldSector* sector,
RpCollisionTriangle* tri, F32 dist, void* data);
S32 iSphereHitsEnv3(const xSphere* b, const xEnv* env, xCollis* colls, U8 ncolls, F32 sth);
S32 iSphereHitsModel3(const xSphere* b, const xModelInstance* m, xCollis* colls, U8 ncolls,
F32 sth);
Expand Down
Loading