Skip to content

Commit

Permalink
Merge pull request #851 from Hoikas/cov-1451232
Browse files Browse the repository at this point in the history
Fix a crash and a silly identified by Coverity.
  • Loading branch information
zrax committed Mar 3, 2021
2 parents 9b5e2bb + ff344fc commit c9327c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Sources/Plasma/CoreLib/hsMatrix44.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct hsMatrix44 {

void DecompRigid(hsScalarTriple &translate, hsQuat &rotate) const;

[[nodiscard]]
static const hsMatrix44& IdentityMatrix();

// worldToCameras and cameraToWorlds are arrays of 6 matrices. Returned are LEFT,RIGHT,FRONT,BACK,TOP,BOTTOM.
Expand Down Expand Up @@ -118,6 +119,7 @@ struct hsMatrix44 {
hsVector3* GetTranslate(hsVector3 *pt) const;
hsPoint3* GetTranslate(hsPoint3 *pt) const
{ return (hsPoint3*)GetTranslate((hsVector3*)pt); }
[[nodiscard]]
const hsPoint3 GetTranslate() const { return hsPoint3(fMap[0][3], fMap[1][3], fMap[2][3]); }
void GetAxis(hsVector3* view, hsVector3 *up, hsVector3* right);
void GetAxisFromCamera(hsVector3* view, hsVector3 *up, hsVector3* right);
Expand All @@ -135,12 +137,15 @@ struct hsMatrix44 {
void MakeZRotation(float radians);


[[nodiscard]]
hsPoint3 operator*(const hsPoint3& p) const;
[[nodiscard]]
hsVector3 operator*(const hsVector3& p) const;
[[nodiscard]]
hsMatrix44 operator *(const hsMatrix44& other) const { return mat_mult.call(*this, other); }

hsPoint3* MapPoints(long count, hsPoint3 points[]) const;

bool IsIdentity();
void NotIdentity() { fFlags &= ~kIsIdent; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ bool plVolumeSensorConditionalObject::MsgReceive(plMessage* msg)
if (fHittee && fType == kTypeExit) {
const plSceneObject* hitteeSO = plSceneObject::ConvertNoRef(fHittee->ObjectIsLoaded());
if (hitteeSO && hitteeSO->IsLocallyOwned() == plSynchedObject::kYes) {
fLogicMod->GetNotify()->AddCollisionEvent(false, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
fLogicMod->GetNotify()->AddCollisionEvent(false, page->fPlayer, fHittee, false);
if (Satisfied())
fLogicMod->Trigger(false);
}
Expand Down
1 change: 0 additions & 1 deletion Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ void cyPhysics::Warp(pyPoint3& pos)
// create message
PyObject* matObj = pyMatrix44::New();
pyMatrix44* mat = pyMatrix44::ConvertFrom(matObj);
mat->fMatrix.IdentityMatrix();
mat->fMatrix.SetTranslate(&pos.fPoint);
WarpMat(*mat);
Py_DECREF(matObj);
Expand Down

0 comments on commit c9327c8

Please sign in to comment.