Game Development Reference
In-Depth Information
/*
===============
RespawnItem
===============
*/
(0) void RespawnItem( gentity_t *ent ) {
(1) // randomly select from teamed entities
(2) if (ent->team) {
(3) gentity_t *master;
(4) int count;
(5) int choice;
(6) if ( !ent->teammaster ) {
(7) G_Error( “RespawnItem: bad teammaster�?);
(8) }
(9) master = ent->teammaster;
(10) for ( count = 0, ent = master;
(11) ent;
(12) ent = ent->teamchain, count++)
(13) ;
(14) choice = rand() % count;
(15) for ( count = 0, ent = master;
(16) count < choice;
(17) ent = ent->teamchain, count++)
(18) ;
(19) }
(20) ent->r.contents = CONTENTS_TRIGGER;
(21) //ent->s.eFlags &= ~EF_NODRAW;
(22) ent->flags &= ~FL_NODRAW;
(23) ent->r.svFlags &= ~SVF_NOCLIENT;
(24) trap_LinkEntity (ent);
(25) // play the normal respawn sound only to nearby clients
(26) G_AddEvent( ent, EV_ITEM_RESPAWN, 0 );
(27) ent->nextthink = 0;
}
Search WWH ::




Custom Search