diff --git a/asm/Collision/CCollidableCollisionSurface.s b/asm/Collision/CCollidableCollisionSurface.s index c0ff9446..ce9942f3 100644 --- a/asm/Collision/CCollidableCollisionSurface.s +++ b/asm/Collision/CCollidableCollisionSurface.s @@ -3,8 +3,8 @@ .section .sdata .balign 8 -.global lbl_805A86F0 -lbl_805A86F0: +.global sTableIndex__27CCollidableCollisionSurface +sTableIndex__27CCollidableCollisionSurface: # ROM: 0x3F6090 .4byte 0xFFFFFFFF .4byte 0 @@ -23,7 +23,7 @@ GetType__27CCollidableCollisionSurfaceFv: .global SetStaticTableIndex__27CCollidableCollisionSurfaceFUi SetStaticTableIndex__27CCollidableCollisionSurfaceFUi: -/* 802CE0B0 002CB010 90 6D 9B 30 */ stw r3, lbl_805A86F0@sda21(r13) +/* 802CE0B0 002CB010 90 6D 9B 30 */ stw r3, sTableIndex__27CCollidableCollisionSurface@sda21(r13) /* 802CE0B4 002CB014 4E 80 00 20 */ blr .section .rodata @@ -33,4 +33,3 @@ lbl_803D6A00: # ROM: 0x3D3A00 .asciz "CCollidableCollisionSurface" .4byte 0 - diff --git a/configure.py b/configure.py index 351241e8..809b564e 100755 --- a/configure.py +++ b/configure.py @@ -448,7 +448,7 @@ LIBS = [ "host": True, "objects": [ "Collision/CCollidableAABox", - "Collision/CCollidableCollisionSurface", + ["Collision/CCollidableCollisionSurface", True], ["Collision/CCollisionInfo", True], "Collision/InternalColliders", "Collision/CCollisionPrimitive", diff --git a/include/Collision/CCollidableCollisionSurface.hpp b/include/Collision/CCollidableCollisionSurface.hpp new file mode 100644 index 00000000..cfda8694 --- /dev/null +++ b/include/Collision/CCollidableCollisionSurface.hpp @@ -0,0 +1,15 @@ +#ifndef _CCOLLIDABLECOLLISIONSURFACE +#define _CCOLLIDABLECOLLISIONSURFACE + + +#include "Collision/CCollisionPrimitive.hpp" + +class CCollidableCollisionSurface { + static int sTableIndex; + +public: + static CCollisionPrimitive::Type GetType(); + static void SetStaticTableIndex(uint index); +}; + +#endif // _CCOLLIDABLECOLLISIONSURFACE diff --git a/include/Collision/CCollisionPrimitive.hpp b/include/Collision/CCollisionPrimitive.hpp index 53fb6e9c..c156cd74 100644 --- a/include/Collision/CCollisionPrimitive.hpp +++ b/include/Collision/CCollisionPrimitive.hpp @@ -12,8 +12,21 @@ class CRayCastResult; class CInternalRayCastStructure; +typedef void(*PrimitiveSetter)(uint); + class CCollisionPrimitive { public: + class Type { + public: + Type(PrimitiveSetter setter, const char* info) : mSetter(setter), mInfo(info) {} + + PrimitiveSetter GetSetter() const { return mSetter; } + const char* GetInfo() const { return mInfo; } + private: + PrimitiveSetter mSetter; + const char* mInfo; + }; + CCollisionPrimitive(const CMaterialList& list); virtual uint GetTableIndex() const = 0; diff --git a/src/Collision/CCollidableCollisionSurface.cpp b/src/Collision/CCollidableCollisionSurface.cpp new file mode 100644 index 00000000..c83963e7 --- /dev/null +++ b/src/Collision/CCollidableCollisionSurface.cpp @@ -0,0 +1,11 @@ +#include "Collision/CCollidableCollisionSurface.hpp" + +int CCollidableCollisionSurface::sTableIndex = -1; + +void CCollidableCollisionSurface::SetStaticTableIndex(uint index) { + sTableIndex = index; +} + +CCollisionPrimitive::Type CCollidableCollisionSurface::GetType() { + return CCollisionPrimitive::Type(SetStaticTableIndex, "CCollidableCollisionSurface"); +}