Esempio n. 1
0
NisskHarasser::NisskHarasser(Vector2 opos, double angle, ShipData *data,
                             unsigned int code)
    :
    Ship(opos, angle, data, code)
{
    STACKTRACE;
    shipSpeedMax = scale_velocity(get_config_float("Ship", "SpeedMax", 0));
    shipTurnRate = scale_turning(get_config_float("Ship", "TurnRate", 0));
    shipRechargeRate = scale_frames(get_config_float("Ship", "RechargeRate", 0));

    weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
    weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
    weaponDamage   = get_config_int("Weapon", "Damage", 0);
    weaponArmour   = get_config_int("Weapon", "Armour", 0);
    weaponAngle = get_config_float("Weapon", "Angle", 0) * ANGLE_RATIO;
    weaponTandemFire = get_config_int("Weapon", "TandemFire", 0);
    weaponRelativity = get_config_float("Weapon", "Relativity", 0);

    specialSpeedMax = scale_velocity(get_config_float("Special", "Velocity", 0));
    specialTurnRate = scale_turning(get_config_float("Special", "TurnRate", 0));
    specialRechargeRate = scale_frames(get_config_float("Special", "RechargeRate", 0));

    specialToggleMode = get_config_int("Special", "ToggleMode", 0);
    specialIsAutothrust = get_config_int("Special", "IsAutothrust", 0);
    driveMode = 0;
    oldDriveMode = 0;
    specialIsInertialess = get_config_int("Special", "IsInertialess", 0);
    gunToFire = 1;
    debounce = 0;
    lastSpecial = 0;
    currentSpecial = 0;
}
Esempio n. 2
0
Configuration::Configuration() {
	Logfile::log("+Configuration at 0x%x\n", this);
	
	// Load in the config data
	set_config_file("lander.ini");

	showFPS = get_config_int("window","fps",0);
	fullscreen = get_config_int("window", "fullscreen", FALSE);

	sfx = get_config_int("audio","sfx",TRUE);
	music = get_config_int("audio","music",TRUE);

	musicVol = get_config_float("audio","musicvol",1.0f);
	soundVol = get_config_float("audio","soundvol",1.0f);
	
	Logfile::log("Configuration read:\n",0);
	Logfile::log(	"\tshowFPS: %d\n"
			"\tsfx: %d\n"
			"\tmusic: %d\n"
			"\tfullscreen: %d\n",
			showFPS, sfx, music, fullscreen);
	
	
	// This is lame, I know, but it gets the job done of turning
	// sound and music either on or off as specified in the file
	toggleSFX(); toggleSFX();
	toggleMusic(); toggleMusic();
}
Esempio n. 3
0
Sun::Sun(Vector2 opos, SpaceSprite *sprite, int index)
:
SpaceObject(NULL, opos, 0.0, sprite)
{
	STACKTRACE;

	layer = LAYER_SHOTS;
	set_depth(LAYER_EXPLOSIONS);
	//	collide_flag_sameship = 0;

	//	collide_flag_sameship = ALL_LAYERS;
	//	layer = LAYER_CBODIES;
	//	id         |= ID_PLANET;
	id=SUN_ID;
	//	mass        = 9999999.0;
	damage_factor=6;

	//use remote .ini file
	game->log_file ("server.ini");
	sprite_index = index;
	gravity_mindist = scale_range(get_config_float("Sun", "GravityMinDist", 0));
	gravity_range = scale_range(get_config_float("Sun", "GravityRange", 0));
	gravity_power = get_config_float("Sun", "GravityPower", 0);
	gravity_force =
		scale_acceleration(get_config_float("Sun", "GravityForce", 0), 0);
	gravity_whip = get_config_float("Sun", "GravityWhip", 0);

}
Esempio n. 4
0
static float get_float (char *section, char *option, char *shortcut, float def)
{
	int i;
	float res;

	res = def;

	if (!ignorecfg)
	{
		/* if the option does not exist, create it */
		if (get_config_float (section, option, 9999.0) == 9999.0)
			set_config_float (section, option, def);

		/* look into mame.cfg, [section] */
		res = get_config_float (section, option, def);

		/* look into mame.cfg, [gamename] */
		res = get_config_float ((char *)drivers[game]->name, option, res);
	}

	/* get it from the commandline */
	for (i = 1; i < mame_argc; i++)
	{
		if (mame_argv[i][0] != '-')
			continue;
		if ((stricmp(&mame_argv[i][1], option) == 0) ||
			(shortcut && (stricmp(&mame_argv[i][1], shortcut ) == 0)))
		{
			i++;
			if (i < mame_argc) res = atof (mame_argv[i]);
		}
	}
	return res;
}
Esempio n. 5
0
DaktaklakpakVivisector::DaktaklakpakVivisector(Vector2 opos, double shipAngle,
	ShipData *shipData, unsigned int code)
	:
	Ship(opos, shipAngle, shipData, code)

{
  weaponFrames = get_config_int("Weapon", "Frames", 0);
  drillFrames  = 0;
  weaponDamage   = get_config_int("Weapon", "Damage", 0);

  specialRange    = scale_range(get_config_float("Special", "Range", 0));
  specialVelocity = scale_velocity(get_config_float("Special", "Velocity", 0));
  specialDamage   = get_config_int("Special", "Damage", 0);
  specialArmour   = get_config_int("Special", "Armour", 0);
  specialArming   = get_config_int("Special","Arming",0);
  specialLaunch   = scale_velocity(get_config_int("Special","Launch",0));
  latched         = FALSE;
  grabbed         = NULL;

  numMines=0;
  maxMines=8;
  weaponObject = new DaktaklakpakMine*[maxMines];
  for (int i = 0; i < maxMines; i += 1) {
    weaponObject[i] = NULL;
		}

}
Esempio n. 6
0
NaroolLurker::NaroolLurker(Vector2 opos, double shipAngle,
ShipData *shipData, unsigned int code)
:
Ship(opos, shipAngle, shipData, code)
{
	STACKTRACE;
	weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
	weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
	weaponDamage   = get_config_int("Weapon", "Damage", 0);
	weaponArmour   = get_config_int("Weapon", "Armour", 0);
	weaponDuration = get_config_int("Weapon", "Duration", 0);
	poison         = get_config_float("Weapon", "poison", 0);

	normalRechargeAmount = recharge_amount;

	cloak = FALSE;
	cloak_frame = 0;

	BITMAP *shpbmp = sprite->get_bitmap(0);
	int bpp = bitmap_color_depth(shpbmp);
	lightningbmp = create_bitmap_ex(bpp, shpbmp->w, shpbmp->h);
	clear_to_color(lightningbmp, makeacol(0,0,0,255));
	//maxsparktime = 2000;
	maxsparktime = get_config_float("Quirk", "maxsparktime", 2000);
	sparktime = maxsparktime;
	sparkpos = 0.5 * Vector2(lightningbmp->w,lightningbmp->h);

	Rmax = get_config_float("Quirk", "Rmax", 1);
}
Esempio n. 7
0
/*
 * retrieve hscale,hoffset,usfoffset and usfheight from  EEPROM
 */
void get_config(void) {
  if(get_config_word(&cfgMagic)==MAGIC) {
    hscale= get_config_float(&cfgHScale);
    hoffset= get_config_float(&cfgHOffset);
    usfoffset= get_config_float(&cfgUSFOffset);
    usfheight= get_config_float(&cfgUSFHeight);
  } else {
    set_hconfig(HSCALE_DEFAULT, HOFFSET_DEFAULT);
    set_usfconfig(USFOFFSET_DEFAULT, USFHEIGHT_DEFAULT);
    set_config_word(&cfgMagic, MAGIC);
  }
}
Esempio n. 8
0
KorvianSniper::KorvianSniper(Vector2 opos, double angle, ShipData *data, unsigned int code) 
	:
	Ship(opos, angle, data, code)
{
  weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
  weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
  weaponDamage   = get_config_int("Weapon", "Damage", 0);
  weaponArmour   = get_config_int("Weapon", "Armour", 0);
  beep = FALSE;

  cloak = TRUE;
}
Esempio n. 9
0
HeraldExterminator::HeraldExterminator(Vector2 opos, double shipAngle,
	ShipData *shipData, unsigned int code)
	:
	Ship(opos, shipAngle, shipData, code)
{
  weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
  weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
  weaponDamage   = get_config_int("Weapon", "Damage", 0);
  weaponArmour   = get_config_int("Weapon", "Armour", 0);

  cloak = FALSE;
  cloak_frame = 0;
}
Esempio n. 10
0
JurgathaCutter::JurgathaCutter(Vector2 opos, double shipAngle,
ShipData *shipData, unsigned int code) :
Ship(opos, shipAngle, shipData, code)
{
	STACKTRACE;
	batt_counter = 0;

	weaponRange     = scale_range(get_config_float("Weapon", "Range", 0));
	weaponSpeed     = get_config_float("Weapon", "Speed", 1);
	weaponDamage    = get_config_int("Weapon", "Damage", 0);
	weaponColor     = get_config_int("Weapon", "Color", 2);

	specialDamage   = get_config_int("Special", "Damage", 0);
	specialFrames   = scale_frames(get_config_int("Special", "Frames", 0));
}
Esempio n. 11
0
HarikaYornRavager::HarikaYornRavager(Vector2 opos, double shipAngle,
	ShipData *shipData, unsigned int code)
	:
	Ship(opos, shipAngle, shipData, code)
{
  regenrateFrames = 4000;
  regenrating    = FALSE;

  weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
  weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
  weaponDamage   = get_config_int("Weapon", "Damage", 0);
  weaponArmour   = get_config_int("Weapon", "Armour", 0);

  specialThrust  = scale_velocity(get_config_float("Special","Thrust",0));
  specialFrames  = get_config_int("Special", "Frames", 0);
  shieldFrames   = 0;
}
Esempio n. 12
0
VirtaoLimb::VirtaoLimb(Vector2 opos, double shipAngle,
ShipData *shipData, unsigned int code)
:
Ship(opos, shipAngle, shipData, code)
{
	STACKTRACE;

	weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
	weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
	weaponDamage   = get_config_int("Weapon", "Damage", 0);
	weaponArmour   = get_config_int("Weapon", "Armour", 0);
	weaponTurnRate = scale_turning(get_config_float("Weapon", "TurnRate", 0));

	specialRange  = scale_range(get_config_float("Special", "Range", 0));
	specialPower  = scale_range(get_config_float("Special", "Power", 0));

}
Esempio n. 13
0
int main(int argc, unsigned char **argv)
{
  /* Variables located at IR.config */
  int Resol_X, Resol_Y, count;
  char **screen;
  
  if (allegro_init() != 0)   /* you should always do this at the start of Allegro programs */
    return 1;
  
  set_config_file("config/Coco.config");  /* Read configuration file */
  
  install_keyboard();   /* set up the keyboard handler */
  install_timer();	/* set up the timer handler */
  
  set_color_depth(32);  
  /* Get screen resolution from Coco.config */
  screen = get_config_argv("content", "SCREEN_SIZE", &count);
  Resol_X = atoi(screen[0]);  Resol_Y = atoi(screen[1]);
  if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, Resol_X, Resol_Y, 0, 0) != 0)   /* for X */
    {
      if (set_gfx_mode(GFX_SAFE, Resol_X, Resol_Y, 0, 0) != 0)        /* for console */
	{
	  set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	  allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
	  return 1;
	}
    }
  
  /* Check if all images exists before trying to blit'em */
  /* Add some protection */
  
  set_palette(desktop_palette);   /* set the color palette */
  
  /* Read desired sampling time in IR.config */
  Delay= (get_config_float("content", "Delay", 0));  
  
  iSP= (get_config_float("content", "iSP", 0));  
  SP= iSP*3.68;
  
  /* Go to Register the user and run the program after having hardware initialized */

  Register();
  return 0;  
}
Esempio n. 14
0
UoiSlicer::UoiSlicer(Vector2 opos, double shipAngle,
ShipData *shipData, unsigned int code)
:
Ship(opos,  shipAngle, shipData, code)
{
	STACKTRACE;

	weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
	weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
	weaponDamage   = get_config_int("Weapon", "Damage", 0);
	weaponArmour   = get_config_int("Weapon", "Armour", 0);

	specialRange    = scale_range(get_config_float("Special", "Range", 0));
	specialFrames   = scale_frames(get_config_int("Special", "Frames", 0));
	specialTurnRate = scale_turning(get_config_float("Special", "TurnRate", 0));
	specialColor    = get_config_int("Special", "Color", 0);
	specialDamage   = get_config_int("Special", "Damage", 0);

	turretAngle = 0.0;
	turret_turn_rate = scale_turning(get_config_float("Turret", "TurnRate", 0));
	turret_turn_step = 0;

	weapon_left_right = 1;
}
Esempio n. 15
0
CPlayer::CPlayer(int x,int y,char *key_bindings_file,int solid)
{	
	set_config_file(key_bindings_file);
	key_left = get_config_int(NULL,"LEFT",0);
	key_right = get_config_int(NULL,"RIGHT",0);
	key_fire  = get_config_int(NULL,"FIRE",0);
	
	this->x = x;
	this->y = y;
	set_config_file(DEFAULT_PLAYER_CONFIG_FILE);
	bonus_frequency = default_bonus_frequency = get_config_int(NULL,"bonus_rate",5);
	more_bonuses_modifier = get_config_int(NULL,"more_bonuses_modifier",1);
	more_bonuses_duration = get_config_int(NULL,"more_bonuses_duration",10);
	
	move_speed = default_move_speed = get_config_int(NULL,"pad_speed",100);
	speed_modifier = get_config_int(NULL,"player_speed_modifier",5);
	
	set_color_conversion(COLORCONV_TOTAL);
	model = load_bitmap("/home/valo/Projects/breakin/graphics/batata.bmp",NULL);
	width = model->w;
	height = model->h;
	
	score = 0;
	last_scored = -30;
	bonus_points = 0;
	
	solid_walls = solid;
	
	immortal_time = get_config_int(NULL,"immortal_time",10);
	
	penetrating = false;
	penetration_time = get_config_int(NULL,"penetration_duration",10);
	
	ball_speed = default_ball_speed = get_config_int(NULL,"ball_speed",5);
	ball_speed_modifier = get_config_int(NULL,"ball_speed_modifier",10);
	
	fast_hit_max_time = get_config_float(NULL,"fast_hit_max_time",0.5);
	
	status_font1 = alfont_load_font(STATUS_FONT1_FILENAME);
	status_font2 = alfont_load_font(STATUS_FONT2_FILENAME);
	alfont_set_font_size(status_font1,50);
	alfont_set_font_size(status_font2,20);
}
Esempio n. 16
0
// Shows the JPEG configuration dialog.
SharedPtr<FormatOptions> JpegFormat::onGetFormatOptions(FileOp* fop)
{
  SharedPtr<JpegOptions> jpeg_options(new JpegOptions());
  try {
    // Configuration parameters
    jpeg_options->quality = get_config_float("JPEG", "Quality", 1.0f);

    // Interactive mode
    if (!App::instance()->isGui())
      return jpeg_options;

    // Load the window to ask to the user the JPEG options he wants.
    FramePtr window(load_widget("jpeg_options.xml", "jpeg_options"));
    Slider* slider_quality;
    Widget* ok;
    get_widgets(window,
		"quality", &slider_quality,
		"ok", &ok, NULL);

    slider_quality->setValue(jpeg_options->quality * 10.0f);

    window->open_window_fg();

    if (window->get_killer() == ok) {
      jpeg_options->quality = slider_quality->getValue() / 10.0f;
      set_config_float("JPEG", "Quality", jpeg_options->quality);
    }
    else {
      jpeg_options.reset(NULL);
    }

    return jpeg_options;
  }
  catch (base::Exception& e) {
    Console::showException(e);
    return SharedPtr<JpegOptions>(0);
  }
}
Esempio n. 17
0
ArilouTrapper::ArilouTrapper(Vector2 opos, double shipAngle, ShipData *shipData,
unsigned int code) : Ship(opos, shipAngle, shipData, code)
{
	STACKTRACE;
	weapon_sample -= 1;
	regenrateFrames = 400;
	regenerating    = FALSE;
	rechargeAmount = get_config_int("Ship", "rechargeAmount", 0);
	drainDelay     = get_config_int("Trap", "drainDelay", 0);
	drainAmount    = get_config_int("Trap", "drainAmount", 0);
	trapTurn       = get_config_float("Trap", "trapTurn", 0);
	trapInitialVelocity = get_config_float("Trap", "initialVelocity", 0);
	weaponRange    = scale_range(get_config_float("Weapon", "Range", 0));
	trapAccel      = get_config_float("Trap", "Accel", 0);
	weaponVelocity = scale_velocity(get_config_float("Weapon", "Velocity", 0));
	weaponDamage   = get_config_int("Weapon", "Damage", 0);
	weaponArmour   = get_config_int("Weapon", "Armour", 0);
	weaponDuration = get_config_int("Weapon", "Duration", 0);
	quasiVelocity  = scale_velocity(get_config_float("Ship","quasiVelocity", 0));
	normalRechargeAmount = recharge_amount;
	cloak = FALSE;
	cloak_frame = 0;

}
Esempio n. 18
0
TeronBuilder::TeronBuilder( Vector2 opos, double shipAngle, ShipData *shipData, unsigned int code ):
Ship( opos, shipAngle, shipData, code )
{
	STACKTRACE;
	collect_step = 0;
	collecting = NULL;
	collectRange = scale_range( get_config_float( "Extra", "CollectRange", 0 ));
	asteroid_value = get_config_int("Extra", "AsteroidValue", 0);

	drone_cost     = get_config_int("Drone", "Cost", 0);
	drone_asteroid_value = get_config_int("Drone", "AsteroidValue", 0);
	drone_crew_max = get_config_int("Drone", "CrewMax", 0);
	drone_batt_max = get_config_int("Drone", "BattMax", 0);
	drone_recharge_amount  = get_config_int("Drone", "RechargeAmount", 0);
	drone_recharge_rate    = scale_frames(get_config_float("Drone", "RechargeRate", 0));
	drone_weapon_drain     = get_config_int("Drone", "WeaponDrain", 0);
	drone_weapon_rate      = scale_frames(get_config_float("Drone", "WeaponRate", 0));
	drone_special_drain    = get_config_int("Drone", "SpecialDrain", 0);
	drone_special_rate     = scale_frames(get_config_float("Drone", "SpecialRate", 0));
	double drone_raw_hotspot_rate = get_config_float("Drone", "HotspotRate", 0);
	drone_hotspot_rate  = scale_frames(drone_raw_hotspot_rate);
	drone_turn_rate     = scale_turning(get_config_float("Drone", "TurnRate", 0));
	drone_speed_max     = scale_velocity(get_config_float("Drone", "SpeedMax", 0));
	drone_accel_rate    = scale_acceleration(get_config_float("Drone", "AccelRate", 0), drone_raw_hotspot_rate);
	drone_mass          = get_config_int("Drone", "Mass", 0);

	droneWeaponRange = scale_range( get_config_float( "Drone", "WeaponRange", 0 ));

	fighter_cost     = get_config_int("Fighter", "Cost", 0);
	fighter_crew_max = get_config_int("Fighter", "CrewMax", 0);
	fighter_batt_max = get_config_int("Fighter", "BattMax", 0);
	fighter_recharge_amount  = get_config_int("Fighter", "RechargeAmount", 0);
	fighter_recharge_rate    = scale_frames(get_config_float("Fighter", "RechargeRate", 0));
	fighter_weapon_drain     = get_config_int("Fighter", "WeaponDrain", 0);
	fighter_weapon_rate      = scale_frames(get_config_float("Fighter", "WeaponRate", 0));
	fighter_special_drain    = get_config_int("Fighter", "SpecialDrain", 0);
	fighter_special_rate     = scale_frames(get_config_float("Fighter", "SpecialRate", 0));
	double fighter_raw_hotspot_rate = get_config_float("Fighter", "HotspotRate", 0);
	fighter_hotspot_rate  = scale_frames(fighter_raw_hotspot_rate);
	fighter_turn_rate     = scale_turning(get_config_float("Fighter", "TurnRate", 0));
	fighter_speed_max     = scale_velocity(get_config_float("Fighter", "SpeedMax", 0));
	fighter_accel_rate    = scale_acceleration(get_config_float("Fighter", "AccelRate", 0), fighter_raw_hotspot_rate);
	fighter_mass          = get_config_int("Fighter", "Mass", 0);

	fighterWeaponRange = scale_range( get_config_float( "Fighter", "WeaponRange", 0 ));
	fighterWeaponVelocity = scale_velocity( get_config_float( "Fighter", "WeaponVelocity", 0 ));
	fighterWeaponDamage = get_config_int( "Fighter", "WeaponDamage", 0 );
	fighterWeaponArmour = get_config_int( "Fighter", "WeaponArmour", 0 );

	turret_cost     = get_config_int("Turret", "Cost", 0);
	turret_crew_max = get_config_int("Turret", "CrewMax", 0);
	turret_batt_max = get_config_int("Turret", "BattMax", 0);
	turret_recharge_amount  = get_config_int("Turret", "RechargeAmount", 0);
	turret_recharge_rate    = scale_frames(get_config_float("Turret", "RechargeRate", 0));
	turret_weapon_drain     = get_config_int("Turret", "WeaponDrain", 0);
	turret_weapon_rate      = scale_frames(get_config_float("Turret", "WeaponRate", 0));
	turret_special_drain    = get_config_int("Turret", "SpecialDrain", 0);
	turret_special_rate     = scale_frames(get_config_float("Turret", "SpecialRate", 0));
	turret_turn_rate        = scale_turning(get_config_float("Turret", "TurnRate", 0));
	turret_mass             = get_config_int("Turret", "Mass", 0);

	turretWeaponRange = scale_range( get_config_float( "Turret", "WeaponRange", 0 ));
	turretWeaponVelocity = scale_velocity( get_config_float( "Turret", "WeaponVelocity", 0 ));
	turretWeaponDamage = get_config_int( "Turret", "WeaponDamage", 0 );
	turretWeaponArmour = get_config_int( "Turret", "WeaponArmour", 0 );

	attached_turret_recharge_amount  = get_config_int("TurretAttached", "RechargeAmount", 0);
	attached_turret_recharge_rate    = scale_frames(get_config_float("TurretAttached", "RechargeRate", 0));
	attached_turret_weapon_drain     = get_config_int("TurretAttached", "WeaponDrain", 0);
	attached_turret_weapon_rate      = scale_frames(get_config_float("TurretAttached", "WeaponRate", 0));
	attached_turret_special_drain    = get_config_int("TurretAttached", "SpecialDrain", 0);
	attached_turret_special_rate     = scale_frames(get_config_float("TurretAttached", "SpecialRate", 0));
	attached_turret_turn_rate        = scale_turning(get_config_float("TurretAttached", "TurnRate", 0));

	attachedTurretWeaponRange = scale_range( get_config_float( "TurretAttached", "WeaponRange", 0 ));
	attachedTurretWeaponVelocity = scale_velocity( get_config_float( "TurretAttached", "WeaponVelocity", 0 ));
	attachedTurretWeaponDamage = get_config_int( "TurretAttached", "WeaponDamage", 0 );
	attachedTurretWeaponArmour = get_config_int( "TurretAttached", "WeaponArmour", 0 );

	dock[0].dist  = 25;
	dock[0].dir   = 75 * ANGLE_RATIO;
	dock[0].angle = 80 * ANGLE_RATIO;
	dock[0].avail = true;
	dock[1].dist  = 25;
	dock[1].dir   = 115 * ANGLE_RATIO;
	dock[1].angle = 90 * ANGLE_RATIO;
	dock[1].avail = true;
	dock[2].dist  = 25;
	dock[2].dir   = 245 * ANGLE_RATIO;
	dock[2].angle = 270 * ANGLE_RATIO;
	dock[2].avail = true;
	dock[3].dist  = 25;
	dock[3].dir   = 295 * ANGLE_RATIO;
	dock[3].angle = 270 * ANGLE_RATIO;
	dock[3].avail = true;

	int i;
	for ( i = 0; i < 4; ++i )
		dock[i].dist *= 2;

	sprintf( option[option_build_drone].phrase, "Initiate Drone Construction" );
	sprintf( option[option_build_turret].phrase, "Initiate Turret Construction" );
	sprintf( option[option_build_fighter].phrase, "Initiate Fighter Construction" );
	sprintf( option[option_order_assist_building].phrase, "Order Drone to Assist Building" );
	sprintf( option[option_order_collect_resources].phrase, "Order Drone to Collect Resources" );
	sprintf( option[option_order_return_to_dock].phrase, "Order Drone to Return to Dock" );
	current_option = option_order_return_to_dock;
	current_drone  = NULL;
	selection_sprite_index = 0;
	selection_sprite_step = 0;
	select_all = false;

	selectRange = scale_range( get_config_float( "Extra", "Range", 0 ));

	select_all = true;
	current_option = option_order_collect_resources;
}
Esempio n. 19
0
AstromorphBasilisk::AstromorphBasilisk(Vector2 opos, double angle, ShipData *data, unsigned int code)
:
Ship(opos, angle, data, code)

{
	STACKTRACE;
	slitherTime         = get_config_float("Ship", "SlitherTime",0);
	slitherAmount       = get_config_float("Ship", "SlitherAmount",0);
	slitherAccel        = scale_acceleration(get_config_float("Ship", "SlitherRate", 0), 0);
	slitherTick         = 1.0;
	slitherFriction     = get_config_float("Ship", "SlitherFriction", 0.0006);
	cruise_max          = scale_velocity(get_config_float("Ship", "CruiseMax",0));
	whip_speed          = scale_velocity(get_config_float("Special", "WhipSpeed",0));

	hurt_damage         = get_config_float("Special", "FlashDamage", 0);
	max_hurt_flash_time = get_config_float("Special", "FlashTime", 0);
	hurty_time          = 0;

	regrowTime          = get_config_float("Ship", "RegrowTime",0);
	regrow_delay        = regrowTime;
	regrowDrain         = get_config_int("Ship", "RegrowDrain",0);

	bOtherWay           = false;
	slitherFrame        = 0;

	weaponColor         =  get_config_int("Weapon", "Color", 0);

	poison              = get_config_float("Weapon", "Poison", 0);
	weaponVelocity      = scale_velocity(get_config_float("Weapon", "Velocity", 0));
	weaponRange         = scale_range(get_config_float("Weapon", "Range", 0));
	weaponDamage        = get_config_int("Weapon", "Damage", 0);
	weaponLife          = get_config_int("Weapon", "PoisonDuration",0);
	weaponArmour        = get_config_int("Weapon", "Armor",0);

	aimlineRange        = scale_range(get_config_float("Weapon", "AimRange",0));
	aimlineAngleRange   = get_config_float("Weapon", "AimAngleMax",0) * ANGLE_RATIO;
	aimBonus            = get_config_float("Weapon", "TargetedSpeedBonus",1);
	aimline             = NULL;

	specialSegs         =  get_config_int("Special","Links",0);
	numSegs             = specialSegs;
	specialMass         =  get_config_float("Special","LinkMass",0);
	specialSpacing      = get_config_float("Special","LinkDistance",0);
	specialHealth       = get_config_float("Special", "LinkHealth",0);

	add(Head = new BChain(this, pos, angle, data->spriteSpecial, specialSegs,
		specialSpacing, specialMass, specialHealth, max_hurt_flash_time, hurt_damage, slitherFriction));

	hashotspots = false;
}
Esempio n. 20
0
SefyNautilus2::SefyNautilus2(Vector2 opos, double angle, ShipData *data, unsigned int code)
:
Ship(opos, angle, data, code)
{
	STACKTRACE;
	// time for retracting 1 piece of rope, in seconds
	specialLifeTime = get_config_float("Special", "LifeTime", 60.0);
	// time for retracting 1 piece of rope, in seconds
	specialDelay    = get_config_float("Special", "Delay", 0.5);
	// osc freq. of the rope when it's released
	specialOscFreq = get_config_float("Special", "OscFreq", 5.0);
	// extra velocity of the rope when release
	specialRelVelocity = get_config_float("Special", "RelVelocity", 0);
	// default segment length of a piece of rope (in pixels)
	specialSegLength = get_config_float("Special", "SegLength", 2.0);
	// armour of the hook
	specialArmour = get_config_float("Special", "Armour", 5.0);
	// spring constant: higher value, faster oscillations
	specialSprConst = get_config_float("Special", "SprConst", 250.0);
	specialHitRoids = bool(get_config_int("Special", "SnagAsteroids",0));

	hook = 0;
	unrolltime = 0;

	// below lifted from the Ducly Lanternjaws
	arm_angle = 0;

	double m = this->mass;
	// -dy is up, +dy is down !
	ArmLeft  = new ShipPart2(this, this->data->more_sprites[0], arm_angle, Vector2(-12,-21), Vector2(0,5), m);

	ArmRight = new ShipPart2(this, this->data->more_sprites[1], arm_angle, Vector2( 12,-21), Vector2(0,5), m);

	add(ArmLeft);
	add(ArmRight);

	arm_movement = false;
	arm_time = 0;
	//  arm_period = 10.0;
	//  arm_maxangle = 100 * ANGLE_RATIO;
	//  arc_corr = 30.0 * ANGLE_RATIO;
	arm_period = get_config_float("Arms", "OpenArmTime", 0);
	arm_period2 = get_config_float("Arms", "SnapArmTime", 0);
	arm_maxangle = get_config_float("Arms", "ArmMaxAngle", 0) * ANGLE_RATIO;
	arm_maxdamage = get_config_float("Weapon", "MaxDamage",0);
	arm_mindamage = get_config_float("Weapon", "MinDamage",0);

	sound_recharge = 0;

	ManageParts = new ShipPart2Manager(this);
	game->add(ManageParts);

	ManageParts->add_part(ArmLeft);
	ManageParts->add_part(ArmRight);
}
Esempio n. 21
0
int Simulator()
{

  set_config_file("IR.config");  /* Read configuration file */
  Delay= (get_config_float("content", "Delay", 0));  

  fd = open("/dev/parport0", O_RDWR );

  Screen3= load_bitmap("images/Simulator/Base.pcx", pal);
  blit(Screen3, screen, 0, 0, 0, 0, 1024, 768);  
  /* Boxes to show numerical values */
  rectfill(screen, 895, 270, 945, 303, WHITE);   
  rect(screen, 895, 270, 945, 303, 1);	// x1, y1, x2, y2
  
  textprintf_ex(screen, font, 320, 0, BLACK, -1, "Simulacion de la Planta");  


  while (!key[KEY_LEFT])	/* Only pressing KEY_LEFT will return */
    {
      /* This line reads data from the interfase which is
	 the process variable(measured variable) of the system */
      ioctl(fd, PPRDATA, &PVi);
      //PV= PVi;

      if(PVi<=48)
      {
	PVi= 51;
        system("festival --tts Messages/Disconnected &");
      }

//      if(PV<=48)
//        PVi= 51;

      PV= 1.367647*(PVi-51);//      279= X 204


      if(key[KEY_PGUP])
	SP= SP+45;

      if(key[KEY_PGDN])
	SP= SP-45;
      
      if(key[KEY_UP])
	SP= SP+5;

      if(key[KEY_DOWN])
	{
	  if(SP>=1)
	    SP= SP-5;
	}

      if(PVi>=253)
	{
	  textprintf_ex(screen, font, 320, 50, BLACK, RED, "Nivel Critico, revise el controlador");  
	  system("/usr/bin/mpg123 Sounds/Alarm.wav &");
	}

//      PV= (200/298)*100;

//	504  381  544  381
//	504  83   544  381
//      rectfill(screen, 832, 513-(SP/300), 883, 513, LIGHT_BLUE);
//      rectfill(screen, 832, 213, 883, 513-(SP/300), GRAY);

      /* Fill the tank with clear water */
      rectfill(screen, 687, 386-(SP/300), 710, 381, LIGHT_BLUE);
      rectfill(screen, 687, 83, 710, 386-(SP/300), GRAY);

      float K, BIAS;   K=-2; BIAS=184;
      K=(K/368)*100;

      /* (P) Proportional only control mode */
      OP= ((((SP/298)-(PV/298))*100)*K)+(OP/298);

	
      /* PV bar */
      rectfill(screen, 440, 381-(PV/298), 480, 381, RED);
      rectfill(screen, 440, 83, 480, 381-(PV/298), GRAY);

      /* SP bar */
      if (SP>=88734)	SP=88734;      
      if (SP<=1)	SP=1;
      rectfill(screen, 504, 381-(SP/298), 544, 381, GREEN);
      rectfill(screen, 504, 83, 544, 381-(SP/298), GRAY);

      /* OP bar */
      if (OP>=88734)	OP=88734;      
      if (OP<=1)	OP=1;
      rectfill(screen, 569, 381-(OP/298), 609, 381, BLUE);
      rectfill(screen, 569, 83, 609, 381-(OP/298), GRAY);


      textprintf_ex(screen, font, 900, 264, BLACK, WHITE, "%3.1fOP", (OP/88734)*100);
//      textprintf_ex(screen, font, 900, 364, BLACK, WHITE, "%3.1fOP", (OP/298)*100);      
      textprintf_ex(screen, font, 900, 364, BLACK, WHITE, "%3.1fSP", (SP/88734)*100);

      rest(Delay);
    }
  Automatic();      
  return 1;
}
Esempio n. 22
0
VelronCruiser::VelronCruiser(Vector2 opos, double angle, ShipData *data,
unsigned int code)  :
Ship(opos, angle, data, code)
{
	STACKTRACE;

	minBattForThrust = (get_config_float("Ship", "MinBattForThrust", 8));

	shipSpecialDrain = get_config_int("Ship", "SpecialDrain",1);

	weaponRangeMin    = scale_range(get_config_float("Weapon", "RangeMin", 10));
	weaponRangeMax    = scale_range(get_config_float("Weapon", "RangeMax", 60));

	weaponVelocityMin = scale_velocity(get_config_float("Weapon", "VelocityMin", 65));
	weaponVelocityMax = scale_velocity(get_config_float("Weapon", "VelocityMax", 95));

	weaponRelativity  = get_config_float("Weapon", "Relativity", 0.0);

	weaponRecoil      = scale_velocity(get_config_float("Weapon", "Recoil", 20));
	weaponRecoilMaxSpeed = scale_velocity(get_config_float("Weapon", "RecoilMaxSpeed", 40));
	if (weaponRecoilMaxSpeed <= 0) weaponRecoilMaxSpeed = MAX_SPEED;

	weaponDamageMin   = get_config_int("Weapon", "DamageMin", 4);
	weaponDamageMax   = get_config_int("Weapon", "DamageMax", 18);

	weaponArmourMin   = get_config_int("Weapon", "ArmourMin", 2);
	weaponArmourMax   = get_config_int("Weapon", "ArmourMax", 10);

	specialRange      = scale_range(get_config_float("Special", "Range", 6));
	specialDamage     = get_config_int("Special", "Damage", 1);
	specialVelocity   = scale_velocity(get_config_float("Special", "Velocity", 100));
	specialArmour     = get_config_int("Special", "Armour", 1);
	specialRelativity = get_config_float("Special", "Relativity", 1.0);

	specialMinAngle   = get_config_float("Special", "MinAngle",15) * ANGLE_RATIO;
	specialMidAngle   = get_config_float("Special", "MidAngle",90) * ANGLE_RATIO;
	specialMaxAngle   = get_config_float("Special", "MaxAngle",180) * ANGLE_RATIO;

	specialLaunchAngleDeflectionRange = get_config_float("Special", "LaunchAngleDeflectionRange", 2.0) * PI/180;
	specialDrain = get_config_int("Ship", "SpecialDrain", 1);
	specialDrainDivisor = get_config_int("Ship", "SpecialDrainDivisor", 2);

	inverseLights     = (get_config_int("Ship", "InverseLights", 1) != 0);

	specialDrainCounter = specialDrainDivisor;
	specialAlternatingFire = get_config_int("Special", "AlternatingFire", 0);

}
Esempio n. 23
0
void change_options()
{
	STACKTRACE;
	int optionsRet, i;

	tw_set_config_file("client.ini");
	//	old_optionsDialog[OPTIONS_DIALOG_AA].d1 = get_aa_mode();

	old_optionsDialog[OPTIONS_DIALOG_INTERPOLATION_ON].flags =
		interpolate_frames ? D_SELECTED : 0;
	int aa = get_config_int("Rendering", "AA_Mode", AA_NO_AA);
	old_optionsDialog[OPTIONS_DIALOG_AA_ON].flags =
		(aa&AA_NO_AA) ? 0 : D_SELECTED;
	old_optionsDialog[OPTIONS_DIALOG_NOALIGN_ON].flags =
		(aa&AA_NO_ALIGN) ? D_SELECTED : 0;
	old_optionsDialog[OPTIONS_DIALOG_BLEND_ON].flags =
		(aa&AA_BLEND) ? D_SELECTED : 0;
	old_optionsDialog[OPTIONS_DIALOG_ALPHA_ON].flags =
		(aa&AA_ALPHA) ? D_SELECTED : 0;

	tw_set_config_file("server.ini");
	old_optionsDialog[OPTIONS_DIALOG_STARS_SLIDER].d2 =
		get_config_int("Stars", "Depth", 192);
	old_optionsDialog[OPTIONS_DIALOG_RELATIVITY_SLIDER].d2 =
		iround(get_config_float("Game", "ShotRelativity", 0.5) * 1000);
	if (get_config_int("Game", "FriendlyFire", 1))
		old_optionsDialog[OPTIONS_DIALOG_FRIENDLY_FIRE].flags = D_SELECTED;
	else
		old_optionsDialog[OPTIONS_DIALOG_FRIENDLY_FIRE].flags = 0;

	if (get_config_int("View", "CameraHidesCloakers", 1))
		old_optionsDialog[OPTIONS_DIALOG_HIDE_CLOAKERS].flags = D_SELECTED;
	else
		old_optionsDialog[OPTIONS_DIALOG_HIDE_CLOAKERS].flags = 0;

	tw_set_config_file("client.ini");

	if (get_config_int("Planet", "PlanetDimension", 2) == 3)
		old_optionsDialog[OPTIONS_DIALOG_3DPLANET].flags = D_SELECTED;
	else
		old_optionsDialog[OPTIONS_DIALOG_3DPLANET].flags = 0;

	i = get_view_num ( get_config_string ( "View", "View", NULL ) );
	if (i == -1) i = 0;
	old_optionsDialog[OPTIONS_DIALOG_VIEW].d1 = i;

	optionsRet = tw_popup_dialog(NULL, old_optionsDialog, OPTIONS_DIALOG_OK);

	if (optionsRet == OPTIONS_DIALOG_CANCEL) return;

	//	set_aa_mode(old_optionsDialog[OPTIONS_DIALOG_AA].d1);

	tw_set_config_file("client.ini");
	//	set_config_int("View", "Anti-Aliasing", get_aa_mode());
	interpolate_frames =
		(old_optionsDialog[OPTIONS_DIALOG_INTERPOLATION_ON].flags & D_SELECTED) ? 1 : 0;
	set_config_int("View", "InterpolateFrames", interpolate_frames);
	aa&=~AA_NO_AA;aa|= (old_optionsDialog[OPTIONS_DIALOG_AA_ON].flags) ?
		0 : AA_NO_AA;
	aa&=~AA_NO_ALIGN;aa|= (old_optionsDialog[OPTIONS_DIALOG_NOALIGN_ON].flags) ?
		AA_NO_ALIGN : 0;
	aa&=~AA_BLEND;aa|= (old_optionsDialog[OPTIONS_DIALOG_BLEND_ON].flags) ?
		AA_BLEND : 0;
	aa&=~AA_ALPHA;aa|= (old_optionsDialog[OPTIONS_DIALOG_ALPHA_ON].flags) ?
		AA_ALPHA : 0;
	set_config_int("Rendering", "AA_Mode", aa);
	set_tw_aa_mode(aa);

	if (old_optionsDialog[OPTIONS_DIALOG_3DPLANET].flags == D_SELECTED)
		i = 3;
	else
		i = 2;
	set_config_int("Planet", "PlanetDimension", i);

	View *v = get_view(
		view_name[old_optionsDialog[OPTIONS_DIALOG_VIEW].d1],
		NULL
		);
	set_view(v);
	twconfig_set_string("/cfg/client.ini/view/view",
		view_name[old_optionsDialog[OPTIONS_DIALOG_VIEW].d1]);
	if (game && !game->view_locked) game->change_view(
			view_name[old_optionsDialog[OPTIONS_DIALOG_VIEW].d1]);

	twconfig_set_int("/cfg/server.ini/stars/depth",
		old_optionsDialog[OPTIONS_DIALOG_STARS_SLIDER].d2);

	twconfig_set_float("/cfg/server.ini/game/shotrelativity",
		old_optionsDialog[OPTIONS_DIALOG_RELATIVITY_SLIDER].d2 / 1000.0);

	if (old_optionsDialog[OPTIONS_DIALOG_FRIENDLY_FIRE].flags & D_SELECTED)
		i = 1;
	else i = 0;
	twconfig_set_int("/cfg/server.ini/game/friendlyfire", i);

	if (old_optionsDialog[OPTIONS_DIALOG_HIDE_CLOAKERS].flags & D_SELECTED)
		i = 1;
	else i = 0;
	twconfig_set_int("/cfg/server.ini/view/camerahidescloakers", i);

	return;
}