Exemple #1
0
static int load_object(scene_t *scene,FILE *file,char *path,int texture_mode) {
    char buffer[128],name[256];
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"mesh")) {
            load_name(file,path,name);
            scene->mesh = load_mesh(name,path,&scene->num_mesh,texture_mode);
            if(!scene->mesh) return 0;
        } else if(!strcmp(buffer,"thing")) {
            load_name(file,path,name);
            scene->thing = load_thing(name,scene->mesh,scene->num_mesh,&scene->num_thing);
            if(!scene->thing) return 0;
        } else if(!strcmp(buffer,"animation")) {
            load_name(file,path,name);
            scene->animation = load_animation(name,path,scene->mesh,scene->num_mesh,&scene->num_animation);
            if(!scene->animation) return 0;
        } else if(!strcmp(buffer,"particle")) {
            load_name(file,path,name);
            scene->particle = load_particle(name,path,&scene->num_particle,texture_mode);
            if(!scene->particle) return 0;
        } else if(!strcmp(buffer,"dynamiclight")) {
            load_name(file,path,name);
            scene->dynamiclight = load_dynamiclight(name,path,&scene->num_dynamiclight,texture_mode);
            if(!scene->dynamiclight) return 0;
        } else if(!strcmp(buffer,"}")) break;
        else return 0;
    }
    return 1;
}
Exemple #2
0
static int load_land(scene_t *scene,FILE *file,char *path,int texture_mode) {
    char buffer[128];
    land_config_t config;
    memset(&config,0,sizeof(land_config_t));
    config.num_base = 1;
    config.num_detail = 1;
    config.texture_mode = texture_mode;
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"land")) load_name(file,path,config.heightmap);
        else if(!strcmp(buffer,"step")) config.step = load_float(file);
        else if(!strcmp(buffer,"altitude")) config.altitude = load_float(file);
        else if(!strcmp(buffer,"lod")) config.lod = load_float(file);
        else if(!strcmp(buffer,"ambient")) load_color(file,config.ambient);
        else if(!strcmp(buffer,"diffuse")) load_color(file,config.diffuse);
        else if(!strcmp(buffer,"specular")) load_color(file,config.specular);
        else if(!strcmp(buffer,"base")) load_name(file,path,config.base);
        else if(!strcmp(buffer,"num_base")) config.num_base = load_int(file);
        else if(!strcmp(buffer,"detail")) load_name(file,path,config.detail);
        else if(!strcmp(buffer,"num_detail")) config.num_detail = load_int(file);
        else if(!strcmp(buffer,"}")) {
            scene->land = land_create(&config);
            break;
        } else return 0;
    }
    if(!scene->land) return 0;
    return 1;
}
Exemple #3
0
static int load_sky_sun(scene_t *scene,FILE *file,char *path,int texture_mode) {
    char buffer[128],pathname[256];
    float length = 0;
    sky_sun_config_t config;
    memset(&config,0,sizeof(sky_sun_config_t));
    config.texture_mode = texture_mode;
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"pos")) load_pos(file,config.pos);
        else if(!strcmp(buffer,"color")) load_color(file,config.color);
        else if(!strcmp(buffer,"num_flare")) config.num_flare = load_int(file);
        else if(!strcmp(buffer,"flare")) load_sky_sun_flare(&config,file,path);
        else if(!strcmp(buffer,"length")) length = load_float(file);
        else if(!strcmp(buffer,"path")) {
            load_name(file,path,pathname);
            if(length <= scene->end - scene->start)
                scene->pathsun = spline_close_load(pathname,length,0,0,0);
            else scene->pathsun = spline_load(pathname,length,0,0,0);
            if(!scene->pathsun) return 0;
        } else if(!strcmp(buffer,"}")) {
            scene->sun = sky_sun_load(&config);
            break;
        } else return 0;
    }
    if(!scene->sun) return 0;
    return 1;
}
Exemple #4
0
void spawn_tick() {
   object ob;
   int pop, spawns, max;
   string fname = spawn_src;

   if( !environment(this_object()) ) return;
   remove_call_out("spawn_tick");
//   call_out( "spawn_tick", SPAWN_DELAY + random(SPAWN_DELAY) );

   // pumpkin lord's revenge
   if( localtime()[4] == 9 && random(100) < 50 ) {   // 0-indexed, oct+
      fname = SKELLINGTON;
      max = MAX_SKELLINGTONS;
   } else {
      spawns = count_spawns();
      max = max_population(spawns);
   }
   pop = sizeof(all_clones(fname));
   // Don't spawn over the max.
   if( pop >= max ) return;

   // The following if statement does NOT WORK. Try it for
   // a population of zero -- nothing will EVER spawn.
//   if( (50+random(50)) > (100*pop/max) ) return;

   foreach( ob : all_inventory(environment(this_object())) )
      if( load_object(load_name(ob)) == load_object(fname) ) return;

   ob = clone_object( fname );
   if( !ob ) return;

   // mobs spawn fully healed
   ob->set_hp(ob->query_max_hp());
   ob->set_mana(ob->query_max_mana());
   ob->set_endurance(ob->query_max_endurance());
   ob->set_food(ob->query_max_food() * 3 / 4);
   ob->set_drink(ob->query_max_drink() * 3 / 4);

   // mobs also need some skills if their author forgot to give them
   if( !sizeof(ob->query_skills()) ) {
      ob->set_skill( "combat.dodging", 5 * range(ob->query_stat("spd")) );
      ob->set_skill( "combat.weapon.unarmed", 5 * range(ob->query_stat("str")) );
   }


   ob->move( environment(this_object()) );
   if( query_coord() == 0 )
      ob->set_coord( environment()->query_map_xdim()/2, environment()->query_map_ydim()/2, 0 );
   else
      ob->set_coord( query_coord() );
   ob->validate_position();
   "/daemon/counter"->add_count( "spawn_count_" + fname, 1 );
   debug( fname + " @ "+get_location(environment()), "spawn" );
}
Exemple #5
0
static int load_camera(scene_t *scene,FILE *file,char *path) {
    char buffer[128],pathname[256];
    float length = 0;
    camera_config_t config;
    memset(&config,0,sizeof(camera_config_t));
    config.aspect = 4.0 / 3.0;
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"start")) scene->start = load_float(file);
        else if(!strcmp(buffer,"end")) scene->end = load_float(file);
        else if(!strcmp(buffer,"length")) length = load_float(file);
        else if(!strcmp(buffer,"pathpos")) {
            load_name(file,path,pathname);
            if(length <= scene->end - scene->start) scene->pathpos = spline_close_load(pathname,length,0,0,0);
            else scene->pathpos = spline_load(pathname,length,0,0,0);
            if(!scene->pathpos) return 0;
        } else if(!strcmp(buffer,"pathdir")) {
            load_name(file,path,pathname);
            if(length <= scene->end - scene->start) scene->pathdir = spline_close_load(pathname,length,0,0,0);
            else scene->pathdir = spline_load(pathname,length,0,0,0);
            if(!scene->pathdir) return 0;
        } else if(!strcmp(buffer,"fov")) config.fov = load_float(file);
        else if(!strcmp(buffer,"aspect")) config.aspect = load_float(file);
        else if(!strcmp(buffer,"clipnear")) config.clipnear = load_float(file);
        else if(!strcmp(buffer,"clipfar")) config.clipfar = load_float(file);
        else if(!strcmp(buffer,"fogcolor")) load_color(file,config.fogcolor);
        else if(!strcmp(buffer,"fogstart")) config.fogstart = load_float(file);
        else if(!strcmp(buffer,"fogend")) config.fogend = load_float(file);
        else if(!strcmp(buffer,"}")) {
            scene->camera = camera_create(&config);
            break;
        } else return 0;
    }
    if(!scene->camera) return 0;
    return 1;
}
Exemple #6
0
static int load_sky_layer(sky_config_t *config,FILE *file,char *path) {
    char buffer[128];
    int layer = 0;
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"layer")) layer = load_int(file);
        else if(!strcmp(buffer,"height")) config->height[layer] = load_float(file);
        else if(!strcmp(buffer,"time")) config->time[layer] = load_float(file);
        else if(!strcmp(buffer,"texture")) load_name(file,path,config->texture[layer]);
        else if(!strcmp(buffer,"}")) break;
        else return 0;
    }
    return 1;
}
Exemple #7
0
static int load_sky_sun_flare(sky_sun_config_t *config,FILE *file,char *path) {
    char buffer[128];
    int flare = 0;
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"flare")) flare = load_int(file);
        else if(!strcmp(buffer,"position")) config->position[flare] = load_float(file);
        else if(!strcmp(buffer,"radius")) config->radius[flare] = load_float(file);
        else if(!strcmp(buffer,"opacity")) config->opacity[flare] = load_float(file);
        else if(!strcmp(buffer,"texture")) load_name(file,path,config->texture[flare]);
        else if(!strcmp(buffer,"}")) break;
        else return 0;
    }
    return 1;
}
Exemple #8
0
//===== Copy  =====//
Af& Af::operator=(const Af& iaf) //jrg - look at this...
{
  type = iaf.type;
  curve_loaded_flag = iaf.curve_loaded_flag;
  inverted_flag = iaf.inverted_flag;

  camber = iaf.camber;
  camber_loc = iaf.camber_loc;
  thickness = iaf.thickness;
  thickness_loc = iaf.thickness_loc;
  radius_le = iaf.radius_le;
  radius_te = iaf.radius_te;
  delta_y_le = iaf.delta_y_le;
  a = iaf.a;
  ideal_cl = iaf.ideal_cl;

  sixser = iaf.sixser;
  name = iaf.name;

  num_pnts = iaf.num_pnts;

  orig_af_thickness = iaf.orig_af_thickness;
  radius_le_correction_factor = iaf.radius_le_correction_factor;
  radius_te_correction_factor = iaf.radius_te_correction_factor;

  upper_curve = iaf.upper_curve;
  lower_curve = iaf.lower_curve;

  slat_flag = iaf.slat_flag;
  slat_shear_flag = iaf.slat_shear_flag;
  slat_chord = iaf.slat_chord;
  slat_angle = iaf.slat_angle;

  flap_flag = iaf.flap_flag;
  flap_shear_flag = iaf.flap_shear_flag;
  flap_chord = iaf.flap_chord;
  flap_angle = iaf.flap_angle;

	set_geom(geom_ptr );

	load_name(); 
	generate_airfoil();

	return *this; 
}
Exemple #9
0
static void display_scores( RW_Battle *b ) {
    SDL_Surface *text;
    RW_Active_Robot *bot;
    RW_Robot_Iter ri;
    SDL_Rect r = {300, 0, 100, 300};
    SDL_FillRect(screen, &r, 0x88888888);
    RW_Reset_Robot_Iter(b, &ri, NULL);
    while( (bot = RW_Robot_Next(&ri)) ) {
        text = load_name(RW_Get_Robot_Name(bot));
        draw_text(text, 303, 3 + (bot->id * 28));
        text = load_text(bot->damage);
        draw_text(text, 303, 3 + 14 + (bot->id * 28));
        text = load_text(bot->energy);
        draw_text(text, 338, 3 + 14 + (bot->id * 28));
        text = load_text(bot->shield);
        draw_text(text, 373, 3 + 14 + (bot->id * 28));
    }
}
Exemple #10
0
//---------- Begin of function RaceRes::init -----------//
//
// This function must be called after a map is generated.
//
void RaceRes::init()
{
	deinit();

	//----- open unit bitmap resource file -------//

	String str;

	str  = DIR_RES;
	str += "I_RACE.RES";

	res_bitmap.init_imported(str, 1);  // 1-don't read all into buffer

	//------- load database information --------//

	load_race_info();
	load_name();

	init_flag=1;
}
Exemple #11
0
//===== Set Type =====//
void Af::set_type(int type_in)
{
//  if ( type == type_in ) return;

  type = type_in;

	//==== Turn Of Everything ====//
	camber.deactivate();
	camber_loc.deactivate();
	thickness_loc.deactivate();
	ideal_cl.deactivate();
	a.deactivate();

  switch(type)
    {
      case NACA_4_SERIES:
  			camber.activate();
  			camber_loc.activate();
        break;

      case BICONVEX:
        break;

      case WEDGE:
        thickness_loc.activate();
        break;

      case AIRFOIL_FILE:
        break;

      case NACA_6_SERIES:      //jrg more...
				ideal_cl.activate();
				a.activate();
        break;

    }

  generate_airfoil();
  load_name();
}
Exemple #12
0
static int load_sky(scene_t *scene,FILE *file,char *path,int texture_mode) {
    char buffer[128];
    sky_config_t config;
    memset(&config,0,sizeof(sky_config_t));
    config.texture_mode = texture_mode;
    fscanf(file,"%s",buffer);
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"mesh")) load_name(file,path,config.mesh);
        else if(!strcmp(buffer,"num_layer")) config.num_layer = load_int(file);
        else if(!strcmp(buffer,"target")) config.target = load_float(file);
        else if(!strcmp(buffer,"layer")) load_sky_layer(&config,file,path);
        else if(!strcmp(buffer,"sun")) {
            if(!load_sky_sun(scene,file,path,texture_mode)) return 0;
        } else if(!strcmp(buffer,"}")) {
            scene->sky = sky_load(&config);
            break;
        } else return 0;
    }
    if(!scene->sky) return 0;
    return 1;
}
Exemple #13
0
bool FeRomList::load_romlist( const std::string &path,
			const std::string &romlist_name,
			const std::string &user_path,
			const std::string &stat_path,
			FeDisplayInfo &display )
{
	m_user_path = user_path;
	m_romlist_name = romlist_name;

	m_list.clear();
	m_filtered_list.clear();
	m_availability_checked = false;

	m_global_filter_ptr = NULL;
	m_global_filtered_out_count = 0;

	FeFilter *first_filter = display.get_global_filter();
	if ( first_filter )
	{
		first_filter->init();

		if ( !first_filter->test_for_target( FeRomInfo::FileIsAvailable )
			&& !first_filter->test_for_target( FeRomInfo::Favourite )
			&& !first_filter->test_for_target( FeRomInfo::Tags ) )
		{
			// If the global filter doesn't care about file availability,
			// favourites or tags then we can apply it right up front when we
			// load the romlist.  We signal this by setting m_global_filter_ptr
			m_global_filter_ptr = first_filter;
			first_filter = NULL;
		}
	}

	sf::Clock load_timer;

	bool retval = FeBaseConfigurable::load_from_file(
			path + m_romlist_name + FE_ROMLIST_FILE_EXTENSION, ";" );

	//
	// Create rom name to romlist entry lookup map
	//
	std::map < std::string, FeRomInfo * > rom_map;
	std::map < std::string, FeRomInfo * >::iterator rm_itr;
	for ( FeRomInfoListType::iterator itr = m_list.begin(); itr != m_list.end(); ++itr )
		rom_map[ (*itr).get_info( FeRomInfo::Romname ) ] = &(*itr);

	//
	// Load favourites
	//
	m_extra_favs.clear();
	m_fav_changed=false;

	std::string load_name( m_user_path + m_romlist_name + FE_FAVOURITE_FILE_EXTENSION );
	std::ifstream myfile( load_name.c_str() );

	if ( myfile.is_open() )
	{
		while ( myfile.good() )
		{
			size_t pos=0;
			std::string line, name;

			getline( myfile, line );
			token_helper( line, pos, name );

			if ( !name.empty() )
			{
				rm_itr = rom_map.find( name );
				if ( rm_itr != rom_map.end() )
					(*rm_itr).second->set_info( FeRomInfo::Favourite, "1" );
				else
					m_extra_favs.insert( name );
			}
		}

		myfile.close();
	}

	//
	// Load tags
	//
	m_tags.clear();
	m_extra_tags.clear();
	m_tags_changed=false;
	load_name = m_user_path + m_romlist_name + "/";

	if ( directory_exists( load_name ) )
	{
		std::vector<std::string> temp_tags;
		get_basename_from_extension( temp_tags, load_name, FE_FAVOURITE_FILE_EXTENSION );

		for ( std::vector<std::string>::iterator itr=temp_tags.begin(); itr!=temp_tags.end(); ++itr )
		{
			if ( (*itr).empty() )
				continue;

			std::ifstream myfile( std::string(load_name + (*itr) + FE_FAVOURITE_FILE_EXTENSION).c_str() );

			if ( !myfile.is_open() )
				continue;

			std::map<std::string, bool>::iterator itt = m_tags.begin();
			itt = m_tags.insert( itt, std::pair<std::string,bool>( (*itr), false ) );

			while ( myfile.good() )
			{
				size_t pos=0;
				std::string line, rname;

				getline( myfile, line );
				token_helper( line, pos, rname );

				if ( !rname.empty() )
				{
					rm_itr = rom_map.find( rname );
					if ( rm_itr != rom_map.end() )
						(*rm_itr).second->append_tag( (*itt).first.c_str() );
					else
						m_extra_tags.insert( std::pair<std::string,const char*>(rname, (*itt).first.c_str() ) );
				}
			}

			myfile.close();
		}
	}

	// Apply global filter if it hasn't been applied already
	if ( first_filter )
	{
		if ( first_filter->test_for_target( FeRomInfo::FileIsAvailable ) )
			get_file_availability();

		FeRomInfoListType::iterator last_it=m_list.begin();
		for ( FeRomInfoListType::iterator it=m_list.begin(); it!=m_list.end(); )
		{
			if ( first_filter->apply_filter( *it ) )
			{
				if ( last_it != it )
					it = m_list.erase( last_it, it );
				else
					++it;

				last_it = it;
			}
			else
			{
				//
				// This rom is being filtered out and we may need to keep track of a few things
				//
				// 1. Track if this is a favourite...
				//
				if ( !(*it).get_info( FeRomInfo::Favourite ).empty() )
					m_extra_favs.insert( (*it).get_info( FeRomInfo::Romname ) );

				//
				// 2. Track if this rom has tags we'll need to keep
				//
				if ( !(*it).get_info( FeRomInfo::Tags ).empty() )
				{
					const std::string &name = (*it).get_info( FeRomInfo::Romname );
					const std::string &tags = (*it).get_info( FeRomInfo::Tags );
					const char sep[] = { FE_TAGS_SEP, 0 };

					size_t pos=0;
					while ( pos < tags.size() )
					{
						std::string one_tag;
						token_helper( tags, pos, one_tag, sep );

						std::map<std::string, bool>::iterator itt = m_tags.find( one_tag );
						if ( itt != m_tags.end() )
							m_extra_tags.insert( std::pair<std::string,const char *>( name, (*itt).first.c_str() ) );
					}
				}

				m_global_filtered_out_count++;
				++it;
			}
		}

		if ( last_it != m_list.end() )
			m_list.erase( last_it, m_list.end() );
	}

	std::cout << " - Loaded master romlist '" << m_romlist_name
			<< "' in " << load_timer.getElapsedTime().asMilliseconds()
			<< " ms (" << m_list.size() << " entries kept, " << m_global_filtered_out_count
			<< " discarded)" << std::endl;

	load_timer.restart();

	//
	// Apply filters
	//
	int filters_count = display.get_filter_count();

	//
	// If the display doesn't have any filters configured, we create a single "filter" in the romlist object
	// with every romlist entry in it
	//
	if ( filters_count == 0 )
		filters_count = 1;

	m_filtered_list.reserve( filters_count );
	for ( int i=0; i<filters_count; i++ )
	{
		m_filtered_list.push_back( std::vector< FeRomInfo *>()  );

		FeFilter *f = display.get_filter( i );
		if ( f )
		{
			if ( f->get_size() > 0 ) // if this is non zero then we've loaded before and know how many to expect
				m_filtered_list[i].reserve( f->get_size() );

			if ( f->test_for_target( FeRomInfo::FileIsAvailable ) )
				get_file_availability();

			f->init();
			for ( FeRomInfoListType::iterator itr=m_list.begin(); itr!=m_list.end(); ++itr )
				if ( f->apply_filter( *itr ) )
					m_filtered_list[i].push_back( &( *itr ) );
		}
		else // no filter situation, so we just add the entire list...
		{
			m_filtered_list[i].reserve( m_list.size() );
			for ( FeRomInfoListType::iterator itr=m_list.begin(); itr!=m_list.end(); ++itr )
				m_filtered_list[i].push_back( &( *itr ) );
		}

		//
		// make sure stats are loaded for the roms we will be showing
		//
		if ( !stat_path.empty() )
		{
			for ( std::vector< FeRomInfo * >::iterator itf=m_filtered_list[i].begin();
						itf!=m_filtered_list[i].end();
						++itf )
				(*itf)->load_stats( stat_path ); // this will just return if stats are already loaded for the rom
		}

		if ( f )
		{
			// track the size of the filtered list in our filter info object
			f->set_size( m_filtered_list[i].size() );

			//
			// Sort and/or prune now if configured for this filter
			//
			FeRomInfo::Index sort_by=f->get_sort_by();
			bool rev = f->get_reverse_order();
			int list_limit = f->get_list_limit();

			if ( sort_by != FeRomInfo::LAST_INDEX )
			{
				std::stable_sort( m_filtered_list[i].begin(),
						m_filtered_list[i].end(),
						FeRomListSorter2( sort_by, rev ) );
			}
			else if ( rev != false )
				std::reverse( m_filtered_list[i].begin(), m_filtered_list[i].end() );

			if (( list_limit != 0 ) && ( (int)m_filtered_list[i].size() > abs( list_limit ) ))
			{
				if ( list_limit > 0 )
					m_filtered_list[i].erase( m_filtered_list[i].begin() + list_limit, m_filtered_list[i].end() );
				else
					m_filtered_list[i].erase( m_filtered_list[i].begin(), m_filtered_list[i].end() + list_limit );
			}
		}
	}

	std::cout << " - Constructed " << filters_count << " filters in "
			<< load_timer.getElapsedTime().asMilliseconds()
			<< " ms (" << filters_count * m_list.size() << " comparisons)" << std::endl;

	return retval;
}
Exemple #14
0
//===== Set Six Series =====//
void Af::set_sixser( int ser )
{
  sixser = ser;
  generate_airfoil();
  load_name();
}
Exemple #15
0
//===== Constructor  =====//
Af::Af(Geom* geom_ptr_in)
{
  geom_ptr = geom_ptr_in;

  //==== Defaults ====//
  type = NACA_4_SERIES;
  num_pnts = 23;

  curve_loaded_flag = FALSE;
  inverted_flag = FALSE;

  camber.initialize(geom_ptr, AF_UPDATE_GROUP, "Camber",  0.0);
  camber.set_lower_upper(0.0, 0.5);

  camber_loc.initialize(geom_ptr, AF_UPDATE_GROUP, "Camber_Loc",  0.5);
  camber_loc.set_lower_upper(0.01, 0.99);

  thickness.initialize(geom_ptr, AF_UPDATE_GROUP, "Thickness",  0.10);
  thickness.set_lower_upper(0.001, 0.5);
  thickness_loc.deactivate();

  thickness_loc.initialize(geom_ptr, AF_UPDATE_GROUP, "Thickness_Loc",  0.3);
  thickness_loc.set_lower_upper(0.01, 0.99);

  radius_le.initialize(geom_ptr, AF_UPDATE_GROUP, "Radius_Leading_Edge",  0.01);
  radius_le.set_lower_upper(0.0, 1000000.0);
  radius_le.deactivate();

  radius_te.initialize(geom_ptr, AF_UPDATE_GROUP, "Radius_Trailing_Edge",  0.0);
  radius_te.set_lower_upper(0.0, 1000000.0);
  radius_te.deactivate();

  delta_y_le.initialize(geom_ptr, AF_UPDATE_GROUP, "Delta_Y_Leading_Edge",  0.01);
  delta_y_le.set_lower_upper(0.0, 1000000.0);

  ideal_cl.initialize(geom_ptr, AF_UPDATE_GROUP, "Ideal Cl",  0.0);
  ideal_cl.set_lower_upper(0.0, 1.0);
  ideal_cl.deactivate();

  a.initialize(geom_ptr, AF_UPDATE_GROUP, "A",  0.0);
  a.set_lower_upper(0.0, 1.0);
  a.deactivate();

  sixser = 63;

  slat_flag = FALSE;
  slat_shear_flag = FALSE;
  slat_chord.initialize( geom_ptr, AF_UPDATE_GROUP, "Slat_Chord",  0.25 );
  slat_chord.set_lower_upper(0.0, 1.0);
  slat_angle.initialize( geom_ptr, AF_UPDATE_GROUP, "Slat_Angle",  10.0 );
  slat_angle.set_lower_upper(-45.0, 45.0);

  flap_flag = FALSE;
  flap_shear_flag = FALSE;
  flap_chord.initialize( geom_ptr, AF_UPDATE_GROUP, "Flap_Chord",  0.25 );
  flap_chord.set_lower_upper(0.0, 1.0);
  flap_angle.initialize( geom_ptr, AF_UPDATE_GROUP, "Flap_Angle",  10.0 );
  flap_angle.set_lower_upper(-45.0, 45.0);

  load_name(); 
  generate_airfoil();

}
Exemple #16
0
static object *insert_ltable(char *column, char *limit, line_item *v, int type)
{
   short		 global = masm_level;
   char			*s;
   object		*o = NULL;
   paragraph		*p, *q;

   line_item		 vnew;
   value		*vlbase;

   int			 x, size;
   int			 base_displacement = 0;

   #ifdef STRUCTURE_DEPTH
   object		*adhesionp
			= (active_x) ? active_instance[active_x - 1]
                                     : NULL;

   int			 adhesion_level = -1;
   int			 b4 = type;
   #endif

   if (type == UNDEFINED) global = 0;
   else
   {
      load_name(column, limit);
      if (label_highest_byte == 0) return NULL;

      #ifdef SYNONYMS
      if (*label_margin == '(') load_qualifier(label_margin, limit);
      #endif

      s = label_margin;

      while (*s++ == '*') global--;
   }


   #ifdef STRUCTURE_DEPTH

   if ((adhesionp) && (global == adhesionp->l.passflag)
   &&  (type) && (type ^ SET) && (type ^ BLANK))
   {
      o = findlabel_in_node();
      adhesion_level = adhesionp->l.r.l.xref;
      if (adhesion_level < 0) adhesion_level = 0;
      global = adhesion_level;
      if (uselector['B'-'A'])
      printf("[L%x:A%x:G%x:V%x:P%X]%s:%s\n",
              masm_level, adhesion_level, global, type,
              adhesionp->l.passflag,
              adhesionp->l.name, name);
   }

   else
   {
      if (global > 0)
      {
         o = retrieve_dynamic_label();

         if (o)
         {
            if (o->l.r.l.xref ^ global) o = NULL;
         }
      }
      else
      {
         #ifdef HASH
         o = hash_locate(0);
         #else
         o = retrieve_label();
         #endif
      }
   }

   #else

   if (global > 0)
   {
      o = retrieve_dynamic_label();

      if (o)
      {
         if (o->l.r.l.xref ^ global) o = NULL;
      }
   }
   else
   {
      #ifdef HASH
      o = hash_locate(0);
      #else
      o = retrieve_label();
      #endif
   }

   #endif

   if ((type == LOCATION) || (type == BLANK))
   {
      if (x = actual->flags & 129)
      {
         vnew = *v;
         v = &vnew;

         if (x & 128)
         {
            if (type == LOCATION) type = EQUF;
            v->b[RADIX/8-5] = actual->rbase;
            base_displacement = 1;
         }

         if (x == 1)
         {
            vlbase = (value *) actual->runbank;
            operand_add(v, &vlbase->value);
         }
      }
   }

   if (o)
   {
      if (type == BLANK) return o;

      x = o->l.valued;

      if (x == BLANK)
      {
         o->l.valued = type;
         o->l.value = *v;
         return o;
      }

      /*************************************

	$blank does not alter any label
	which already exists

      *************************************/
 
      #ifdef RECORD
      if (type == RECORD)
      {
         if ((branch_record == 0) && (record_nest == 0)) base_displacement = 1;
         type = EQUF;

         if (actual->flags & 128)
         {
            vnew = *v;
            v = &vnew;
            v->b[RADIX/8-5] = actual->rbase;
         }
      }
      #endif

      if (x)
      {
         if (type ^ x)
         {
            if ((pass) && ((type == LOCATION) || (base_displacement)))
            {
               if ((x == EQU) || (x == SET) || (x == EQUF))
               return o;
            }

            flagp(o->l.name, "may not be retyped");
            return o;
         }
      }

      if (type == FORM) return o;

      if (type == SET)
      {
      }
      else
      {
         if (background_pass)
         {
            if       (type == LOCATION) checkwave(v, o, actual->flags);
            else if (base_displacement) checkwaveb(v, o); 
         }
         else
         {
            #ifdef BINARY
            if (o->l.valued == UNDEFINED) o->l.valued = type;
            else
            #endif
            {
               flagp1p(o->l.name, "may not be restated");
               return o;
            }
         }
      }
   }
   else
   {
      #ifdef EQUAZE
      if ((type == EQU) || (type == SET)) type = BLANK;
      #endif

      size = sizeof(label) + label_length - PARAGRAPH;

      if (global > 0)
      {
         flotsam -= size;

         if (flotsam < 0)
         {
            flag_either_pass("too many dynamic labels", "abandon");
            exit(0);
         }

         o = floatop;
         floatop = (object *) ((char *) floatop + size);
         o->l.along = NULL;
         floatop->i = 0;
      }
      else
      {
         o = lr;

         if (remainder < size) o = buy_ltable();

         remainder -= size;

         lr = (object *) ((char *) lr + size);
      }

      lr->i = 0;

      p = (paragraph *) o->l.name;
      q = (paragraph *)      name;
      x = label_length >> 2;

      while (x--) *p++ = *q++;

      o->l.r.i = 0;
      o->l.r.l.xref = global;

      #ifdef HASH
      o->l.hashlink = NULL;
      #endif

      #ifdef BINARY
      o->l.link = NULL;
      #endif

      o->l.down = NULL;
      o->l.along = NULL;
      o->h.type = LABEL;
      o->h.length = size;
      o->l.passflag = 0;

      o->l.valued = type;

      if (type == SET) o->l.value = zero_o;

      if (global > 0)
      {
      }
      else
      {
         #ifdef STRUCTURE_DEPTH
         if ((active_x) && (global == adhesion_level)
         &&  (b4) && (b4 ^ SET) && (b4 ^ BLANK)) inslabel(o);
         else
         #endif
         {
            #ifdef HASH

            hash_in(o);

            #endif
 
            if ((list) || (o->l.valued  == UNDEFINED))
            {
               insert_label(o);
            }
         }
      }
   }

   if (type == SET) 
   {
   }
   else o->l.value = *v;

   o->l.passflag = masm_level;

   if ((uselector['L'-'A']) && (masm_level))
   {
      printf("[%x<-%x:%x:%s:%d:%s]\n", masm_level, global, type,
              file_label[depth]->l.name, ll[depth], o->l.name);
   }

   if ((type == LOCATION) || (type == BLANK))
   {
      o->l.r.l.rel = counter_of_reference | 128;

      if (actual->relocatable) o->l.r.l.y |= 1;
      else                     o->l.r.l.y &= 254;
   }

   if (base_displacement) o->l.r.l.rel = counter_of_reference | 128;

   return o; 
}
Exemple #17
0
object *findlabel(char *s, char *limit)
{
   object		*result, *presult;
   int			 x;

   #ifdef STRUCTURE_DEPTH
   int			 y;
   #endif

   load_name(s, limit);

   if (label_highest_byte == 0) return NULL;

   #ifdef STRUCTURE_DEPTH
   if (active_x)
   {
      result = findchain_in_node(active_instance[active_x - 1]->l.down,
                                 name, limit);

      if (result) return result;
   }
   #endif

   presult = retrieve_dynamic_label();

   if (presult)
   {
      #ifdef SYNONYMS
      if ((presult->l.valued == INTERNAL_FUNCTION)
      &&  (presult->l.value.b[RADIX/8-1] == SYNONYMS))
      {
      }
      else
      #endif

      return presult;
   }

   #ifdef HASH

   /******************************************************

	argument value 1 allows hash_locate(1) to return
	the functional value count_synonyms if subscripted
	synomyms are encountered

   ******************************************************/

   result = hash_locate(1);

   if (result)
   {
      if (x = result->l.valued)
      {
         #ifdef STRUCTURE_DEPTH
         if ((*label_margin == sterm)
         &&  (x ^ FUNCTION)
         &&  (x ^ INTERNAL_FUNCTION)
         &&  (x ^ PROC)
         &&  (result->l.down))
         {
            x = label_highest_byte;
            load_trailer(label_margin, limit);
            return findchain_in_node(result->l.down,
                                     name + x + 1,
                                     name + label_highest_byte);
         }
         #endif
            

         if ((result->l.valued == INTERNAL_FUNCTION)
         &&  (result->l.value.b[RADIX/8-1] == SYNONYMS))
         {
                                                         presult = result;
                                                            result = NULL;
         }
         else                                               return result;
      }
   }

   /*****************************************************

	presult is the count_synonyms function if the
	dynamic label stack contains some subscripted
	versions of THE(label)

	if this is so, THE(subscript) was already
	attached to the label in dynamic label stack
	search, and is now retained

	if it was not the dynamic label search which
	loaded the subscript, but the hash chain
	search, the subscript part is stripped
	before the search in the static label stack

	repeating load_name() strips the subscript

	the static label stack search attaches the
	subscript again if subscripted versions of
	THE(label) are found

	in practice SYNONYMS are always configured,
	except in the bcc DOS_LINKER version for
	640K.DOS, where all possible features are
	stripped which linking does not use

	These 640K.DOS binaries separate the
	Linker from the Assembler because not all
	the features fit in one binary

   *****************************************************/


   #ifdef STRUCTURE_DEPTH
   if (!result)
   {
      x = label_highest_byte;

      while (x--)
      {
         if (name[x] == sterm)
         {
            name[x] = 0;
            load_name(name, NULL);
            result = hash_locate(1);

            load_name(s, limit);
            
            if (result)
            {
               if ((result->l.down)
               &&  (y = result->l.valued)
               &&  (y ^ PROC)
               &&  (y ^ FUNCTION)
               &&  (y ^ INTERNAL_FUNCTION))
               {
                  return   findchain_in_node(result->l.down,
                                             name + x + 1,
                                             name + label_highest_byte);
                  break;

               }
               else result = NULL;
            }
         }
      }
   }
   #endif

   if (result) return result;
   return presult;

   #else	/*	HASH	*/

   result = retrieve_label(limit);
   if (result) return result;

   return presult;

   #endif	/*	HASH	*/
}
Exemple #18
0
void charter_selete()
{//인간,마법사,요정,카라스텐구,백랑텐구,캇파,반요,츠구모가미,흡혈귀,오니,사신, 달토끼, 천인, 용궁의사자, 유 령, 망령, 소령
	for(int i = 0; i<MAXLEVEL; i++)
		env[i].floor = i;
	

	WaitForSingleObject(mutx, INFINITE);
	SetText() = "touhou crawl ";
	SetText() += version_string;
	SetText() += "\n동방프로젝트와 던전크롤의 동인게임\n\n";
	if(load_name(user_name_file.c_str()))
	{
		SetText() += "당신의 이름은 \"";
		SetText() += you.user_name.name;
		SetText() += "\" 이다.\n";
	}
	else
	{
		SetText() += "당신의 이름은 \"";
		SetText() += you.user_name.name;
		SetText() += "\" 이다.\n";
		SetText() += "user_name.txt에서 당신의 이름을 바꿀 수 있어.\n";

	}
	SetDisplayTexture(&img_title);
	ReleaseMutex(mutx);
	waitkeyinput();	
	WaitForSingleObject(mutx, INFINITE);
	SetText() += "시작한다!\n";
	ReleaseMutex(mutx);
	Sleep(500);
	SetDisplayTexture(NULL);
	
	
	{
		ReplayClass.init_class();
		ReplayClass.SaveReplayStart();
	}
	
	init_state();
	map_list.tutorial = GM_TITLE;

	start_mainmenu();

	if(!saveexit)
	{
		init_identify();
		init_monster();
		initMap();
		wiz_list.wizard_mode = 0;
	}
	if(map_list.tutorial == GM_TITLE)
		map_list.tutorial = GM_NORMAL;


	if(isNormalGame() && !saveexit)
	{
		char temp[200];
		sprintf_s(temp,200,"%s, %s %s %s. 던전의 탐험을 시작했다.", you.user_name.name.c_str(),tribe_type_string[you.tribe],job_type_string[you.job],you.GetCharNameString()->c_str());
		AddNote(you.turn,CurrentLevelString(),temp,CL_normal);

		SetTribe(you.tribe);
		TouhouPlayerble(you.char_name.name, true);
		SetJob(you.job,you.char_name.name);
		TouhouPlayerble(you.char_name.name, false);
		/*Test_char_init(item_, bonus);*/
		you.CalcuHP();
		Initialize();
	}
	else if(map_list.tutorial == GM_TUTORIAL)
	{		
		you.image = &img_play_sanae;
		you.char_name.name = "사나에";
		you.tribe = TRI_HUMAN;
		you.job = JOB_SHAMAN;
		SetTribe(you.tribe);
		you.CalcuHP();
		env[current_level].EnterMap(0,deque<monster*>());	
		printlog("카나코는 말했다 : 환영한다, 사나에! 이번 튜토리얼은 내가 담당하지.",true,false,false,CL_warning);
		printlog("카나코는 말했다 : 지나간 말은 컨트롤+P로 로그를 확인하고 궁금한건 ?를 눌러.",true,false,false,CL_warning);
		printlog("카나코는 말했다 : 일단 h j k l나 방향키로 움직일 수 있어. 대소문자에 조심해.",true,false,false,CL_warning);
	}
	else if(map_list.tutorial == GM_TUTORIAL2)
	{
		you.image = &img_play_sanae;
		you.char_name.name = "사나에";
		you.tribe = TRI_HUMAN;
		you.job = JOB_SHAMAN;
		SetTribe(you.tribe);
		you.CalcuHP();
		env[current_level].EnterMap(0,deque<monster*>());	
		printlog("안녕하세요. Dungeon Crawl Stone Soup (이하 돌죽) 팬게임 동방크롤입니다.",true,false,false,CL_warning);
		printlog("여기에선 돌죽 경험자분을 위한 튜토리얼입니다.",true,false,false,CL_warning);
	}
	else if(map_list.tutorial == GM_SPRINT1_AREANA)
	{
		you.image = &img_play_sanae;
		you.char_name.name = "사나에";
		you.tribe = TRI_HUMAN;
		you.job = JOB_SHAMAN;
		SetTribe(you.tribe);
		you.CalcuHP();
		env[current_level].EnterMap(0,deque<monster*>());	
	
		item_infor t;
		item *it;
		it = env[current_level].MakeItem(you.position,makeitem(ITM_RING,1,&t,RGT_SEE_INVISIBLE));	
		it->Identify();
		you.additem(it,false);
		you.equip('a',ET_LEFT,false);
		env[current_level].DeleteItem(it);

		printlog("아레나에 온걸 환영한다! 승리할 것 같은 팀의 방향에 서있어라!",true,false,false,CL_help);
		printlog("만약 승자를 맞추게되면 레벨이 1 오른다. 틀리면 게임 오버! 기회는 3번...",true,false,false,CL_help);
	}




	changedisplay(DT_GAME);
	saveexit = true;
}
Exemple #19
0
string query_seed_type() {
   return "/econ/seed/" + explode(load_name(), "/")[<1];
}