From af6e132b37e8b7e89e4c0c7a52e5bb81e4b1b9a8 Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 19:54:37 +0600 Subject: defined out asserts. --- src/modelinfo/BaseModelInfo.h | 2 ++ src/modelinfo/ClumpModelInfo.h | 3 +++ src/modelinfo/SimpleModelInfo.h | 3 +++ src/modelinfo/TimeModelInfo.h | 3 +++ src/modelinfo/VehicleModelInfo.h | 3 +++ 5 files changed, 14 insertions(+) (limited to 'src/modelinfo') diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index fdf1efb6..ce42cb3a 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -70,4 +70,6 @@ public: uint16 GetNumRefs() const { return m_refCount; } }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); +#endif diff --git a/src/modelinfo/ClumpModelInfo.h b/src/modelinfo/ClumpModelInfo.h index c37a468a..a4ba2c9e 100644 --- a/src/modelinfo/ClumpModelInfo.h +++ b/src/modelinfo/ClumpModelInfo.h @@ -50,4 +50,7 @@ public: static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data); static RwFrame *GetFrameFromId(RpClump *clump, int32 id); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error"); +#endif diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h index 8c4173e9..65ff8c52 100644 --- a/src/modelinfo/SimpleModelInfo.h +++ b/src/modelinfo/SimpleModelInfo.h @@ -49,4 +49,7 @@ public: void SetRelatedModel(CSimpleModelInfo *m){ m_atomics[2] = (RpAtomic*)m; } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error"); +#endif diff --git a/src/modelinfo/TimeModelInfo.h b/src/modelinfo/TimeModelInfo.h index f8b7c8ff..cbe171e0 100644 --- a/src/modelinfo/TimeModelInfo.h +++ b/src/modelinfo/TimeModelInfo.h @@ -17,4 +17,7 @@ public: void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; } CTimeModelInfo *FindOtherTimeModel(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error"); +#endif \ No newline at end of file diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 6946c5c1..160c846b 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -123,4 +123,7 @@ public: static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id); static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error"); +#endif -- cgit v1.2.3 From 5b605c127144ab805581f62015ef3742c1d4a64e Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 10 May 2020 17:09:57 +0200 Subject: some fixes and cosmetic changes --- src/modelinfo/ClumpModelInfo.cpp | 27 ++++++++++++--------------- src/modelinfo/PedModelInfo.h | 3 ++- src/modelinfo/SimpleModelInfo.cpp | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) (limited to 'src/modelinfo') diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index 44faf3c5..ccfcd304 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -43,7 +43,7 @@ CClumpModelInfo::CreateInstance(void) RpClumpForAllAtomics(clone, SetHierarchyForSkinAtomic, hier); anim = HAnimAnimationCreateForHierarchy(hier); RpHAnimHierarchySetCurrentAnim(hier, anim); -// RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); + RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); // the rest is xbox only: // RpSkinGetNumBones(RpSkinGeometryGetSkin(RpAtomicGetGeometry(IsClumpSkinned(clone)))); RpHAnimHierarchyUpdateMatrices(hier); @@ -113,7 +113,7 @@ CClumpModelInfo::SetClump(RpClump *clump) weights->w2 /= sum; weights->w3 /= sum; } -// RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); + RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); } #endif } @@ -139,13 +139,12 @@ CClumpModelInfo::FindFrameFromIdCB(RwFrame *frame, void *data) { RwObjectIdAssociation *assoc = (RwObjectIdAssociation*)data; - if(CVisibilityPlugins::GetFrameHierarchyId(frame) != assoc->id){ - RwFrameForAllChildren(frame, FindFrameFromIdCB, assoc); - return assoc->frame ? nil : frame; - }else{ + if(CVisibilityPlugins::GetFrameHierarchyId(frame) == assoc->id){ assoc->frame = frame; return nil; } + RwFrameForAllChildren(frame, FindFrameFromIdCB, assoc); + return assoc->frame ? nil : frame; } RwFrame* @@ -153,13 +152,12 @@ CClumpModelInfo::FindFrameFromNameCB(RwFrame *frame, void *data) { RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data; - if(CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){ - RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc); - return assoc->frame ? nil : frame; - }else{ + if(!CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){ assoc->frame = frame; return nil; } + RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc); + return assoc->frame ? nil : frame; } RwFrame* @@ -167,14 +165,13 @@ CClumpModelInfo::FindFrameFromNameWithoutIdCB(RwFrame *frame, void *data) { RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data; - if(CVisibilityPlugins::GetFrameHierarchyId(frame) || - CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){ - RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc); - return assoc->frame ? nil : frame; - }else{ + if(CVisibilityPlugins::GetFrameHierarchyId(frame) == 0 && + !CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){ assoc->frame = frame; return nil; } + RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc); + return assoc->frame ? nil : frame; } RwFrame* diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index a2bfd122..75f43be3 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -36,7 +36,8 @@ public: static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX]; - CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { } + CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; } + ~CPedModelInfo(void) { delete m_hitColModel; } void DeleteRwObject(void); void SetClump(RpClump *); diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index 36e98e18..a781cf58 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -150,7 +150,7 @@ void CSimpleModelInfo::SetupBigBuilding(void) { CSimpleModelInfo *related; - if(m_lodDistances[0] > LOD_DISTANCE && m_atomics[2] == nil){ + if(m_lodDistances[0] > LOD_DISTANCE && GetRelatedModel() == nil){ m_isBigBuilding = 1; FindRelatedModel(); related = GetRelatedModel(); -- cgit v1.2.3 From c798e1bacdaabaf140ff3904948fd7cec46c09bb Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 21:49:33 +0600 Subject: Fixed typos and made all assert functions optional --- src/modelinfo/BaseModelInfo.h | 6 ++---- src/modelinfo/ClumpModelInfo.h | 4 +--- src/modelinfo/PedModelInfo.h | 2 +- src/modelinfo/SimpleModelInfo.h | 4 +--- src/modelinfo/TimeModelInfo.h | 4 +--- src/modelinfo/VehicleModelInfo.h | 4 +--- 6 files changed, 7 insertions(+), 17 deletions(-) (limited to 'src/modelinfo') diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index ce42cb3a..783f871f 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -15,7 +15,7 @@ enum ModelInfoType : uint8 MITYPE_PED = 6, MITYPE_XTRACOMPS = 7, }; -static_assert(sizeof(ModelInfoType) == 1, "ModeInfoType: error"); +VALIDATE_SIZE(ModelInfoType, 1); class C2dEffect; @@ -70,6 +70,4 @@ public: uint16 GetNumRefs() const { return m_refCount; } }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); -#endif +VALIDATE_SIZE(CBaseModelInfo, 0x30); diff --git a/src/modelinfo/ClumpModelInfo.h b/src/modelinfo/ClumpModelInfo.h index a4ba2c9e..58b6de11 100644 --- a/src/modelinfo/ClumpModelInfo.h +++ b/src/modelinfo/ClumpModelInfo.h @@ -51,6 +51,4 @@ public: static RwFrame *GetFrameFromId(RpClump *clump, int32 id); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error"); -#endif +VALIDATE_SIZE(CClumpModelInfo, 0x34); diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index a2bfd122..84ada087 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -55,5 +55,5 @@ public: #endif }; #ifndef PED_SKIN -static_assert(sizeof(CPedModelInfo) == 0x48, "CPedModelInfo: error"); +VALIDATE_SIZE(CPedModelInfo, 0x48); #endif \ No newline at end of file diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h index 65ff8c52..ee63f24b 100644 --- a/src/modelinfo/SimpleModelInfo.h +++ b/src/modelinfo/SimpleModelInfo.h @@ -50,6 +50,4 @@ public: m_atomics[2] = (RpAtomic*)m; } }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error"); -#endif +VALIDATE_SIZE(CSimpleModelInfo, 0x4C); diff --git a/src/modelinfo/TimeModelInfo.h b/src/modelinfo/TimeModelInfo.h index cbe171e0..73b6ab26 100644 --- a/src/modelinfo/TimeModelInfo.h +++ b/src/modelinfo/TimeModelInfo.h @@ -18,6 +18,4 @@ public: CTimeModelInfo *FindOtherTimeModel(void); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error"); -#endif \ No newline at end of file +VALIDATE_SIZE(CTimeModelInfo, 0x58); diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 160c846b..ba25d3cd 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -124,6 +124,4 @@ public: static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; } }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error"); -#endif +VALIDATE_SIZE(CVehicleModelInfo, 0x1F8); -- cgit v1.2.3 From b11715608f5d12d82ecb364b0d2dc76c24d6ab1f Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 11 May 2020 09:18:41 +0200 Subject: few fixes --- src/modelinfo/VehicleModelInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modelinfo') diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 098400cc..d64146d7 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -111,8 +111,8 @@ RwObjectNameIdAssocation heliIds[] = { }; RwObjectNameIdAssocation planeIds[] = { - { "wheel_front_dummy", 2, 0 }, - { "wheel_rear_dummy", 3, 0 }, + { "wheel_front_dummy", PLANE_WHEEL_FRONT, 0 }, + { "wheel_rear_dummy", PLANE_WHEEL_READ, 0 }, { "light_tailplane", PLANE_POS_LIGHT_TAIL, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_left", PLANE_POS_LIGHT_LEFT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_right", PLANE_POS_LIGHT_RIGHT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, -- cgit v1.2.3