ai.c:    if( (et = entity_type(ent->type)) == NULL ) {
ai.c:	printf("%s: BAD entity type %d\n", __FILE__, ent->type);
ai.c:    if( ent->ai_moving && ent->mode >= ALIVE ) {
ai.c:	ent->x_v += sin_lookup[ ent->dir ] * et->accel;
ai.c:	ent->y_v += -cos_lookup[ ent->dir ] * et->accel;
ai.c:/* Find appropriate threat and face it, setting ent->target appropriately.
ai.c:    for( targ = root ; targ != NULL ; targ = targ->next ) {
ai.c:	if( targ == ent || targ->id == ent->pid )
ai.c:	if( ent->pid != 0 && targ->pid == ent->pid )
ai.c:	if( targ->mode >= ALIVE && ( opposite ? ( targ->class != targ_type ) : ( targ->class == targ_type ) ) ) {
ai.c:		ent->dir = calculate_dir(ent, targ);
ai.c:		ent->target = targ;
ai.c:    return -1; /* No threats near */
ai.c:    et = entity_type(ai->type);
ai.c:    if( ai_face_threat(ai, et->sight, NEUTRAL, 1) >= 0 ) {
ai.c:	ai->dir += DEGREES/2; /* Face AWAY from threat. */
ai.c:	ai->ai_moving = 1;
ai.c:	ai->mode = ALIVE; /* Stop Fidgeting */
ai.c:	ai->speed = et->speed;
ai.c:    } else if( ai->mode == ALIVE && (ai->x_v || ai->y_v) ) {
ai.c:	    ai->mode = FIDGETING;
ai.c:	    ai->ai_moving = 0;
ai.c:    } else if( ai->mode == ALIVE ) {
ai.c:	ai->speed = et->speed/2;
ai.c:	ai->ai_moving = 1;
ai.c:    if( ai->mode == FIDGETING ) {
ai.c:	    ai->mode = ALIVE;
ai.c:	    ai->dir = rand()%256;
ai.c:	    ai->ai_moving = 0;
ai.c:    et = entity_type(ai->type);
ai.c:    ai->speed = et->speed;
ai.c:    if( ai_face_threat(ai, et->sight, GOODIE, 0) >= 0 ) {
ai.c:	ai->mode = ALIVE;
ai.c:    } else if( (ai->x_v || ai->y_v) == 0 ) { /* Stationary */
ai.c:        if( ai->mode != PATROL || !(rand() % (10*server.fps)) ) {
ai.c:	    ai->mode = PATROL;
ai.c:	    ai->dir = rand()%DEGREES;
ai.c:	    ai->ai_moving = 1;
ai.c:    et = entity_type(shooter->type);
ai.c:    shooter->ai_moving = 1;
ai.c:    shooter->speed = et->speed;
ai.c:    dist = ai_face_threat(shooter, et->sight, target, 0);
ai.c:	shooter->mode = ALIVE;
ai.c:	    shooter->weapon = 3;
ai.c:	    shooter->ai_moving = 0;
ai.c:	    shooter->trigger = 1;
ai.c:	    shooter->trigger = 0;
ai.c:    } else if( shooter->mode != PATROL || !(rand() % (10*server.fps)) ) {
ai.c:        shooter->mode = PATROL;
ai.c:        shooter->dir = rand()%DEGREES;
ai.c:    if( (et = entity_type(ai->type)) == NULL ) {
ai.c:	printf("%s: BAD entity type %d\n", __FILE__, ai->type);
ai.c:    if( ai->target ) {
ai.c:	ai->dir = calculate_dir(ai, ai->target);
ai.c:    } else if( ai_face_threat(ai, et->sight, ITEM, 1) >= 0 ) {
ai.c:	ai->ai_moving = 1;
ai.c:	ai->ai_moving = 0;
ai.c:    float deg = DEGREES/(M_PI*2); /* to convert from radians -> our degrees*/
ai.c:    et = entity_type(ent->type);
ai.c:    ex = ent->x + et->width/2;
ai.c:    ey = ent->y + et->height/2;
ai.c:    et = entity_type(target->type);
ai.c:    tx = target->x + et->width/2.0;
ai.c:    ty = target->y + et->height/2.0;
ai.c:	    opp = tx - ex;
ai.c:	    opp = ty - ey;
ai.c:	    opp = ex - tx;
ai.c:	    opp = ey - ty;
ai.c:   was found by using the co-ordinates in the gimp, what a terrible hack... */
ai.c:    olddir = (ai->dir + 16)/32;
ai.c:    ai->dir += (256 / ((float)server.fps / M_SEC)) / MSECS_PER_ROTATION;
ai.c:    dir = (ai->dir + 16)/32;
ai.c:	x  = gun_pos[dir%8][0] - gun_pos[olddir%8][0];
ai.c:	y  = gun_pos[dir%8][1] - gun_pos[olddir%8][1];
ai.c:	ai->x -= x;
ai.c:	ai->y -= y;
entity.c:    et = entity_type(ent->type);
entity.c:    msg.particles.dir = ent->dir;
entity.c:    msg.particles.color1 = ent->drip1;
entity.c:    msg.particles.color2 = ent->drip2;
entity.c:    msg.particles.x = ent->x + ent->width / 2;
entity.c:    msg.particles.y = ent->y + ent->height / 2;
entity.c:    et = entity_type(ent->type);
entity.c:    msg.particles.length = 2 * et->width / 3;
entity.c:    msg.particles.x = ent->x + et->width/2;
entity.c:    msg.particles.y = ent->y + et->height/2;
entity.c:    for( ent = root ; ent != NULL ; ent = ent->next ) {
entity.c:	et = entity_type(ent->type);
entity.c:	if( ent->dripping )
entity.c:	    if( now - ent->last_drip >= et->drip_time ) {
entity.c:		ent->last_drip = now;
entity.c:	if( ent->mode == LIMBO )
entity.c:	    if( now >= ent->respawn_time ) {
entity.c:		ent->mode = ALIVE;
entity.c:		ent->respawn_time = 0;
entity.c:	next = ent->next;
entity.c:	if( ent->mode >= ALIVE && ent->health <= 0 )
entity.c:	if( ent->mode == DEAD ) {
entity.c:	    if( ent->controller == CTRL_CLIENT )
entity.c:    for( ent = root ;  ent != NULL ; ent = ent->next ) {
entity.c:	if( ent->mode >= ALIVE && ent->ai && ent->controller == CTRL_AI ) {
entity.c:	    switch( ent->ai ) {
entity.c:		if( ent->class == GOODIE )
entity.c:	if( ent->class != PROJECTILE )
entity.c:	et = entity_type(ent->type);
entity.c:	if( ent->x_v > 0 ) {
entity.c:	    if( ent->x_v > et->speed )
entity.c:		ent->x_v = et->speed;
entity.c:	} else if( ent->x_v < 0 ) {
entity.c:	    if( ent->x_v < -et->speed )
entity.c:		ent->x_v = -et->speed;
entity.c:	if( ent->y_v > 0 ) {
entity.c:	    if( ent->y_v > et->speed )
entity.c:		ent->y_v = et->speed;
entity.c:	} else if( ent->y_v < 0 ) {
entity.c:	    if( ent->y_v < -et->speed )
entity.c:		ent->y_v = -et->speed;
entity.c:    to handle collision between first and the second->class's that
entity.c:    come after first's->class.
entity.c:    switch( second->class ) {
entity.c:	et = entity_type( second->type );
entity.c:	goodie->health -= et->touchdamage / server.fps;
entity.c:	shooter = findent(second->pid);
entity.c:	pt.x = second->x;
entity.c:	pt.y = second->y;
entity.c:	weapon_hit( shooter, goodie, pt, second->weapon );
entity.c:	second->health = 0; /* Remove projectile */
entity.c:    switch( second->class ) {
entity.c:	shooter = findent(second->pid);
entity.c:	pt.x = second->x;
entity.c:	pt.y = second->y;
entity.c:	weapon_hit( shooter, baddie, pt, second->weapon);
entity.c:	second->health = 0; /* Remove projectile */
entity.c:    switch( second->class ) {
entity.c:	shooter = findent(second->pid);
entity.c:	pt.x = second->x;
entity.c:	pt.y = second->y;
entity.c:	weapon_hit( shooter, neutral, pt, second->weapon);
entity.c:	second->health = 0; /* Remove projectile */
entity.c:    switch( second->class ) {
entity.c:    switch( second->class ) {
entity.c:	if( (shooter = findent(proj->pid)) != NULL ) {
entity.c:	    pt.x = proj->x;
entity.c:	    pt.y = proj->y;
entity.c:	    weapon_hit( shooter, second, pt, proj->weapon);
entity.c:	if( (shooter = findent(second->pid)) != NULL ) {
entity.c:	    pt.x = second->x;
entity.c:	    pt.y = second->y;
entity.c:	    weapon_hit( shooter, proj, pt, second->weapon);
entity.c:    for( ent1 = root ; ent1 != NULL ; ent1 = ent1->next ) {
entity.c:	d1 = MAX( ent1->width, ent1->height );
entity.c:	if( ent1->mode < ALIVE || ent1->health <= 0 )
entity.c:	for( ent2 = ent1->next ; ent2 != NULL ; ent2 = ent2->next ) {
entity.c:	    if( ent1->class == NEUTRAL && ent2->class == NEUTRAL )
entity.c:	    if( ent2->mode < ALIVE || ent1->health <= 0 )
entity.c:	    if( ent1->pid == ent2->id || ent2->pid == ent1->id )
entity.c:	    d2 = MAX( ent2->width, ent2->height );
entity.c:		   entity-class enumeration) with args (lowest, highest) */
entity.c:		if( ent1->class < ent2->class ) {
entity.c:		handle_collision[first->class]( first, second );
entity.c:	tail->next = ent;
entity.c:    ent->prev = tail;
entity.c:    tail->next = NULL;
entity.c:    ent->id = id_num;
entity.c:    ent->x = x;
entity.c:    ent->y = y;
entity.c:    ent->x_v = x_v;
entity.c:    ent->y_v = y_v;
entity.c:    ent->type = type;
entity.c:    ent->class = et->class;
entity.c:    ent->mode = ALIVE;
entity.c:    ent->speed = et->speed;
entity.c:    ent->width = et->width;
entity.c:    ent->height = et->height;
entity.c:    ent->health = et->health;
entity.c:    ent->dripping = et->dripping;
entity.c:    ent->drip1 = et->drip1;
entity.c:    ent->drip2 = et->drip2;
entity.c:    ent->color1 = COL_WHITE;
entity.c:    ent->color2 = COL_BLUE;
entity.c:    ent->controller = CTRL_AI;
entity.c:    ent->visible = 1;
entity.c:	if( (ent->has_weapon = (char *)malloc(num_weapon_types)) == NULL ) {
entity.c:	    ERR_QUIT("Error malloc'ing has_weapon array", -1);
entity.c:    if( et->ai )
entity.c:	ent->ai = et->ai;
entity.c:	switch( et->class ) {
entity.c:	    ent->ai = AI_FIGHT;
entity.c:	    ent->ai = AI_FLEE;
entity.c:	    ent->ai = AI_NONE;
entity.c:	    if( et->item_action == GIVEWEAPON )
entity.c:		ent->ai = AI_ROTATE;
entity.c:    class_population[ ent->class ]++;
entity.c:      et->name, type, ent->class, num_entities);
entity.c:    if( ent->class == PROJECTILE ) {
entity.c:	wt = weapon_type(ent->weapon);
entity.c:	if( wt->explosion )
entity.c:	free( ent->has_weapon );
entity.c:    num_entities--;
entity.c:    class_population[ ent->class ]--;
entity.c:      printf("Deleted a %s (%d entities left)\n", entity_type(ent->type)->name,
entity.c:	root = ent->next;
entity.c:	tail = ent->prev;
entity.c:    if( ent->prev )
entity.c:	ent->prev->next = ent->next;
entity.c:    if( ent->next )
entity.c:	ent->next->prev = ent->prev;
entity.c:	next = ent->next;
entity.c:    msg.entity.entity_type = ent->type;
entity.c:    msg.entity.dir = ent->dir;
entity.c:    msg.entity.mode = ent->mode;
entity.c:    msg.entity.x = ent->x + 0.5; /* Round floats to integers */
entity.c:    msg.entity.y = ent->y + 0.5;
entity.c:    msg.entity.img = ent->img;
entity.c:    msg.entity.weapon = ent->weapon;
entity.c:    if( victim->class == PROJECTILE || victim->class == ITEM ) {
entity.c:	victim->frags--;
entity.c:	if( victim->name ) {
entity.c:	    snprintf(buf, TEXTMESSAGE_STRLEN, "%s couldn't cope",victim->name);
entity.c:	    if( victim->class != GOODIE )
entity.c:	    if( victim->class == NEUTRAL )
entity.c:		change--;
entity.c:	shooter->frags += change;
entity.c:    if( victim->name && shooter->name ) {
entity.c:	if( (wt = weapon_type(weaptype)) && wt->obituary )
entity.c:	    snprintf(buf, TEXTMESSAGE_STRLEN, wt->obituary,
entity.c:		     victim->name, shooter->name);
entity.c:		     "A %s was killed by a %s.", victim->name, shooter->name);
entity.c:    for( ent = root ;  ent != NULL ; ent = ent->next ) {
entity.c:	if( ani->images > 1 ) {
entity.c:	    if( ani->stationary_ani ) /* Animates when stationary */
entity.c:	    else if( ent->x_v || ent->y_v ) /* Moving */
entity.c:	    if( now - ent->last_frame >= ani->framelen ) {
entity.c:		ent->last_frame = now;
entity.c:		if( ++ent->frame >= ani->frames ) {
entity.c:		    if( ent->mode == DYING )
entity.c:			ent->mode = DEAD;
entity.c:			ent->frame = 0;
entity.c:	    ent->img = ani->order[ent->frame];
entity.c:	    et = entity_type(ent->type);
entity.c:	    if( ent->mode == DYING ) {
entity.c:		printf("Killed off %s\n", et->name);
entity.c:		ent->mode = DEAD;
entity.c:		ent->img = 0;
entity.c:    et = entity_type(ent->type);
entity.c:    ani = et->animation[ ent->mode ];
entity.c:	if( (ani = et->animation[ ALIVE ]) == NULL ) {
entity.c:		   __FILE__, ent->mode, et->name);
entity.c:	    ERR_QUIT("No ALIVE animation. Fix your \"entity\" file!", -1);
entity.c:    et_0 = entity_type(ent0->type);
entity.c:    et_1 = entity_type(ent1->type);
entity.c:    x_dist = (ent0->x + et_0->width/2.0) - (ent1->x + et_1->width/2.0);
entity.c:    y_dist = (ent0->y + et_0->height/2.0) - (ent1->y + et_1->height/2.0);
entity.c:/* Find entity that has the entity-id of id */ 
entity.c:    for( ent=root ; ent != NULL ; ent = ent->next ) {
entity.c:	if( ent->id == id )
entity.c:    et = entity_type(ent->type);
entity.c:    if( et->animation[ DYING ] ) {
entity.c:		ent->mode = DYING;
entity.c:		ent->last_frame = gettime();
entity.c:		ent->frame = 0;
entity.c:		ent->mode = DEAD;
entity.c:	for(  seeker =  root ; seeker != NULL ; seeker = seeker->next ) {
entity.c:			if( seeker->target == ent )
entity.c:					seeker->target = NULL;
entity.c:	ent->next = NULL;
event.c:    if( ent->cl ) {
event.c:		event->data.message.text,
event.c:	net_send_message(ent->cl->fd, msg);
event.c:	   event->data.teleport.x, event->data.teleport.y);
event.c:    ent->x = event->data.teleport.x * TILE_W;
event.c:    ent->y = event->data.teleport.y * TILE_H;
event.c:    ent->dir = event->data.teleport.dir;
event.c:    ent->speed = event->data.teleport.speed;
event.c:    ent->x_v = sin_lookup[ent->dir] * ent->speed;
event.c:    ent->y_v = -cos_lookup[ent->dir] * ent->speed;
event.c:    ent->health -= event->data.damage.damage;
event.c:    strcpy(game.next_map_name, event->data.endlevel.map);
event.c:	if( ent->class != GOODIE || event->active == 0 ) {
event.c:	event->active = event->repeat;
event.c:	       id, event_name[ event->type ]);
event.c:	return event_trigger_handle[event->type](ent, event);
event.c:	ERR_QUIT("Allocating new tmp node for an event", -1);
event.c:	event_tail->next = ptr;
event.c:    event_tail->next = NULL; /* end of list */
event.c:    return &ptr->event;
event.c:	ERR_QUIT("Error allocating event_tab[] array", -1);
event.c:	next = ptr->next;
event.c:	event_tab[i] = ptr->event;
event.c:    for(i=0 ; i<map->width * map->height ; i++ ) {
event.c:	map->event[i] = event_symbol_table[ (int)map->event[i] ];
event.c:	if( (e = map->event[i]) ) {
event.c:		   i%map->width, i/map->height);
event.c:    if( map->event == NULL )
event.c:    for( y=0 ; y<map->height ; y++ ) {
event.c:	for( x=0 ; x<map->width ; x++ ) {
event.c:	    if( (e = map->event[ y*map->width + x ]) ) {
event.c:		    net_send_message(cl->fd, msg);
event.c:		    net_send_message(cl->fd, msg);
event.c:    strncpy(event->data.message.text, args, TEXTMESSAGE_STRLEN);
event.c:	event->data.teleport.x = x;
event.c:	event->data.teleport.y = y;
event.c:	event->data.teleport.dir = dir;
event.c:	event->data.teleport.speed = speed;
event.c:    strncpy(event->data.endlevel.map, args, NETMSG_STRLEN);
event.c:	event->data.damage.damage = damage;
event.c:    event_type = -1;
event.c:	    event->type = i;
event.c:	    event->active = (a == 'y');
event.c:	    event->repeat = (r == 'y');
event.c:	    event->visible = (v == 'y');
hitscan.c:    if( wt->wallstop ) {
hitscan.c:	if( wt->max_length ) {
hitscan.c:	    if( length > wt->max_length )
hitscan.c:		length = wt->max_length;
hitscan.c:	length = wt->max_length; /* There must be a limit to it */
hitscan.c:    weap_end.y -= cos_lookup[dir] * length;
hitscan.c:    if( hitscan_entity(weap_start, weap_end, ent, &length, wt->entstop) ) {
hitscan.c:	weap_end.y -= cos_lookup[dir] * length;
hitscan.c:    switch( wt->class ) {
hitscan.c:	msg.particles.color1 = ent->color1;
hitscan.c:	msg.particles.color2 = ent->color2;
hitscan.c:	msg.particles.color1 = ent->color1;
hitscan.c:	msg.particles.color2 = ent->color2;
hitscan.c:	next = ent->next;
hitscan.c:	et = entity_type(ent->type);
hitscan.c:	TL.x = ent->x;
hitscan.c:	TL.y = ent->y;
hitscan.c:	TR.x = ent->x + et->width;
hitscan.c:	TR.y = ent->y;
hitscan.c:	BL.x = ent->x;
hitscan.c:	BL.y = ent->y + et->height;
hitscan.c:	BR.x += et->width;
hitscan.c:		weapon_hit(shooter, ent, P, shooter->weapon);
hitscan.c:	weapon_hit(shooter, victim, B, shooter->weapon);	
hitscan.c:    ox = -1;
hitscan.c:    oy = -1;
hitscan.c:	end.y -= cos_lookup[dir];
hitscan.c:	    if( y < 0 || y >= map->height )
hitscan.c:	    if( x < 0 || x >= map->width )
hitscan.c:	    if( map->base[ y * map->width + x ] == ALLCLIP ) {
hitscan.c:		if( y == map->height-1 )
hitscan.c:		if( map->base[(y+1)*map->width+x] == ALLCLIP)
hitscan.c:		    ox = -1; /* So we'll check next loop */
item.c:    it = entity_type( item->type );
item.c:    et = entity_type( ent->type );
item.c:    if( it->class != ITEM ) {
item.c:	printf("Error: item_collision called for a non-item!\n");
item.c:    switch( it->item_action ) {
item.c:	new_health = ent->health + it->item_value;
item.c:	if( new_health > et->health )
item.c:	    new_health = et->health; /* keep new_health <= et->health */
item.c:	if( ent->health == new_health ) { /* No change, don't pickup */
item.c:	ent->health = new_health;
item.c:	if( ent->health == et->health ) { /* Already at max */
item.c:	ent->health = et->health; /* Back to maximum */
item.c:	if( it->item_value >= num_weapon_types ) {
item.c:		   it->item_value);
item.c:	} else if( game.mode == HOLYWAR && ent->has_weapon[it->item_type] ) {
item.c:	    wt = weapon_type(it->item_type);
item.c:	    ent->has_weapon[ it->item_type ] = 1;
item.c:	    ent->ammo[wt->ammo_type] += wt->initial_ammo;
item.c:	    ent->weapon = it->item_type>ent->weapon?it->item_type:ent->weapon; 
item.c:	ent->ammo[it->item_type] += it->item_value; 
item.c:	printf("ITEM ACTION %d NOT HANDLED!\n", it->item_action);
item.c:	if( game.mode == HOLYWAR && it->item_respawn_time ) {
item.c:	    item->mode = LIMBO;
item.c:	    item->respawn_time = gettime() + it->item_respawn_time;
item.c:	    item->health = 0; /* Remove item for good */
main.c:      if(argv[i][0] == '-') {
main.c:	      if( i < argc - 1 )
main.c:	      if( i < argc - 1 ) { /* There are more args */
main.c:	      if( i < argc - 1 )
main.c:	      if( i < argc - 1 ) {
main.c:		     "  -c CLIENTS Set maxclients to CLIENTS\n"
main.c:		     "  -m MAP     select map of name MAP\n"
main.c:		     "  -p PORT    use port PORT\n"
main.c:		     "  -v         Print version number.\n"
main.c:		     "  -h         Display help (this screen)\n\n"
misc.c:/* Give co-ordinates of top left hand corner of view window centering around
misc.c:    if( (et = entity_type(cl->ent->type)) == NULL )
misc.c:	ERR_QUIT("Invalid entity type for focus", -1);
misc.c:    ani = et->animation[ cl->ent->mode ];
misc.c:	       et->name, cl->ent->mode);
misc.c:	if( (ani = et->animation[ ALIVE ]) == NULL ) {
misc.c:		   et->name, cl->ent->mode);
misc.c:	    ERR_QUIT("Damnit, fix your \"entity\" file!", -1);
misc.c:    x = cl->ent->x + ani->img_w/2;
misc.c:    y = cl->ent->y + ani->img_h/2;
misc.c:    x -= cl->view_w / 2;
misc.c:    y -= cl->view_h / 2;
misc.c:    if( x >= map->width * TILE_W - cl->view_w )
misc.c:        x = map->width * TILE_W - cl->view_w;
misc.c:    if( y >= map->height * TILE_H - cl->view_h)
misc.c:        y = map->height * TILE_H - cl->view_h;
sv_map.c:   use the same map, or -1 on complete failure */
sv_map.c:	    return -1;
sv_map.c:	return -1;
sv_map.c:    ent->x = spawnpoint[i].x;
sv_map.c:    ent->y = spawnpoint[i].y;
sv_map.c:    ent->x_v = spawnpoint[i].x_v;
sv_map.c:    ent->y_v = spawnpoint[i].y_v;
sv_map.c:    ent->dir = spawnpoint[i].dir;
sv_map.c:    ent->health = entity_type(ent->type)->health;
sv_map.c:    ent->mode = ALIVE;
sv_map.c:    memset(ent->ammo, 0, sizeof(ent->ammo));
sv_map.c:	return -1;
sv_map.c:    printf("\"%s\": %d entities %d spawn-points.\n",
sv_map.c:    y_v = -cos_lookup[dir] * speed;
sv_map.c:	if( strcasecmp( et->name, name ) == 0 ) {
sv_map.c:	    if( et->class == BADDIE || et->class == GOODIE ) {
sv_map.c:	    new->dir = dir;
sv_net.c:	return -1;
sv_net.c:	return -1;
sv_net.c:	next = cl->next;
sv_net.c:	if( cl->incoming ) {
sv_net.c:	    if( (rfd = net_buffered_read( cl->fd )) > 0 ) {
sv_net.c:		cl->incoming = 0;
sv_net.c:		if( ++cl->bad >= MAX_BAD )
sv_net.c:		    printf("Read error %d for %s\n", cl->bad, cl->name);
sv_net.c:	if( cl->status == ACTIVE )
sv_net.c:    for( cl = cl_root ; cl != NULL ; cl = cl->next ) {
sv_net.c:	if( cl->fd == -1 || cl->status != ACTIVE )
sv_net.c:	cl->screenpos = calculate_screenpos(cl);
sv_net.c:	msg.start_frame.screenpos = cl->screenpos;
sv_net.c:	net_send_message(cl->fd, msg);
sv_net.c:    for( cl = cl_root ; cl != NULL ; cl = cl->next ) {
sv_net.c:	if( cl->fd == -1 || cl->status != ACTIVE )
sv_net.c:	for( ent = root ; ent != NULL ; ent = ent->next ) {
sv_net.c:	    if( ent->mode == LIMBO || ent->visible == 0 )
sv_net.c:	    if( ent->x + ani->img_w < cl->screenpos.x )
sv_net.c:	    if( ent->x > cl->screenpos.x + cl->view_w )
sv_net.c:	    if( ent->y + ani->img_h < cl->screenpos.y )
sv_net.c:	    if( ent->y > cl->screenpos.y + cl->view_h )
sv_net.c:	    if( cl->ent == ent )
sv_net.c:	    net_send_message(cl->fd, msg);
sv_net.c:	net_send_message(cl->fd, msg);
sv_net.c:    for( cl = cl_root ; cl != NULL ; cl = cl->next )
sv_net.c:	if( cl->status == ACTIVE && cl->fd > 0 ) {
sv_net.c:	    net_send_message( cl->fd, msg);
sv_net.c:    for( cl = cl_root ; cl != NULL ; cl = cl->next ) {
sv_net.c:	net_send_message(cl->fd, msg);
sv_net.c:	cl->status = JOINING; /* Clients will send ready notices when done */
sv_net.c:    server.clients--;
sv_net.c:	     cl->name, server.clients);
sv_net.c:    close( cl->fd );
sv_net.c:    if( cl->ent ) {
sv_net.c:	entity_delete( cl->ent );
sv_net.c:	cl_root = cl->next;
sv_net.c:	cl_tail = cl->prev;
sv_net.c:    if( cl->prev )
sv_net.c:	cl->prev->next = cl->next;
sv_net.c:    if( cl->next )
sv_net.c:	cl->next->prev = cl->prev;
sv_net.c:    for( cl = cl_root ; cl != NULL ; cl = cl->next )
sv_net.c:	FD_SET(cl->fd, &read_fds);
sv_net.c:    for( cl = cl_root ; cl != NULL ; cl = cl->next )
sv_net.c:	if( FD_ISSET(cl->fd, &read_fds) )
sv_net.c:	    cl->incoming = 1;
sv_net.c:          if( cl-> a != cl->ent-> a ) { cl-> a = cl->ent-> a ; change = 1; } 
sv_net.c:    wt = weapon_type( cl->ent->weapon );
sv_net.c:    if( cl->weapon_ammo != cl->ent->ammo[ wt->ammo_type ] ) {
sv_net.c:	cl->weapon_ammo = cl->ent->ammo[ wt->ammo_type ];
sv_net.c:    ent = cl->ent; /* Saves typing */
sv_net.c:    if( ent->mode < ALIVE )
sv_net.c:    accel = entity_type(ent->type)->accel;
sv_net.c:    if( cl->keypress & FORWARD_BIT ) {
sv_net.c:	ent->x_v += sin_lookup[ ent->dir ] * accel;
sv_net.c:	ent->y_v -= cos_lookup[ ent->dir ] * accel;
sv_net.c:    if( cl->keypress & BACK_BIT ) {
sv_net.c:	ent->x_v -= sin_lookup[ ent->dir ] * accel;
sv_net.c:	ent->y_v += cos_lookup[ ent->dir ] * accel;
sv_net.c:    if( cl->keypress & S_LEFT_BIT ) {
sv_net.c:	dir = ent->dir - DEGREES / 4; /* 1/4 rotation LEFT */
sv_net.c:	ent->x_v += sin_lookup[ dir ] * accel;
sv_net.c:	ent->y_v -= cos_lookup[ dir ] * accel;
sv_net.c:    if( cl->keypress & S_RIGHT_BIT ) {
sv_net.c:	dir = ent->dir + DEGREES / 4; /* 1/4 rotation RIGHT */
sv_net.c:	ent->x_v += sin_lookup[ dir ] * accel;
sv_net.c:	ent->y_v -= cos_lookup[ dir ] * accel;
sv_net.c:    if( cl->keypress & B1_BIT ) {
sv_net.c:	ent->trigger = 1;
sv_net.c:	ent->trigger = 0;
sv_net.c:    if( cl->keypress & B3_BIT )
sv_net.c:	ent->weapon_switch = 1; /* UP */
sv_net.c:    else if( cl->keypress & B4_BIT )
sv_net.c:	ent->weapon_switch = -1; /* DOWN */
sv_net.c:/* Add the client that's been accept()-ed onto fd */
sv_net.c:	cl_tail->next = cl;
sv_net.c:    cl->prev = cl_tail;
sv_net.c:    cl->next = NULL;
sv_net.c:    cl->fd = fd;
sv_net.c:    cl->status = JOINING;
sv_net.c:    cl->incoming = 0;
sv_net.c:    cl->bad = 0;
sv_net.c:    cl->ent = NULL;
sv_net.c:	   net_message_name(msg.type), cl->name, net_get_address(cl->fd));
sv_net.c:/* Handle message and return the message type (-1 on error) */
sv_net.c:	       msg.type, cl->name);
sv_net.c:	return -1;
sv_netmsg_recv.c:  clients, and no-ops should be there to say that the clients still active
sv_netmsg_recv.c:    printf("Got no-op from %s\n", cl->name);
sv_netmsg_recv.c:    strncpy(msg.textmessage.sender, cl->name, 32);
sv_netmsg_recv.c:    cl->status = JOINING;
sv_netmsg_recv.c:    strcpy(cl->name, msg.join.name);
sv_netmsg_recv.c:    printf("%s attempting to JOIN (%d clients)\n", cl->name, server.clients);
sv_netmsg_recv.c:	sv_netmsg_send_rejection(cl->fd, "Can't have name eq Server");
sv_netmsg_recv.c:	return -1; /* Client is now removed */
sv_netmsg_recv.c:    if( cl->status == JOINING ) {
sv_netmsg_recv.c:	cl->ent = entity_new( msg.ready.entity_type, 0, 0, 0, 0);
sv_netmsg_recv.c:	cl->ent->controller = CTRL_CLIENT;
sv_netmsg_recv.c:	cl->ent->name = cl->name;
sv_netmsg_recv.c:	cl->ent->cl = cl;
sv_netmsg_recv.c:	spawn(cl->ent);
sv_netmsg_recv.c:		 cl->name, entity_type(cl->ent->type)->name);
sv_netmsg_recv.c:    cl->status = ACTIVE;
sv_netmsg_recv.c:    cl->ent->color1 = msg.ready.color1;
sv_netmsg_recv.c:    cl->ent->color2 = msg.ready.color2;
sv_netmsg_recv.c:    cl->view_w = msg.ready.view_w;
sv_netmsg_recv.c:    cl->view_h = msg.ready.view_h;
sv_netmsg_recv.c:    cl->health = cl->ent->health;
sv_netmsg_recv.c:    cl->weapon = cl->ent->weapon;
sv_netmsg_recv.c:    if( cl->status == ACTIVE && cl->fd > 0 ) {
sv_netmsg_recv.c:	if( cl->ent->mode >= ALIVE )
sv_netmsg_recv.c:	    cl->ent->dir = msg.cl_update.dir;
sv_netmsg_recv.c:	cl->keypress = msg.cl_update.keypress;
sv_netmsg_send.c:    net_send_message(cl->fd, msg);
sv_netmsg_send.c:    net_send_message(cl->fd, msg);
sv_netmsg_send.c:    net_send_message(cl->fd, msg);
sv_netmsg_send.c:    net_send_message(cl->fd, msg);
sv_netmsg_send.c:    net_send_message(cl->fd, msg);
sv_netmsg_send.c:    msg.update_statusbar.health = cl->health;
sv_netmsg_send.c:    msg.update_statusbar.ammo = cl->ammo;
sv_netmsg_send.c:    msg.update_statusbar.weapon = cl->weapon;
sv_netmsg_send.c:    msg.update_statusbar.frags = cl->frags;
sv_netmsg_send.c:    net_send_message(cl->fd, msg);
weapon.c:	if( et->weapon_name == NULL )
weapon.c:	if( et->class == ITEM && et->item_action == GIVEWEAPON ) {
weapon.c:	    if( (weapon = match_weapon_type( et->weapon_name )) > 0 )
weapon.c:		et->item_type = weapon;
weapon.c:		et->item_type = 0;
weapon.c:	    if( (weapon = match_weapon_type( et->weapon_name )) > 0 )
weapon.c:		et->weapon = weapon;
weapon.c:		et->weapon = 0;
weapon.c:    for( ent = root ; ent != NULL ; ent = ent->next ) {
weapon.c:	if( ent->trigger )
weapon.c:	if( ent->weapon_switch ) {
weapon.c:	    if( now - ent->last_switch >= WEAPON_SWITCH_TIME ) {
weapon.c:		weap = ent->weapon;
weapon.c:		    weap += ent->weapon_switch;
weapon.c:			weap = num_weapon_types - 1;
weapon.c:		} while( ent->has_weapon[ weap ] == 0 );
weapon.c:		ent->weapon = weap;
weapon.c:		ent->last_switch = now;
weapon.c:		ent->weapon_switch = 0;
weapon.c:    if( (wt = weapon_type(ent->weapon)) == NULL ) {
weapon.c:	       ent->weapon, ent->id, entity_type(ent->type)->name);
weapon.c:    if( now - ent->last_fired < wt->reload_time ) {
weapon.c:    if( wt->ammo_type != AMMO_INFINITE ) {
weapon.c:	ammo = &ent->ammo[ wt->ammo_type ];
weapon.c:	if( wt->class == WT_BEAM ) {
weapon.c:	    ammo_needed = wt->ammo_usage / (float)server.fps + 0.5; /* Round */
weapon.c:		ent->weapon_switch = 1;
weapon.c:		*ammo -= ammo_needed;
weapon.c:	    if( *ammo < wt->ammo_usage ) {
weapon.c:		ent->weapon_switch = 1;
weapon.c:		*ammo -= wt->ammo_usage;
weapon.c:    et = entity_type(ent->type);
weapon.c:    ent->last_fired = now;
weapon.c:    start.x = ent->x + et->width/2;
weapon.c:    start.y = ent->y + et->height - (et->height/5 * 2);
weapon.c:    d = ent->dir + 16;
weapon.c:    start.x += sin_lookup[d] * (et->width/2);
weapon.c:    start.y += -cos_lookup[d] * (et->height/2);
weapon.c:    if( wt->muzzle_flash )
weapon.c:    for( i=0 ; i < wt->number ; i++ ) {
weapon.c:	dir = ent->dir;
weapon.c:	if( wt->spread )
weapon.c:	    dir += rand()%(wt->spread * 2) - wt->spread;
weapon.c:	switch( wt->class ) {
weapon.c:	    x_v = ent->x_v / 2;
weapon.c:	    y_v = ent->y_v / 2;
weapon.c:	    x_v += sin_lookup[ent->dir] * wt->speed;
weapon.c:	    y_v -= cos_lookup[ent->dir] * wt->speed;
weapon.c:	    pt = entity_type(wt->projectile);
weapon.c:	    x = start.x - pt->width/2;
weapon.c:	    y = start.y - pt->height + pt->height/5 * 2;
weapon.c:	    proj = entity_new( wt->projectile, x, y, x_v, y_v);
weapon.c:	    proj->dir = ent->dir;
weapon.c:	    proj->pid = ent->id; /* Set parent id to the projectiles shooter */
weapon.c:	    proj->weapon = ent->weapon;
weapon.c:	    hitscan_fire( ent, ent->weapon, start, dir );
weapon.c:    et = entity_type(victim->type);
weapon.c:    if( victim->class == ITEM || victim->health <= 0 )
weapon.c:    damage = wt->damage;
weapon.c:    if( wt->class == WT_BEAM ) /* Damage is inflicted over a second */
weapon.c:	victim->health -= damage / server.fps;
weapon.c:	victim->health -= damage;
weapon.c:    if( victim->health <= 0 )
weapon.c:    if( et->bleeder ) {
weapon.c:	msg.particles.dir = shooter? shooter->dir : 0;
weapon.c:    P.x = explosion->x + explosion->width/2;
weapon.c:    P.y = explosion->y + explosion->height/2;
weapon.c:    msg.particles.length = wt->explosion * 40;
weapon.c:    if( (shooter = findent(explosion->pid)) == NULL )
weapon.c:    for( victim = root ; victim != NULL ; victim = victim->next ) {
weapon.c:	if( victim->class == ITEM || victim->health <= 0 )
weapon.c:	radius = wt->explosion + d1;
weapon.c:	d1 = MIN( victim->width, victim->height ) / 2;
weapon.c:	    dist -= d1;
weapon.c:	if( dist < wt->explosion ) {
weapon.c:	    damage = wt->splashdamage * (wt->explosion - dist) / wt->explosion;
weapon.c:	    victim->health -= damage;
weapon.c:	    if( victim->health <= 0 )
weapon.c:		entity_killed(shooter, victim, P, explosion->weapon);
weapon.c:    et = entity_type(ent->type);
weapon.c:	wt = weapon_type(et->weapon);
weapon.c:    memset(ent->has_weapon, 0, num_weapon_types);
weapon.c:    ent->has_weapon[et->weapon] = 1; /* Has default weapon */
weapon.c:	ent->ammo[wt->ammo_type] = wt->initial_ammo;
weapon.c:    ent->weapon = et->weapon;
world.c:/* Update the game world by msec milli-seconds */
world.c:    if( ent->x_v > MIN_SPEED ) {
world.c:	if( FRICTION * secs > ent->x_v )
world.c:	    ent->x_v *= 0.8;
world.c:	    ent->x_v -= FRICTION * secs;
world.c:    } else if( ent->x_v < -MIN_SPEED ) {
world.c:	if( -FRICTION * secs < ent->x_v )
world.c:	    ent->x_v *= 0.8;
world.c:	    ent->x_v += FRICTION * secs;
world.c:	ent->x_v = 0.0;
world.c:    if( ent->y_v > MIN_SPEED ) {
world.c:	if( FRICTION * secs > ent->y_v )
world.c:	    ent->y_v *= 0.8;
world.c:	    ent->y_v -= FRICTION * secs;
world.c:    } else if( ent->y_v < -MIN_SPEED ) {
world.c:	if( -FRICTION * secs < ent->y_v )
world.c:	    ent->y_v *= 0.8;
world.c:	    ent->y_v += FRICTION * secs;
world.c:	ent->y_v = 0.0;
world.c:    switch( ent->class ) {
world.c:	if( ent->mode == PATROL ) {
world.c:	    *dirvel = -*dirvel;
world.c:	    if( dirvel == &ent->x_v )
world.c:		ent->dir = DEGREES - ent->dir;
world.c:		ent->dir = DEGREES / 2 - ent->dir;
world.c:	ent->health = 0;
world.c:  (a.x >= map->width*TILE_W || a.x < 0 || a.y >= map->height*TILE_H || a.y < 0)
world.c:    float x, y; /* Co-ords of ground clip box */
world.c:    /* If the entity is stationary and the seconds are non-zero then skip.
world.c:    if( !(ent->x_v || ent->y_v) && secs )
world.c:    et = entity_type(ent->type);
world.c:    cliplevel = et->cliplevel;
world.c:    gcb_height = et->height/5 * 2;
world.c:    gcb_offset = ent->height - gcb_height;
world.c:    /* GCB co-ordinates */
world.c:    x = ent->x;
world.c:    y = ent->y + gcb_offset;
world.c:	    dirvel = &ent->x_v;
world.c:	    sidelength = et->width;
world.c:	    dirvel = &ent->y_v;
world.c:		mp.x += et->width;
world.c:	    /* Check if entity is out of range (in pixel co-ordinates) */
world.c:		stoppos = dirtile * TILE_W - (sidelength + 1);
world.c:	    if( out_of_range || map->base[mp.y*map->width+mp.x] >= cliplevel ){
world.c:		if( ent->health <= 0 )
world.c:	    } if( map->event) { /* Check event layer */
world.c:		if( (e = map->event[mp.y*map->width+mp.x]) ) {
world.c:    ent->x = pos.x;
world.c:    ent->y = pos.y - gcb_offset;
