gPlayerWall Class Reference

#include <gWall.h>

Inheritance diagram for gPlayerWall:

Inheritance graph
[legend]
Collaboration diagram for gPlayerWall:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 gPlayerWall (gNetPlayerWall *w, gCycle *p)
virtual ~gPlayerWall ()
virtual void Flip ()
virtual void SplitByActive (eWall *oldWall)
virtual bool RunsParallelActive (eWall *oldWall)
virtual bool Splittable () const
virtual bool Deletable () const
virtual void Split (eWall *&w1, eWall *&w2, REAL a)
virtual void Render (const eCamera *cam)
void RenderList (bool list)
virtual REAL BlockHeight () const
virtual REAL SeeHeight () const
int WindingNumber () const
REAL LocalToGlobal (REAL a) const
 transform alpha value of this wall into alpha value of underlying net wall
REAL GlobalToLocal (REAL a) const
 transform alpha value of underlying net wall to value of this wall
REAL Time (REAL a) const
REAL Pos (REAL a) const
REAL Alpha (REAL pos) const
bool IsDangerousAnywhere (REAL time) const
bool IsDangerous (REAL a, REAL time) const
gExplosionHoler (REAL a, REAL time) const
void BlowHole (REAL dbeg, REAL dend, gExplosion *holer)
REAL BegPos () const
REAL EndPos () const
REAL BegTime () const
REAL EndTime () const
gCycleCycle () const
gCycleMovementCycleMovement () const
gNetPlayerWallNetWall () const
void Insert ()

Private Member Functions

void Check () const
 tCONTROLLED_PTR (gCycle) cycle_
 tCONTROLLED_PTR (gNetPlayerWall) netWall_
 gPlayerWall ()

Private Attributes

int windingNumber_
REAL begDist_
REAL endDist_

Friends

class gNetPlayerWall


Detailed Description

Definition at line 81 of file gWall.h.


Constructor & Destructor Documentation

gPlayerWall::gPlayerWall ( gNetPlayerWall w,
gCycle p 
)

Definition at line 555 of file gWall.cpp.

References CHECKWALL, and windingNumber_.

00557         :eWall(p->grid),cycle_(p),netWall_(w),begDist_(w->Pos(0)),endDist_(w->Pos(1))
00558 {
00559     CHECKWALL;
00560 
00561     if (cycle_)
00562         windingNumber_ = cycle_->WindingNumber();
00563 
00564 #ifdef DEBUG
00565     if (!cycle_)
00566     {
00567         //              st_Breakpoint();
00568     }
00569 #endif

gPlayerWall::~gPlayerWall (  )  [virtual]

Definition at line 571 of file gWall.cpp.

References CHECKWALL.

00572                          {
00573     CHECKWALL;

gPlayerWall::gPlayerWall (  )  [private]

Referenced by Split().

Here is the caller graph for this function:


Member Function Documentation

void gPlayerWall::Flip (  )  [virtual]

Reimplemented from eWall.

Definition at line 577 of file gWall.cpp.

References CHECKWALL, eWall::Flip(), and Swap().

00578                       {
00579     CHECKWALL;
00580 
00581     eWall::Flip();
00582     Swap( this->begDist_, this->endDist_ );
00583 
00584     CHECKWALL;

Here is the call graph for this function:

void gPlayerWall::SplitByActive ( eWall oldWall  )  [virtual]

Reimplemented from eWall.

Definition at line 699 of file gWall.cpp.

References Cycle(), eCoord, eWall::Edge(), eHalfEdge::IntersectWithCareless(), sg_TopologyPoliceCheck(), sg_TopologyPoliceKill(), and eWall::SplitByActive().

00701 {
00702     if ( oldWall )
00703     {
00704         // pretend our cycle crossed the old wall just now
00705         eCoord intersection = oldWall->Edge()->IntersectWithCareless( Edge() );
00706         sg_TopologyPoliceCheck( Cycle(), oldWall, this, intersection, true );
00707     }
00708     else
00709     {
00710         sg_TopologyPoliceKill( Cycle() );
00711     }
00712 
00713     eWall::SplitByActive( oldWall );

Here is the call graph for this function:

bool gPlayerWall::RunsParallelActive ( eWall oldWall  )  [virtual]

Reimplemented from eWall.

Definition at line 716 of file gWall.cpp.

References Cycle(), eCoord, eWall::Point(), eWall::RunsParallelPassive(), sg_TopologyPoliceCheck(), and sg_TopologyPoliceKill().

00718 {
00719     if ( oldWall )
00720     {
00721 
00722         // collision point: center of gravity
00723         eCoord collision = ( oldWall->Point(.5f) + this->Point(.5f) ) *.5f;
00724 
00725         sg_TopologyPoliceCheck( Cycle(), oldWall, this, collision, false );
00726     }
00727     else
00728     {
00729         sg_TopologyPoliceKill( Cycle() );
00730     }
00731 
00732     return eWall::RunsParallelPassive( oldWall );

Here is the call graph for this function:

bool gPlayerWall::Splittable (  )  const [virtual]

Reimplemented from eWall.

Definition at line 734 of file gWall.cpp.

bool gPlayerWall::Deletable (  )  const [virtual]

Reimplemented from eWall.

Definition at line 736 of file gWall.cpp.

References CHECKWALL, IsDangerousAnywhere(), and se_GameTime().

00737                                  {
00738     CHECKWALL;
00739 
00740     // a wall without a cycle can clearly be deleted
00741     if ( !cycle_ )
00742         return true;
00743 
00744     return !IsDangerousAnywhere( se_GameTime() - 1.0f );

Here is the call graph for this function:

void gPlayerWall::Split ( eWall *&  w1,
eWall *&  w2,
REAL  a 
) [virtual]

Reimplemented from eWall.

Definition at line 760 of file gWall.cpp.

References begDist_, Check(), CHECKWALL, endDist_, gPlayerWall(), tNEW, and windingNumber_.

00761                                                      {
00762     CHECKWALL;
00763 
00764     gPlayerWall *W1, *W2;
00765 
00766     W1=tNEW(gPlayerWall(netWall_,cycle_));
00767     W2=tNEW(gPlayerWall(netWall_,cycle_));
00768     W1->windingNumber_ = windingNumber_;
00769     W2->windingNumber_ = windingNumber_;
00770     W1->begDist_ = begDist_;
00771     W2->endDist_ = endDist_;
00772     W1->endDist_ = W2->begDist_ = begDist_ + ( endDist_ - begDist_ ) * a;
00773 
00774     /*
00775         int divindex = IndexPos( mp );
00776         int i;
00777 
00778         // transfer front points
00779         W1->coords_.SetLen( divindex + 2 );
00780         for ( i = divindex+1; i>=0; --i )
00781                 W1->coords_(i) = coords_(i);
00782 
00783         W1->coords_(divindex+1).Pos  = mp;
00784         W1->coords_(divindex+1).Time = mt;
00785 
00786         // transfer rear points
00787         W2->coords_.SetLen( coords_.Len() - divindex );
00788         for ( i = coords_.Len() - divindex - 1 ; i>=0; --i )
00789                 W2->coords_(i) = coords_( divindex + i );
00790 
00791         W2->coords_(0).Pos  = mp;
00792         W2->coords_(0).Time = mt;
00793 
00794         if ( flipped )
00795                 Swap( W1, W2 );
00796     */
00797 
00798     // store wall pointers
00799     w1 = W1;
00800     w2 = W2;
00801 
00802 #ifdef DEBUG
00803     W1->Check();
00804     W2->Check();
00805 #endif
00806 
00807     CHECKWALL;

Here is the call graph for this function:

void gPlayerWall::Render ( const eCamera cam  )  [virtual]

Reimplemented from eWall.

Definition at line 820 of file gWall.cpp.

References RenderList().

00821                                           {
00822     if (!cycle_)
00823         return;
00824     RenderList(true);

Here is the call graph for this function:

void gPlayerWall::RenderList ( bool  list  ) 

Definition at line 854 of file gWall.cpp.

Referenced by Render().

00856 {
00857     netWall_->RenderList( list );

Here is the caller graph for this function:

REAL gPlayerWall::BlockHeight (  )  const [virtual]

Reimplemented from eWall.

Definition at line 1269 of file gWall.cpp.

Referenced by SeeHeight().

01270                                    {
01271     if (bool(cycle_) && cycle_->Alive()==1)
01272         return 1;
01273     else
01274         return 0;

Here is the caller graph for this function:

REAL gPlayerWall::SeeHeight ( void   )  const [virtual]

Reimplemented from eWall.

Definition at line 1276 of file gWall.cpp.

References BlockHeight().

01277                                  {
01278     return BlockHeight();

Here is the call graph for this function:

int gPlayerWall::WindingNumber ( void   )  const [inline]

Definition at line 107 of file gWall.h.

References windingNumber_.

Referenced by gHitData::AddHit(), blocks(), and gCycleChatBot::Sensor::DoExtraDetectionStuff().

00107 {return windingNumber_;}

Here is the caller graph for this function:

REAL gPlayerWall::LocalToGlobal ( REAL  a  )  const

transform alpha value of this wall into alpha value of underlying net wall

Definition at line 1303 of file gWall.cpp.

References begDist_, CHECKWALL, endDist_, good(), REAL, and tASSERT.

Referenced by Holer(), IsDangerous(), and Time().

01305 {
01306     CHECKWALL;
01307 
01308     tASSERT( good( a ) );
01309 
01310     REAL dist = begDist_ + a * ( endDist_ - begDist_ );
01311     REAL ret = netWall_->Alpha( dist );
01312 
01313     tASSERT( good( ret ) );
01314 
01315     return ret;

Here is the call graph for this function:

Here is the caller graph for this function:

REAL gPlayerWall::GlobalToLocal ( REAL  a  )  const

transform alpha value of underlying net wall to value of this wall

Definition at line 1328 of file gWall.cpp.

References begDist_, CHECKWALL, endDist_, good(), REAL, and tASSERT.

01330 {
01331     CHECKWALL;
01332 
01333     tASSERT( good( a ) );
01334 
01335     REAL dist = netWall_->Pos( a );
01336 
01337     REAL div = ( endDist_ - begDist_ );
01338     if ( div == 0 )
01339     {
01340         return .5f;
01341     }
01342     else
01343     {
01344         REAL ret = ( dist - begDist_ ) / div;
01345 
01346         tASSERT( good( ret ) );
01347 
01348         return ret;
01349     }

Here is the call graph for this function:

REAL gPlayerWall::Time ( REAL  a  )  const

Definition at line 1351 of file gWall.cpp.

References good(), LocalToGlobal(), and tASSERT.

Referenced by gEnemyInfluence::AddWall(), gCycleChatBot::Sensor::DoExtraDetectionStuff(), gCycle::EdgeIsDangerous(), gCycleExtrapolator::EdgeIsDangerous(), gCycle::PassEdge(), S_BlowHoles(), and sg_TopologyPoliceCheck().

01353 {
01354     tASSERT( good( a ) );
01355 
01356     return netWall_->Time( LocalToGlobal( a ) );

Here is the call graph for this function:

Here is the caller graph for this function:

REAL gPlayerWall::Pos ( REAL  a  )  const

Definition at line 1358 of file gWall.cpp.

References begDist_, CHECKWALL, endDist_, good(), and tASSERT.

Referenced by gHitData::AddHit(), blocks(), Check(), gCycleChatBot::Sensor::DoExtraDetectionStuff(), gCycleExtrapolator::EdgeIsDangerous(), gCycle::PassEdge(), S_BlowHoles(), and gCycleMovement::TimestepCore().

01360 {
01361     CHECKWALL;
01362 
01363     tASSERT( good( a ) );
01364 
01365     return begDist_ + ( endDist_ - begDist_ ) * a;

Here is the call graph for this function:

Here is the caller graph for this function:

REAL gPlayerWall::Alpha ( REAL  pos  )  const

Definition at line 1367 of file gWall.cpp.

References a, begDist_, CHECKWALL, endDist_, REAL, and tASSERT.

01369 {
01370     CHECKWALL;
01371 
01372     REAL diff = ( endDist_  - begDist_ );
01373     REAL a = pos - begDist_;
01374 
01375     if ( diff > 0 )
01376         a /= diff;
01377 
01378     tASSERT ( -.001 < a );
01379     tASSERT ( 1.001 > a );
01380 
01381     return a;

bool gPlayerWall::IsDangerousAnywhere ( REAL  time  )  const

Definition at line 1383 of file gWall.cpp.

References CHECKWALL.

Referenced by Deletable().

01385 {
01386     CHECKWALL;
01387 
01388     return netWall_->IsDangerousAnywhere( time );

Here is the caller graph for this function:

bool gPlayerWall::IsDangerous ( REAL  a,
REAL  time 
) const

Definition at line 1390 of file gWall.cpp.

References CHECKWALL, and LocalToGlobal().

Referenced by gCycleMovement::EdgeIsDangerous(), sg_TopologyPoliceCheck(), and gCycleMovement::TimestepCore().

01392 {
01393     CHECKWALL;
01394 
01395     return netWall_->IsDangerous( LocalToGlobal( a ), time );

Here is the call graph for this function:

Here is the caller graph for this function:

gExplosion * gPlayerWall::Holer ( REAL  a,
REAL  time 
) const

Definition at line 1398 of file gWall.cpp.

References CHECKWALL, and LocalToGlobal().

Referenced by gCycle::PassEdge().

01400 {
01401     CHECKWALL;
01402 
01403     return netWall_->Holer( LocalToGlobal( a ), time );

Here is the call graph for this function:

Here is the caller graph for this function:

void gPlayerWall::BlowHole ( REAL  dbeg,
REAL  dend,
gExplosion holer 
)

Definition at line 1433 of file gWall.cpp.

References CHECKWALL.

Referenced by S_BlowHoles().

01435 {
01436     CHECKWALL;
01437 
01438     this->netWall_->BlowHole( beg, end, holer );

Here is the caller graph for this function:

REAL gPlayerWall::BegPos (  )  const

Definition at line 1412 of file gWall.cpp.

References begDist_, and CHECKWALL.

Referenced by S_BlowHoles().

01414 {
01415     CHECKWALL;
01416 
01417     return this->begDist_;

Here is the caller graph for this function:

REAL gPlayerWall::EndPos (  )  const

Definition at line 1405 of file gWall.cpp.

References CHECKWALL, and endDist_.

Referenced by S_BlowHoles().

01407 {
01408     CHECKWALL;
01409 
01410     return this->endDist_;

Here is the caller graph for this function:

REAL gPlayerWall::BegTime (  )  const

Definition at line 1426 of file gWall.cpp.

References CHECKWALL.

Referenced by gSensor::PassEdge(), and S_BlowHoles().

01428 {
01429     CHECKWALL;
01430 
01431     return netWall_->Time( netWall_->Alpha( this->begDist_ ) );

Here is the caller graph for this function:

REAL gPlayerWall::EndTime (  )  const

Definition at line 1419 of file gWall.cpp.

References CHECKWALL.

Referenced by gSensor::PassEdge(), and S_BlowHoles().

01421 {
01422     CHECKWALL;
01423 
01424     return netWall_->Time( netWall_->Alpha( this->endDist_ ) );

Here is the caller graph for this function:

gCycle * gPlayerWall::Cycle (  )  const

Definition at line 1281 of file gWall.cpp.

Referenced by gHitData::AddHit(), gEnemyInfluence::AddWall(), blocks(), gCycleChatBot::Sensor::DoExtraDetectionStuff(), gCycle::EdgeIsDangerous(), gCycleExtrapolator::EdgeIsDangerous(), gCycleMovement::GetMaxSpaceAhead(), gSensor::PassEdge(), gCycle::PassEdge(), RunsParallelActive(), SplitByActive(), and gCycle::TimestepCore().

Here is the caller graph for this function:

gCycleMovement * gPlayerWall::CycleMovement (  )  const

Definition at line 1282 of file gWall.cpp.

Referenced by gCycle::EdgeIsDangerous(), sg_DropTempWall(), and gCycleMovement::TimestepCore().

01282 {return cycle_;}

Here is the caller graph for this function:

gNetPlayerWall * gPlayerWall::NetWall (  )  const

Definition at line 1283 of file gWall.cpp.

Referenced by gCycle::EdgeIsDangerous(), gCycleExtrapolator::EdgeIsDangerous(), and gCycle::OnDropTempWall().

01283 {return cycle_;}

Here is the caller graph for this function:

void gPlayerWall::Insert (  ) 

Reimplemented from eWall.

Definition at line 1285 of file gWall.cpp.

References CHECKWALL, and eWall::Insert().

Referenced by gNetPlayerWall::Clear(), gNetPlayerWall::PartialCopyIntoGrid(), and gNetPlayerWall::real_CopyIntoGrid().

01287 {
01288     CHECKWALL;
01289 
01290     eWall::Insert();

Here is the call graph for this function:

Here is the caller graph for this function:

void gPlayerWall::Check (  )  const [private]

Definition at line 1292 of file gWall.cpp.

References begDist_, endDist_, EPS, Pos(), REAL, and tASSERT.

Referenced by gNetPlayerWall::ReadSync(), gNetPlayerWall::real_Update(), and Split().

01294 {
01295     netWall_->Check();
01296 #ifdef DEBUG
01297     REAL range = 5 * fabs(begDist_) + fabs(endDist_) * EPS;
01298     tASSERT( begDist_ <= endDist_ + range );
01299     tASSERT( begDist_ >= netWall_->Pos( 0 ) - range );
01300     tASSERT( endDist_ <= netWall_->Pos( 1 ) + range );
01301 #endif

Here is the call graph for this function:

Here is the caller graph for this function:

gPlayerWall::tCONTROLLED_PTR ( gCycle   )  [private]

gPlayerWall::tCONTROLLED_PTR ( gNetPlayerWall   )  [private]


Friends And Related Function Documentation

friend class gNetPlayerWall [friend]

Definition at line 83 of file gWall.h.


Member Data Documentation

int gPlayerWall::windingNumber_ [private]

Definition at line 142 of file gWall.h.

Referenced by gPlayerWall(), Split(), and WindingNumber().

REAL gPlayerWall::begDist_ [private]

Definition at line 144 of file gWall.h.

Referenced by Alpha(), BegPos(), Check(), GlobalToLocal(), LocalToGlobal(), gNetPlayerWall::PartialCopyIntoGrid(), Pos(), gNetPlayerWall::real_Update(), and Split().

REAL gPlayerWall::endDist_ [private]

Definition at line 144 of file gWall.h.

Referenced by Alpha(), Check(), EndPos(), GlobalToLocal(), LocalToGlobal(), gNetPlayerWall::PartialCopyIntoGrid(), Pos(), gNetPlayerWall::real_Update(), and Split().


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:44:43 2008 for Armagetron Advanced by  doxygen 1.5.4