Skip to content

Commit 0b34dbb

Browse files
committed
Allow creating a TObjOwnerDerivedFromObj from a nullptr, match and link CProjectileWeaponDataFactory
1 parent 6c6bc0b commit 0b34dbb

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎configure.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ def EquivalentFor(*versions):
15351535
else []
15361536
),
15371537
),
1538-
Object(EquivalentFor("GM8E01_00"), "Weapons/CProjectileWeaponDataFactory.cpp"),
1538+
Object(MatchingFor("GM8E01_00"), "Weapons/CProjectileWeaponDataFactory.cpp"),
15391539
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "Weapons/CCollisionResponseData.cpp"),
15401540
Object(
15411541
MatchingFor("GM8E01_00", "GM8E01_01"), "Weapons/IWeaponRenderer.cpp"

‎include/Kyoto/IObj.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ inline CObjOwnerDerivedFromIObjUntyped::~CObjOwnerDerivedFromIObjUntyped() {}
3535
template < typename T >
3636
class TObjOwnerDerivedFromIObj : public CObjOwnerDerivedFromIObjUntyped {
3737
public:
38+
TObjOwnerDerivedFromIObj(T* obj) : CObjOwnerDerivedFromIObjUntyped(obj) {}
3839
~TObjOwnerDerivedFromIObj() {
3940
if (Owned()) {
4041
delete Owned();
@@ -66,9 +67,8 @@ class TObjOwnerDerivedFromIObj : public CObjOwnerDerivedFromIObjUntyped {
6667
return rs_new TObjOwnerDerivedFromIObj< T >(obj);
6768
#endif
6869
}
69-
70+
7071
private:
71-
TObjOwnerDerivedFromIObj(T* obj) : CObjOwnerDerivedFromIObjUntyped(obj) {}
7272
TObjOwnerDerivedFromIObj(const rstl::auto_ptr< T >& obj) : CObjOwnerDerivedFromIObjUntyped(obj) {}
7373
};
7474

‎include/Kyoto/Math/CUnitVector3f.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class CUnitVector3f : public CVector3f {
1919
Normalize();
2020
}
2121
}
22+
2223
CUnitVector3f(const CVector3f& vec, const ENormalize normalize) : CVector3f(vec) {
2324
if (normalize == kN_Yes) {
2425
Normalize();

‎src/Weapons/CProjectileWeaponDataFactory.cpp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Kyoto/CRandom16.hpp"
44
#include "Kyoto/CVParamTransfer.hpp"
5+
#include "MetroidPrime/Weapons/CWeapon.hpp"
56
#include "Weapons/CWeaponDescription.hpp"
67

78
#include <Kyoto/Particles/CParticleDataFactory.hpp>
@@ -14,6 +15,9 @@ const CFactoryFnReturn FProjectileWeaponDataFactory(const SObjectTag& tag, CInpu
1415
return CProjectileWeaponDataFactory::GetGeneratorDesc(in, pool);
1516
}
1617

18+
void hack() {
19+
TObjOwnerDerivedFromIObj< CWeaponDescription >(nullptr);
20+
}
1721
CWeaponDescription* CProjectileWeaponDataFactory::GetGeneratorDesc(CInputStream& in,
1822
CSimplePool* pool) {
1923
rstl::vector< CAssetId > assets;
@@ -134,8 +138,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
134138
case 'COLR': {
135139
if (CParticleDataFactory::GetClassID(in) != 'NONE') {
136140
CAssetId id = in.ReadLong();
137-
desc->mCOLR =
138-
TLockedToken< CCollisionResponseData >(pool->GetObj(SObjectTag('CRSC', id)));
141+
desc->mCOLR = TLockedToken< CCollisionResponseData >(pool->GetObj(SObjectTag('CRSC', id)));
139142
}
140143
break;
141144
}

0 commit comments

Comments
 (0)