Пример #1
0
void weapon_missile_fire ( gentity_t *ent, int weaponTime ) {
	gentity_t	*m;

	// extra vertical velocity
	if ( weLi[ent->s.weapon].tr_type == TR_GRAVITY ) {
		forward[2] += 0.3f;
		VectorNormalize( forward );
	}

	// spawn grenade
	m = fire_missile (ent, weaponTime, muzzle, forward);

//	VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta );	// "real" physics
}
Пример #2
0
/** TODO: refactor into do_first_strike (or vice-versa) **/
static void do_missile_launch(int side)
{
  print_string("\n\n");
  attr_on(WA_UNDERLINE, 0);
  print_string("AWAITING STRIKE COMMAND");
  attr_off(WA_UNDERLINE, 0);
  print_string("\n\n\nPLEASE LIST PRIMARY TARGETS BY\nCITY AND/OR COUNTY NAME:\n\n");
  char target_names[32][129];
  bool good=true;
  int num_targets=0;
  struct location_t *targets[32];
  int num_targets_found=0;
  int max_targets=side==USA?4:6;
  for(int i=0;num_targets_found<max_targets && good;++i)
    {
      getnstr(target_names[i], 128);
      if(strcmp(target_names[i],"")==0)
        {
          good=false;
        }
      else
	{
	  ++num_targets;
	  allLower(target_names[i]);
	  remove_punct(target_names[i]);
	  bool found=false;
	  for(int j=0;j<sizeof(world)/sizeof(struct location_t);++j)
	    {
	      if(strcmp(world[j].name, target_names[i])==0)
		{
		  found=true;
		  if(world[j].owner!=side)
		    {
		      targets[num_targets_found]=&world[j];
		      ++num_targets_found;
		    }
		  else
		    {
		      print_string("\n\nATTEMPTING TO FIRE AT OWN CITY.\nPLEASE CONFIRM (YES OR NO):  ");
		      char response[17];
		      getnstr(response, 16);
		      allLower(response);
		      remove_punct(response);
		      if(strcmp(response, "yes")==0 || strcmp(response, "y")==0)
			{
                          print_string("\n\nATTEMPTING TO FIRE AT OWN CITY.\nARE YOU SURE (YES OR NO):  ");
                          response[0]=0;
                          getnstr(response, 16);
                          allLower(response);
                          remove_punct(response);
                          if(strcmp(response, "yes")==0 || strcmp(response, "y")==0)
                            { 
                              print_string("\nTARGET CONFIRMED.\n\n");
                              targets[num_targets_found]=&world[j];
                              ++num_targets_found;
                            }
			}
		    }
		}
	    }
	  if(!found)
	    {
	      print_string("TARGET NOT FOUND: ");
	      print_string(target_names[i]);
	      print_string("\n");
	    }
	}
    }
  for(int i=0;i<num_targets_found;++i)
    {
      fire_missile(targets[i]);
    }
  clear();
  print_map_with_pops();
}