From 60045ec6cd5fe5bd650cf62442283e50d4a4c233 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 20 Jul 2019 14:39:38 +0200 Subject: [PATCH] couple of fixes --- src/animation/AnimBlendAssocGroup.cpp | 13 ++++++------- src/core/Collision.cpp | 2 +- src/core/FileLoader.cpp | 6 +++--- src/core/Pad.cpp | 2 +- src/math/Matrix.h | 1 - src/render/WaterLevel.cpp | 5 ++--- src/skel/events.cpp | 2 +- src/vehicles/Automobile.cpp | 13 +++++++------ src/vehicles/HandlingMgr.cpp | 2 +- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/animation/AnimBlendAssocGroup.cpp b/src/animation/AnimBlendAssocGroup.cpp index fbca92b7..05f9a06a 100644 --- a/src/animation/AnimBlendAssocGroup.cpp +++ b/src/animation/AnimBlendAssocGroup.cpp @@ -116,14 +116,13 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name) for(i = 0; i < animBlock->numAnims; i++){ CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i); CBaseModelInfo *model = GetModelFromName(anim->name); + assert(model); printf("Associated anim %s with model %s\n", anim->name, model->GetName()); - if(model){ - RpClump *clump = (RpClump*)model->CreateInstance(); - RpAnimBlendClumpInit(clump); - assocList[i].Init(clump, anim); - RpClumpDestroy(clump); - assocList[i].animId = i; - } + RpClump *clump = (RpClump*)model->CreateInstance(); + RpAnimBlendClumpInit(clump); + assocList[i].Init(clump, anim); + RpClumpDestroy(clump); + assocList[i].animId = i; } numAssociations = animBlock->numAnims; } diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 9a8adf46..7982e77d 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -1357,6 +1357,7 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin void CCollision::CalculateTrianglePlanes(CColModel *model) { + assert(model); if(model->numTriangles == 0) return; @@ -1367,7 +1368,6 @@ CCollision::CalculateTrianglePlanes(CColModel *model) lptr->Remove(); ms_colModelCache.head.Insert(lptr); }else{ - assert(model); lptr = ms_colModelCache.Insert(model); if(lptr == nil){ // make room if we have to, remove last in list diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 450cc146..14dc91cd 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -361,10 +361,10 @@ CFileLoader::LoadClumpFile(const char *filename) nodename = GetFrameNodeName(RpClumpGetFrame(clump)); GetNameAndLOD(nodename, name, &n); mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil); - assert(mi->IsClump()); - if(mi) + if(mi){ + assert(mi->IsClump()); mi->SetClump(clump); - else + }else RpClumpDestroy(clump); } } diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 1db50493..736e1e9d 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -1824,7 +1824,7 @@ char *CPad::EditString(char *pStr, int32 nSize) } // numbers - for ( int32 i = 0; i < ('0' - '9' + 1); i++ ) + for ( int32 i = 0; i < ('9' - '0' + 1); i++ ) { if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 ) { diff --git a/src/math/Matrix.h b/src/math/Matrix.h index 2c0108c1..05a6eb03 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -240,7 +240,6 @@ public: m_matrix.at.y = 0.0f; m_matrix.at.z = 1.0f; m_matrix.pos.x = 0.0f; - m_matrix.pos.x = 0.0f; m_matrix.pos.y = 0.0f; m_matrix.pos.z = 0.0f; } diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 2f994132..30be88e1 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -173,9 +173,8 @@ CWaterLevel::CreateWavyAtomic() { wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0); - wavyVert = RpMorphTargetGetVertices(wavyMorphTarget); - ASSERT(wavyMorphTarget != NULL); + wavyVert = RpMorphTargetGetVertices(wavyMorphTarget); ASSERT(wavyVert != NULL); for ( int32 i = 0; i < 9; i++ ) @@ -1149,10 +1148,10 @@ CWaterLevel::AllocateBoatWakeArray() ASSERT(ms_pWavyAtomic != NULL ); RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic); + ASSERT(wavyGeometry != NULL ); RpMorphTarget *wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0); RpMaterial *wavyMaterial = RpGeometryGetMaterial(wavyGeometry, 0); - ASSERT(wavyGeometry != NULL ); ASSERT(wavyMorphTarget != NULL ); ASSERT(wavyMaterial != NULL ); diff --git a/src/skel/events.cpp b/src/skel/events.cpp index 877b969e..60e1482e 100644 --- a/src/skel/events.cpp +++ b/src/skel/events.cpp @@ -775,7 +775,7 @@ HandlePadButtonUp(RsPadButtonStatus *padButtonStatus) bool bCam = false; int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; if ( mode == CCam::MODE_FLYBY || mode == CCam::MODE_FIXED ) - bool bCam = true; + bCam = true; ControlsManager.UpdateJoyButtonState(padNumber); diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 93590b2e..46116536 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -180,8 +180,6 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) bExplosionProof = true; bBulletProof = true; } - - *(void**)this = (void*)0x600C1C; } @@ -1443,9 +1441,11 @@ CAutomobile::RcbanditCheckHitWheels(void) { EAXJMP(0x53C990); } -//WRAPPER void -//CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) -//{ EAXJMP(0x52F390); +#if 0 +WRAPPER void +CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) +{ EAXJMP(0x52F390); } +#else void CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) { @@ -1494,7 +1494,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) return; if(m_pDamageEntity){ - if(m_pDamageEntity->m_status == STATUS_PLAYER_PLAYBACKFROMBUFFER && + if(m_pDamageEntity->IsBuilding() && DotProduct(m_vecDamageNormal, GetUp()) > 0.6f) return; } @@ -1686,6 +1686,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) } } } +#endif void CAutomobile::dmgDrawCarCollidingParticles(const CVector &pos, float amount) diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 4d3a94a8..be96ab08 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -70,7 +70,7 @@ char VehicleNames[NUMHANDLINGS][14] = { cHandlingDataMgr::cHandlingDataMgr(void) { - memset(this, 0, sizeof(this)); + memset(this, 0, sizeof(*this)); } void