void CGonomeSpit::Animate( void ) { pev->nextthink = gpGlobals->time + 0.1; if ( pev->frame++ ) { if ( pev->frame > m_maxFrame ) { pev->frame = 0; } } }
//========================================================= // Gonome's spit projectile //========================================================= class CGonomeSpit : public CBaseEntity { public: void Spawn( void ); static void Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ); void Touch( CBaseEntity *pOther ); void EXPORT Animate( void ); virtual int Save( CSave &save ); virtual int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; int m_maxFrame; };
void mycallback() { } void worker(void (*fn)()) { (*fn)(); } void main() { // accepted only by devstudio 6 and lower worker(mycallback); // old compiler makes an implicit cast to a function call // function parameter for new devstudio worker(&mycallback); // new compiler needs an explicit cast to a function call }
// old compilerclass A{public: void Do(){} void worker(void (A::*fn)()) { (this->*fn)(); }};void main(){ A a; a.worker(A::Do);}
// new compilervoid main(){ A a; a.worker(&A::Do);}
SetThink ( &CBaseEntity::SUB_Remove );
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)