Merge pull request #201 from lioncash/ref

CToken: Add HasReference() member function
This commit is contained in:
Phillip Stephens 2020-03-08 18:20:15 -07:00 committed by GitHub
commit 89f479a824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 9 deletions

View File

@ -74,7 +74,9 @@ class CToken {
public:
/* Added to test for non-null state */
explicit operator bool() const { return x0_objRef != nullptr; }
explicit operator bool() const { return HasReference(); }
bool HasReference() const { return x0_objRef != nullptr; }
void Unlock();
void Lock();
bool IsLocked() const { return x4_lockHeld; }

View File

@ -10,7 +10,7 @@ namespace urde {
CAnimSourceInfo::CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token) : x4_token(token) {}
bool CAnimSourceInfo::HasPOIData() const { return bool(x4_token->x58_evntData); }
bool CAnimSourceInfo::HasPOIData() const { return x4_token->x58_evntData.HasReference(); }
const std::vector<CBoolPOINode>& CAnimSourceInfo::GetBoolPOIStream() const { return x4_token->GetBoolPOIStream(); }

View File

@ -75,7 +75,7 @@ public:
CCharAnimTime GetAnimationDuration() const { return MainHeader().duration; }
float GetAverageVelocity() const { return x10_averageVelocity; }
const zeus::CVector3f& GetRootOffset() const { return x14_rootOffset; }
bool HasPOIData() const { return bool(x8_evntToken); }
bool HasPOIData() const { return x8_evntToken.HasReference(); }
const std::vector<CBoolPOINode>& GetBoolPOIStream() const { return x8_evntToken->GetBoolPOIStream(); }
const std::vector<CInt32POINode>& GetInt32POIStream() const { return x8_evntToken->GetInt32POIStream(); }
const std::vector<CParticlePOINode>& GetParticlePOIStream() const { return x8_evntToken->GetParticlePOIStream(); }

View File

@ -148,16 +148,16 @@ public:
const zeus::CVector3f& GetScale() const { return x0_scale; }
void SetScale(const zeus::CVector3f& scale) { x0_scale = scale; }
bool HasAnimData() const { return x10_animData != nullptr; }
bool HasNormalModel() const { return bool(x1c_normalModel); }
bool HasNormalModel() const { return x1c_normalModel.HasReference(); }
bool HasModel(EWhichModel which) const {
if (x10_animData) {
switch (which) {
case EWhichModel::Normal:
return true;
case EWhichModel::XRay:
return x10_animData->GetXRayModel().operator bool();
return x10_animData->GetXRayModel() != nullptr;
case EWhichModel::Thermal:
return x10_animData->GetInfraModel().operator bool();
return x10_animData->GetInfraModel() != nullptr;
default:
return false;
}
@ -165,11 +165,11 @@ public:
switch (which) {
case EWhichModel::Normal:
return bool(x1c_normalModel);
return x1c_normalModel.HasReference();
case EWhichModel::XRay:
return bool(x2c_xrayModel);
return x2c_xrayModel.HasReference();
case EWhichModel::Thermal:
return bool(x3c_infraModel);
return x3c_infraModel.HasReference();
default:
return false;
}