different approach on boxes
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
|
||||
class CPolyExpTrigger;
|
||||
|
||||
///
|
||||
/// Interface for exp item stuff
|
||||
///
|
||||
class IExpItem
|
||||
{
|
||||
public:
|
||||
@@ -14,15 +17,17 @@ public:
|
||||
{
|
||||
CHL2MP_Player* loc = ToHL2MPPlayer(pOther);
|
||||
loc->AddExperience(EXP_PER_CUBE);
|
||||
Msg("ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss");
|
||||
AlreadyGrabbedBySomeone = true;
|
||||
UTIL_Remove((CBaseEntity*)this);
|
||||
UTIL_Remove(dynamic_cast<CBaseEntity*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
bool AlreadyGrabbedBySomeone;
|
||||
};
|
||||
|
||||
//
|
||||
// Exp item with physics
|
||||
//
|
||||
class CExpItemPhys : public CPhysicsProp, public IExpItem
|
||||
{
|
||||
DECLARE_CLASS(CExpItemPhys, CPhysicsProp);
|
||||
@@ -45,40 +50,14 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// void MarkAsTouchedBy(CBaseEntity* pOther)
|
||||
// {
|
||||
// if (!AlreadyGrabbedBySomeone)
|
||||
// {
|
||||
// CHL2MP_Player* loc = ToHL2MPPlayer(pOther);
|
||||
// loc->AddExperience(EXP_PER_CUBE);
|
||||
// AlreadyGrabbedBySomeone = true;
|
||||
// //SetCollisionGroup(COLLISION_GROUP_DEBRIS);
|
||||
// UTIL_RemoveImmediate(this);
|
||||
// }
|
||||
// }
|
||||
|
||||
/*void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
|
||||
{
|
||||
IPhysicsObject *pPhysObj = pEvent->pObjects[!index];
|
||||
CBaseEntity *pOther = static_cast<CBaseEntity *>(pPhysObj->GetGameData());
|
||||
|
||||
if( pOther->IsPlayer() && !AlreadyGrabbedBySomeone)
|
||||
{
|
||||
CHL2MP_Player* loc = ToHL2MPPlayer(pOther);
|
||||
loc->AddExperience(EXP_PER_CUBE);
|
||||
AlreadyGrabbedBySomeone = true;
|
||||
SetCollisionGroup(COLLISION_GROUP_DEBRIS);
|
||||
UTIL_Remove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::VPhysicsCollision(index,pEvent);
|
||||
}*/
|
||||
|
||||
protected:
|
||||
CPolyExpTrigger* m_trigger;
|
||||
};
|
||||
|
||||
//
|
||||
// Exp item without physics
|
||||
//
|
||||
|
||||
class CExpItem : public CBaseAnimating, public IExpItem
|
||||
{
|
||||
DECLARE_CLASS(CExpItem, CBaseAnimating);
|
||||
@@ -96,36 +75,6 @@ public:
|
||||
|
||||
void Spawn();
|
||||
|
||||
// void MarkAsTouchedBy(CBaseEntity* pOther)
|
||||
// {
|
||||
// if (!AlreadyGrabbedBySomeone)
|
||||
// {
|
||||
// CHL2MP_Player* loc = ToHL2MPPlayer(pOther);
|
||||
// loc->AddExperience(EXP_PER_CUBE);
|
||||
// AlreadyGrabbedBySomeone = true;
|
||||
// //SetCollisionGroup(COLLISION_GROUP_DEBRIS);
|
||||
// UTIL_RemoveImmediate(this);
|
||||
// }
|
||||
// }
|
||||
|
||||
/*void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
|
||||
{
|
||||
IPhysicsObject *pPhysObj = pEvent->pObjects[!index];
|
||||
CBaseEntity *pOther = static_cast<CBaseEntity *>(pPhysObj->GetGameData());
|
||||
|
||||
if( pOther->IsPlayer() && !AlreadyGrabbedBySomeone)
|
||||
{
|
||||
CHL2MP_Player* loc = ToHL2MPPlayer(pOther);
|
||||
loc->AddExperience(EXP_PER_CUBE);
|
||||
AlreadyGrabbedBySomeone = true;
|
||||
SetCollisionGroup(COLLISION_GROUP_DEBRIS);
|
||||
UTIL_Remove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::VPhysicsCollision(index,pEvent);
|
||||
}*/
|
||||
|
||||
protected:
|
||||
CPolyExpTrigger* m_trigger;
|
||||
};
|
||||
@@ -133,6 +82,9 @@ protected:
|
||||
LINK_ENTITY_TO_CLASS(exp_item_phys, CExpItemPhys);
|
||||
LINK_ENTITY_TO_CLASS(exp_item, CExpItem);
|
||||
|
||||
///
|
||||
/// Trigger for Exp item
|
||||
///
|
||||
class CPolyExpTrigger : public CBaseTrigger
|
||||
{
|
||||
public:
|
||||
@@ -153,7 +105,7 @@ public:
|
||||
|
||||
pTrigger->SetParent(pOwner);
|
||||
|
||||
pTrigger->m_pOwner = (IExpItem*)pOwner;
|
||||
pTrigger->m_pOwner = dynamic_cast<IExpItem*>(pOwner);
|
||||
|
||||
return pTrigger;
|
||||
|
||||
@@ -161,11 +113,6 @@ public:
|
||||
|
||||
virtual bool PassesTriggerFilters(CBaseEntity* pOther)
|
||||
{
|
||||
//bool bPassedFilter = BaseClass::PassesTriggerFilters(pOther);
|
||||
//
|
||||
//// did I fail the baseclass filter check?
|
||||
//if (!bPassedFilter)
|
||||
// return false;
|
||||
|
||||
// did a player touch me?
|
||||
if (pOther->IsPlayer())
|
||||
@@ -201,15 +148,11 @@ public:
|
||||
protected:
|
||||
IExpItem* m_pOwner;
|
||||
};
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS(trigger_poly_exp_item, CPolyExpTrigger);
|
||||
|
||||
BEGIN_DATADESC(CPolyExpTrigger)
|
||||
|
||||
DEFINE_FIELD(m_pOwner, FIELD_CLASSPTR),
|
||||
|
||||
END_DATADESC()
|
||||
// ignore that stuff ^
|
||||
|
||||
void CExpItemPhys::Spawn()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user