TCastToPtr adjustments

This commit is contained in:
Phillip Stephens 2017-01-18 14:30:02 -08:00
parent 3cc93ffd75
commit d1b55e23db
66 changed files with 197 additions and 87 deletions

View File

@ -164,11 +164,8 @@ class CStateManager
void UpdateThermalVisor(); void UpdateThermalVisor();
TUniqueId xf74_lastTrigger = kInvalidUniqueId; TUniqueId xf74_lastTrigger = kInvalidUniqueId;
TUniqueId xf76_lastRelay = kInvalidUniqueId;
public: public:
/* TODO: Figure out what these are
* Public for CScriptRelay
*/
TUniqueId xf76_ = kInvalidUniqueId;
/* TODO: Public for CFirstPersonCamera */ /* TODO: Public for CFirstPersonCamera */
u32 x904_; u32 x904_;
@ -310,8 +307,11 @@ public:
CAiWaypointList& GetAiWaypointObjectList() const { return *x83c_aiWaypointObjs; } CAiWaypointList& GetAiWaypointObjectList() const { return *x83c_aiWaypointObjs; }
CPlatformAndDoorList& GetPlatformAndDoorObjectList() const { return *x844_platformAndDoorObjs; } CPlatformAndDoorList& GetPlatformAndDoorObjectList() const { return *x844_platformAndDoorObjs; }
std::pair<u32, u32> CalculateScanCompletionRate() const; std::pair<u32, u32> CalculateScanCompletionRate() const;
void SetLastTrigger(TUniqueId uid) { xf74_lastTrigger = uid; } void SetLastTriggerId(TUniqueId uid) { xf74_lastTrigger = uid; }
TUniqueId GetLastTrigger() const { return xf74_lastTrigger; } TUniqueId GetLastTriggerId() const { return xf74_lastTrigger; }
void SetLastRelayId(TUniqueId uid) { xf76_lastRelay = uid; }
TUniqueId* GetLastRelayIdPtr() { return &xf76_lastRelay; }
TUniqueId GetLastRelayId() const { return xf76_lastRelay; }
}; };
} }

View File

View File

View File

@ -18,6 +18,7 @@ set(COLLISION_SOURCES
CMaterialList.hpp CMaterialList.hpp
CMaterialFilter.hpp CMaterialFilter.cpp CMaterialFilter.hpp CMaterialFilter.cpp
CInternalRayCastStructure.hpp CInternalRayCastStructure.cpp CInternalRayCastStructure.hpp CInternalRayCastStructure.cpp
CRayCastResult.hpp CRayCastResult.cpp) CRayCastResult.hpp CRayCastResult.cpp
CCollisionActor.hpp CCollisionActor.cpp)
runtime_add_list(Collision COLLISION_SOURCES) runtime_add_list(Collision COLLISION_SOURCES)

View File

@ -40,7 +40,8 @@ CListeningAiList::CListeningAiList()
bool CListeningAiList::IsQualified(const CEntity& ent) bool CListeningAiList::IsQualified(const CEntity& ent)
{ {
return TCastToConstPtr<CPatterned>(ent); TCastToConstPtr<CAi> ai(ent);
return ai && ai->IsListening();
} }
CAiWaypointList::CAiWaypointList() CAiWaypointList::CAiWaypointList()

View File

@ -18,5 +18,10 @@ CBeetle::CBeetle(TUniqueId uid, const std::string& name, const CEntityInfo& info
} }
void CBeetle::Accept(IVisitor &visitor)
{
visitor.Visit(this);
}
} }
} }

View File

@ -23,6 +23,8 @@ public:
const CPatternedInfo&, CPatterned::EFlavorType,EEntranceType, const CDamageInfo &, const CDamageVulnerability&, const CPatternedInfo&, CPatterned::EFlavorType,EEntranceType, const CDamageInfo &, const CDamageVulnerability&,
const zeus::CVector3f&, float, float, float, const CDamageVulnerability&, const CActorParameters&, const zeus::CVector3f&, float, float, float, const CDamageVulnerability&, const CActorParameters&,
const rstl::optional_object<CStaticRes>); const rstl::optional_object<CStaticRes>);
void Accept(IVisitor &visitor);
}; };
} }
} }

View File

@ -18,6 +18,7 @@ set(MP1_SOURCES
CWarWasp.hpp CWarWasp.cpp CWarWasp.hpp CWarWasp.cpp
CSpacePirate.hpp CSpacePirate.cpp CSpacePirate.hpp CSpacePirate.cpp
CBabygoth.hpp CBabygoth.cpp CBabygoth.hpp CBabygoth.cpp
CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp
CSaveUI.hpp CSaveUI.cpp CSaveUI.hpp CSaveUI.cpp
CMemoryCardDriver.hpp CMemoryCardDriver.cpp CMemoryCardDriver.hpp CMemoryCardDriver.cpp
CQuitScreen.hpp CQuitScreen.cpp CQuitScreen.hpp CQuitScreen.cpp

View File

View File

View File

@ -16,5 +16,10 @@ CNewIntroBoss::CNewIntroBoss(TUniqueId uid, const std::string& name, const CEnti
{ {
} }
void CNewIntroBoss::Accept(IVisitor &visitor)
{
visitor.Visit(this);
}
} }
} }

View File

@ -17,6 +17,8 @@ public:
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo, const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo,
u32, u32, u32, u32); u32, u32, u32, u32);
void Accept(IVisitor &visitor);
}; };
} }

View File

@ -14,5 +14,10 @@ CSpacePirate::CSpacePirate(TUniqueId uid, const std::string& name, const CEntity
{ {
} }
void CSpacePirate::Accept(IVisitor &visitor)
{
visitor.Visit(this);
}
} }
} }

View File

@ -12,6 +12,8 @@ class CSpacePirate : public CPatterned
public: public:
CSpacePirate(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&, CSpacePirate(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, const CPatternedInfo&, CInputStream&, u32); const CActorParameters&, const CPatternedInfo&, CInputStream&, u32);
void Accept(IVisitor &visitor);
}; };
} }
} }

View File

@ -10,12 +10,11 @@ CWarWasp::CWarWasp(TUniqueId uid, const std::string& name, const CEntityInfo& in
CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor, CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms, CPatterned::EColliderType collider, const CDamageInfo& dInfo1, const CActorParameters& actorParms,
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3) ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3)
: CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, : CPatterned(EUnknown::ThirtyNine, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, collider,
collider, EBodyType::Three, actorParms, false) EBodyType::Three, actorParms, false)
{ {
} }
void CWarWasp::Accept(IVisitor& visitor) { visitor.Visit(this); }
} }
} }

View File

@ -15,6 +15,8 @@ public:
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
CPatterned::EFlavorType flavor, CPatterned::EColliderType, const CDamageInfo& dInfo1, const CActorParameters&, CPatterned::EFlavorType flavor, CPatterned::EColliderType, const CDamageInfo& dInfo1, const CActorParameters&,
ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3); ResId weapon, const CDamageInfo& dInfo2, ResId particle, u32 w3);
void Accept(IVisitor &visitor);
}; };
} }
} }

View File

@ -8,60 +8,66 @@ class EndNamespace:
pass pass
CENTITY_TYPES = ( CENTITY_TYPES = (
# Class, Visit, Header
('CActor', 'World/CActor.hpp'), ('CActor', 'World/CActor.hpp'),
('CPhysicsActor', 'World/CPhysicsActor.hpp'), ('CBallCamera', 'Camera/CBallCamera.hpp'),
('CGameCamera', 'Camera/CGameCamera.hpp'), ('CBomb', 'Weapon/CBomb.hpp'),
('CPatterned', 'World/CPatterned.hpp'),
('CGameLight', 'World/CGameLight.hpp'),
('CAi', 'World/CAi.hpp'),
('CCinematicCamera', 'Camera/CCinematicCamera.hpp'), ('CCinematicCamera', 'Camera/CCinematicCamera.hpp'),
('CScriptHUDMemo', 'World/CScriptHUDMemo.hpp'), ('CCollisionActor', 'Collision/CCollisionActor.hpp'),
('CDestroyableRock', 'World/CDestroyableRock.hpp'),
('CEnergyProjectile', 'Weapon/CEnergyProjectile.hpp'),
('CEntity', 'World/CEntity.hpp'),
('CExplosion', 'Weapon/CExplosion.hpp'),
('CFirstPersonCamera', 'Camera/CFirstPersonCamera.hpp'),
('CFishCloud', 'World/CFishCloud.hpp'),
('CGameCamera', 'Camera/CGameCamera.hpp'),
('CGameLight', 'World/CGameLight.hpp'),
('CGameProjectile', 'Weapon/CGameProjectile.hpp'),
('CHUDBillboardEffect', 'World/CHUDBillboardEffect.hpp'),
Namespace('MP1'),
('CMetroidPrimeRelay', 'MP1/CMetroidPrimeRelay.hpp', 'MP1'),
EndNamespace(),
('CPathCamera', 'Camera/CPathCamera.hpp'),
('CAi', 'World/CAi.hpp'),
('CPhysicsActor', 'World/CPhysicsActor.hpp'),
('CPlayer', 'World/CPhysicsActor.hpp'),
('CRepulsor', 'World/CRepulsor.hpp'),
('CScriptActor', 'World/CScriptActor.hpp'),
('CScriptActorKeyframe', 'World/CScriptActorKeyframe.hpp'),
('CScriptAiJumpPoint', 'World/CScriptAiJumpPoint.hpp'),
('CScriptCameraHint', 'World/CScriptCameraHint.hpp'), ('CScriptCameraHint', 'World/CScriptCameraHint.hpp'),
('CScriptPickup', 'World/CScriptPickup.hpp'), ('CScriptCameraPitchVolume', 'World/CScriptCameraPitchVolume.hpp'),
('CScriptRandomRelay', 'World/CScriptRandomRelay.hpp'),
('CScriptMemoryRelay', 'World/CScriptMemoryRelay.hpp'),
('CScriptRelay', 'World/CScriptRelay.hpp'),
('CScriptCameraWaypoint', 'World/CScriptCameraWaypoint.hpp'), ('CScriptCameraWaypoint', 'World/CScriptCameraWaypoint.hpp'),
('CScriptCoverPoint', 'World/CScriptCoverPoint.hpp'), ('CScriptCoverPoint', 'World/CScriptCoverPoint.hpp'),
('CScriptSpawnPoint', 'World/CScriptSpawnPoint.hpp'), ('CScriptDebugCameraWaypoint', 'World/CScriptDebugCameraWaypoint.hpp'),
('CRepulsor', 'World/CRepulsor.hpp'),
('CScriptCameraHintTrigger', 'World/CScriptCameraHintTrigger.hpp'),
('CScriptSwitch', 'World/CScriptSwitch.hpp'),
('CScriptAiJumpPoint', 'World/CScriptAiJumpPoint.hpp'),
('CScriptColorModulate', 'World/CScriptColorModulate.hpp'),
('CScriptCameraPitchVolume', 'World/CScriptCameraPitchVolume.hpp'),
('CPlayer', 'World/CPlayer.hpp'),
('CScriptActor', 'World/CScriptActor.hpp'),
('CScriptWaypoint', 'World/CScriptWaypoint.hpp'),
('CScriptDoor', 'World/CScriptDoor.hpp'),
('CScriptActorKeyframe', 'World/CScriptActorKeyframe.hpp'),
('CScriptTrigger', 'World/CScriptTrigger.hpp'),
('CScriptSound', 'World/CScriptSound.hpp'),
('CWeapon', 'Weapon/CWeapon.hpp'),
('CGameProjectile', 'Weapon/CGameProjectile.hpp'),
('CBeamProjectile', 'Weapon/CBeamProjectile.hpp'),
('CPlasmaProjectile', 'Weapon/CPlasmaProjectile.hpp'),
('CScriptCounter', 'World/CScriptCounter.hpp'),
('CScriptBeam', 'World/CScriptBeam.hpp'),
('CScriptStreamedMusic', 'World/CScriptStreamedMusic.hpp'),
('CScriptTimer', 'World/CScriptTimer.hpp'),
('CScriptEffect', 'World/CScriptEffect.hpp'),
('CScriptPlatform', 'World/CScriptPlatform.hpp'),
('CScriptGrapplePoint', 'World/CScriptGrapplePoint.hpp'),
('CScriptGenerator', 'World/CScriptGenerator.hpp'),
('CScriptShadowProjector', 'World/CScriptShadowProjector.hpp'),
('CScriptDock', 'World/CScriptDock.hpp'),
('CScriptAreaAttributes', 'World/CScriptAreaAttributes.hpp'),
('CScriptPickupGenerator', 'World/CScriptPickupGenerator.hpp'),
('CScriptPointOfInterest', 'World/CScriptPointOfInterest.hpp'),
('CScriptCameraFilterKeyframe', 'World/CScriptCameraFilterKeyframe.hpp'),
('CScriptCameraBlurKeyframe', 'World/CScriptCameraBlurKeyframe.hpp'),
('CScriptActorRotate', 'World/CScriptActorRotate.hpp'),
('CScriptDistanceFog', 'World/CScriptDistanceFog.hpp'), ('CScriptDistanceFog', 'World/CScriptDistanceFog.hpp'),
('CScriptDamageableTrigger', 'World/CScriptDamageableTrigger.hpp'), ('CScriptDock', 'World/CScriptDock.hpp'),
('CScriptDockAreaChange', 'World/CScriptDockAreaChange.hpp'), ('CScriptDoor', 'World/CScriptDoor.hpp'),
('CScriptEffect', 'World/CScriptEffect.hpp'),
('CScriptGrapplePoint', 'World/CScriptGrapplePoint.hpp'),
('CScriptGunTurret', 'World/CScriptGunTurret.hpp'),
('CScriptMazeNode', 'World/CScriptMazeNode.hpp'),
('CScriptPickup', 'World/CScriptPickup.hpp'),
('CScriptPlatform', 'World/CScriptPlatform.hpp'),
('CScriptPlayerHint', 'World/CScriptPlayerHint.hpp'),
('CScriptPointOfInterest', 'World/CScriptPointOfInterest.hpp'),
('CScriptRoomAcoustics', 'World/CScriptRoomAcoustics.hpp'),
('CScriptSound', 'World/CScriptSound.hpp'),
('CScriptSpawnPoint', 'World/CScriptSpawnPoint.hpp'),
('CScriptSpecialFunction', 'World/CScriptSpecialFunction.hpp'), ('CScriptSpecialFunction', 'World/CScriptSpecialFunction.hpp'),
('CScriptDebris', 'World/CScriptDebris.hpp'), ('CScriptSpiderBallAttractionSurface', 'World/CScriptSpiderBallAttractionSurface.hpp'),
('CScriptSpiderBallWaypoint', 'World/CScriptSpiderBallWaypoint.hpp'),
('CScriptTargetingPoint', 'World/CScriptTargetingPoint.hpp'),
('CTeamAiMgr', 'World/CTeamAiMgr.hpp'),
('CScriptTimer', 'World/CScriptTimer.hpp'),
('CScriptTrigger', 'World/CScriptTrigger.hpp'),
('CScriptVisorFlare', 'World/CScriptVisorFlare.hpp'),
('CScriptWater', 'World/CScriptWater.hpp'),
('CScriptWaypoint', 'World/CScriptWaypoint.hpp'),
('CSnakeWeedSwarm', 'World/CSnakeWeedSwarm.hpp'),
('CScriptSpindleCamera', 'World/CScriptSpindleCamera.hpp'),
('CWallCrawlerSwarm', 'World/CWallCrawlerSwarm.hpp'),
('CWeapon', 'Weapon/CWeapon.hpp'),
) )
def getqualified(tp): def getqualified(tp):

0
Runtime/Weapon/CBomb.cpp Normal file
View File

0
Runtime/Weapon/CBomb.hpp Normal file
View File

View File

View File

View File

View File

View File

@ -21,6 +21,10 @@ set(WEAPON_SOURCES
CGameProjectile.hpp CGameProjectile.cpp CGameProjectile.hpp CGameProjectile.cpp
CBeamProjectile.hpp CBeamProjectile.cpp CBeamProjectile.hpp CBeamProjectile.cpp
CBeamInfo.hpp CBeamInfo.cpp CBeamInfo.hpp CBeamInfo.cpp
CPlasmaProjectile.hpp CPlasmaProjectile.cpp) CPlasmaProjectile.hpp CPlasmaProjectile.cpp
CEnergyProjectile.cpp CEnergyProjectile.cpp
CExplosion.hpp CExplosion.cpp
CBomb.hpp CBomb.cpp
CPowerBomb.hpp CPowerBomb.cpp)
runtime_add_list(Weapon WEAPON_SOURCES) runtime_add_list(Weapon WEAPON_SOURCES)

View File

View File

View File

@ -46,7 +46,7 @@ public:
virtual CDamageVulnerability GetDamageVulnerability() { return x260_damageVulnerability; } virtual CDamageVulnerability GetDamageVulnerability() { return x260_damageVulnerability; }
virtual void TakeDamage(const zeus::CVector3f&, float) {} virtual void TakeDamage(const zeus::CVector3f&, float) {}
virtual bool CanBeShot(const CStateManager&, int) { return true; } virtual bool CanBeShot(const CStateManager&, int) { return true; }
virtual bool IsListening() { return false; } virtual bool IsListening() const { return false; }
virtual int Listen(const zeus::CVector3f&, EListenNoiseType) { return 0; } virtual int Listen(const zeus::CVector3f&, EListenNoiseType) { return 0; }
virtual void Patrol(CStateManager&, EStateMsg, float) {} virtual void Patrol(CStateManager&, EStateMsg, float) {}

View File

View File

View File

View File

View File

View File

View File

@ -45,6 +45,8 @@ set(WORLD_SOURCES
CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp
CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
CFishCloud.hpp CFishCloud.cpp
CScriptVisorFlare.hpp CScriptVisorFlare.cpp
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
CScriptCoverPoint.hpp CScriptCoverPoint.cpp CScriptCoverPoint.hpp CScriptCoverPoint.cpp
CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp
@ -58,17 +60,25 @@ set(WORLD_SOURCES
CScriptCameraBlurKeyframe.hpp CScriptCameraBlurKeyframe.cpp CScriptCameraBlurKeyframe.hpp CScriptCameraBlurKeyframe.cpp
CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp
CScriptDebris.hpp CScriptDebris.cpp CScriptDebris.hpp CScriptDebris.cpp
CScriptDebugCameraWaypoint.hpp CScriptDebugCameraWaypoint.cpp
CScriptDistanceFog.hpp CScriptDistanceFog.cpp CScriptDistanceFog.hpp CScriptDistanceFog.cpp
CScriptDockAreaChange.hpp CScriptDockAreaChange.cpp CScriptDockAreaChange.hpp CScriptDockAreaChange.cpp
CScriptActorRotate.hpp CScriptActorRotate.cpp CScriptActorRotate.hpp CScriptActorRotate.cpp
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
CScriptPlayerHint.hpp CScriptPlayerHint.cpp
CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp
CScriptPlayerActor.hpp CScriptPlayerActor.cpp CScriptPlayerActor.hpp CScriptPlayerActor.cpp
CScriptSwitch.hpp CScriptSwitch.cpp CScriptSwitch.hpp CScriptSwitch.cpp
CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp
CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp
CScriptColorModulate.hpp CScriptColorModulate.cpp CScriptColorModulate.hpp CScriptColorModulate.cpp
CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp
CRepulsor.hpp CRepulsor.cpp CRepulsor.hpp CRepulsor.cpp
CScriptGunTurret.hpp CScriptGunTurret.cpp
CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp
CTeamAiMgr.hpp CTeamAiMgr.cpp
CSnakeWeedSwarm.hpp CSnakeWeedSwarm.cpp
CScriptSpindleCamera.hpp CScriptSpindleCamera.cpp
CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp
CScriptBeam.hpp CScriptBeam.cpp CScriptBeam.hpp CScriptBeam.cpp
CScriptMazeNode.hpp CScriptMazeNode.cpp CScriptMazeNode.hpp CScriptMazeNode.cpp
@ -94,6 +104,8 @@ set(WORLD_SOURCES
CFluidPlaneCPU.hpp CFluidPlaneCPU.cpp CFluidPlaneCPU.hpp CFluidPlaneCPU.cpp
CFluidPlaneDoor.hpp CFluidPlaneDoor.cpp CFluidPlaneDoor.hpp CFluidPlaneDoor.cpp
CRippleManager.hpp CRippleManager.cpp CRippleManager.hpp CRippleManager.cpp
CRipple.hpp CRipple.cpp) CRipple.hpp CRipple.cpp
CDestroyableRock.hpp CDestroyableRock.cpp
CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp)
runtime_add_list(World WORLD_SOURCES) runtime_add_list(World WORLD_SOURCES)

View File

@ -25,9 +25,4 @@ CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, CPatter
{ {
} }
void CPatterned::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
} }

View File

@ -41,7 +41,6 @@ public:
CPatterned::EMovementType movement, EColliderType collider, EBodyType body, CPatterned::EMovementType movement, EColliderType collider, EBodyType body,
const CActorParameters& params, bool b1); const CActorParameters& params, bool b1);
void Accept(IVisitor& visitor);
virtual void Death(const zeus::CVector3f&, CStateManager&) {} virtual void Death(const zeus::CVector3f&, CStateManager&) {}
virtual void KnockBack(const zeus::CVector3f&, CStateManager&) {} virtual void KnockBack(const zeus::CVector3f&, CStateManager&) {}
}; };

View File

View File

View File

View File

View File

@ -27,14 +27,14 @@ void CScriptRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CS
if (x30_24_active) if (x30_24_active)
return; return;
x38_++; x38_refCount++;
TUniqueId tmp = stateMgr.xf76_; TUniqueId tmp = stateMgr.GetLastRelayId();
while (tmp != kInvalidUniqueId) while (tmp != kInvalidUniqueId)
{ {
const CEntity* obj = stateMgr.GetObjectById(tmp); const CEntity* obj = stateMgr.GetObjectById(tmp);
if (!obj) if (!obj)
{ {
tmp = x34_; tmp = x34_nextRelay;
continue; continue;
} }
@ -44,19 +44,19 @@ void CScriptRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CS
if (tmp == kInvalidUniqueId) if (tmp == kInvalidUniqueId)
return; return;
x34_ = stateMgr.xf76_; x34_nextRelay = stateMgr.GetLastRelayId();
stateMgr.xf76_ = GetUniqueId(); stateMgr.SetLastRelayId(GetUniqueId());
} }
} }
void CScriptRelay::Think(float, CStateManager& stateMgr) void CScriptRelay::Think(float, CStateManager& stateMgr)
{ {
if (x38_ == 0) if (x38_refCount == 0)
return; return;
while (x38_ != 0) while (x38_refCount != 0)
{ {
x38_--; x38_refCount--;
SendScriptMsgs(EScriptObjectState::Zero, stateMgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Zero, stateMgr, EScriptObjectMessage::None);
} }
UpdateObjectRef(stateMgr); UpdateObjectRef(stateMgr);
@ -64,17 +64,18 @@ void CScriptRelay::Think(float, CStateManager& stateMgr)
void CScriptRelay::UpdateObjectRef(CStateManager& stateMgr) void CScriptRelay::UpdateObjectRef(CStateManager& stateMgr)
{ {
TUniqueId* tmp = &stateMgr.xf76_; TUniqueId* tmp = stateMgr.GetLastRelayIdPtr();
while (*tmp != kInvalidUniqueId && tmp != nullptr) while (*tmp != kInvalidUniqueId && tmp != nullptr)
{ {
if (*tmp == GetUniqueId()) if (*tmp == GetUniqueId())
{ {
*tmp = x34_; *tmp = x34_nextRelay;
return; return;
} }
const CScriptRelay* obj = TCastToConstPtr<CScriptRelay>(stateMgr.GetObjectById(*tmp)); CScriptRelay* obj = dynamic_cast<CScriptRelay*>(stateMgr.ObjectById(*tmp));
if (obj) if (obj == nullptr)
tmp = (TUniqueId*)&obj->x34_; return;
tmp = &obj->x34_nextRelay;
} }
} }

View File

@ -7,8 +7,8 @@ namespace urde
{ {
class CScriptRelay : public CEntity class CScriptRelay : public CEntity
{ {
TUniqueId x34_ = kInvalidUniqueId; TUniqueId x34_nextRelay = kInvalidUniqueId;
u32 x38_ = 0; u32 x38_refCount = 0;
public: public:
CScriptRelay(TUniqueId, const std::string&, const CEntityInfo&, bool); CScriptRelay(TUniqueId, const std::string&, const CEntityInfo&, bool);

View File

View File

View File

View File

View File

@ -0,0 +1,34 @@
#include "World/CScriptTargetingPoint.hpp"
#include "World/CActorParameters.hpp"
#include "TCastTo.hpp"
namespace urde
{
CScriptTargetingPoint::CScriptTargetingPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown),
CActorParameters::None(), kInvalidUniqueId)
{
}
void CScriptTargetingPoint::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptTargetingPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
CActor::AcceptScriptMsg(msg, uid, mgr);
if (msg == EScriptObjectMessage::Deactivate || msg == EScriptObjectMessage::Activate)
CEntity::SendScriptMsgs(EScriptObjectState::Attack, mgr, EScriptObjectMessage::None);
}
void CScriptTargetingPoint::Think(float dt, CStateManager&)
{
if (xec_time <= 0.f)
return;
xec_time -= dt;
}
bool CScriptTargetingPoint::GetLocked() const { return !x20_conns.empty(); }
}

View File

@ -0,0 +1,34 @@
#ifndef __URDE_CSCRIPTTARGETINGPOINT_HPP__
#define __URDE_CSCRIPTTARGETINGPOINT_HPP__
#include "World/CActor.hpp"
namespace urde
{
class CScriptTargetingPoint : public CActor
{
private:
union
{
struct
{
bool xe8_e4_ : 1;
};
u8 xe8_dummy = 0;
};
TUniqueId xea_;
float xec_time = 0.f;
public:
CScriptTargetingPoint(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, bool);
void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
void Think(float, CStateManager &);
void Render(const CStateManager &) const {}
bool GetLocked() const;
};
}
#endif // __URDE_CSCRIPTTARGETINGPOINT_HPP__

View File

@ -58,8 +58,8 @@ void CScriptTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CS
x148_29_didPhazonDamage = false; x148_29_didPhazonDamage = false;
} }
if (x8_uid == mgr.GetLastTrigger()) if (x8_uid == mgr.GetLastTriggerId())
mgr.SetLastTrigger(kInvalidUniqueId); mgr.SetLastTriggerId(kInvalidUniqueId);
} }
} }
@ -229,8 +229,8 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr)
{ {
if (x128_forceMagnitude > 0.f && (x12c_flags & ETriggerFlags::DetectPlayer) != ETriggerFlags::None && if (x128_forceMagnitude > 0.f && (x12c_flags & ETriggerFlags::DetectPlayer) != ETriggerFlags::None &&
mgr.GetLastTrigger() == kInvalidUniqueId) mgr.GetLastTriggerId() == kInvalidUniqueId)
mgr.SetLastTrigger(x8_uid); mgr.SetLastTriggerId(x8_uid);
testFlags |= ETriggerFlags::DetectPlayer; testFlags |= ETriggerFlags::DetectPlayer;
if (pl->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed) if (pl->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed)

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File