//-------------------------------------------------------------------------------------------------
void update() {
//-------------------------------------------------------------------------------------------------
	int frames = gametime::frames_passed();

	cloud_offset += wind * (float)frames;

	generate_perlin(frames*100000);
	if( writey >= datasize ) {
		if( current_texture_slot != next_texture_slot ) {
			send_texture();
		}
	}

	debug1 += 0.01f;
	set_density((sin(debug1)+1.0f)/4.0f);
	set_density((float)fmod(abs(Ingame::test.angle/8.0), 1.0));
	//set_density(0.3);
	//set_density(0.1);

	if( frames == 0 ) return;
	float t =(float)frames;
	mu += t * 0.0001f;
	//mu += t * 0.01f;
	if( mu >= 1.0f ) {
		mu = 1.0f;
		if( current_texture_slot == next_texture_slot ) {
			mu = 0.0f;
			current_texture_slot++;
			if( current_texture_slot > 2 ) current_texture_slot = 0;

		}
	}
}
Exemple #2
0
/**
 * \brief Constructor.
 */
rp::zeppelin::zeppelin()
: m_hit(false), m_item(NULL)
{
  set_mass(100);
  set_density(0.001);
  set_system_angle_as_visual_angle(true);
  set_phantom(true);
  set_artificial(false);
} // rp::zeppelin::zeppelin()
Exemple #3
0
/**
 * \brief Copy constructor.
 * \param that The instance to copy from.
 */
rp::zeppelin::zeppelin( const zeppelin& that )
  : super(that), m_hit(false),
    m_item( that.m_item == NULL ? NULL : that.m_item->clone() )
{
  set_mass(100);
  set_density(0.001);
  set_system_angle_as_visual_angle(true);
  set_phantom(true);
  set_artificial(false);
} // rp::zeppelin::zeppelin()
Exemple #4
0
static int do_gem_img(deark *c, lctx *d)
{
	dbuf *unc_pixels = NULL;
	de_bitmap *img = NULL;
	de_finfo *fi = NULL;
	int is_color = 0;
	i64 k;

	if(d->header_size_in_words==9 && (d->nplanes==3 || d->nplanes==4)) {
		i64 x;
		x = de_getu16be(8*2);
		if(x==0) {
			is_color = 1;
		}
	}

	de_dbg(c, "image at %d", (int)d->header_size_in_bytes);

	unc_pixels = dbuf_create_membuf(c, d->rowspan_total*d->h, 0);

	uncompress_pixels(c, d, unc_pixels, d->header_size_in_bytes, c->infile->len-d->header_size_in_bytes);

	img = de_bitmap_create(c, d->w, d->h, is_color?3:1);

	fi = de_finfo_create(c);
	set_density(c, d, fi);

	if(d->nplanes==1) {
		de_convert_image_bilevel(unc_pixels, 0, d->rowspan_per_plane, img, DE_CVTF_WHITEISZERO);
	}
	else if(is_color && d->nplanes==3) {
		for(k=0; k<8; k++) {
			d->pal[k] = pal3bit[k];
		}
		read_paletted_image(c, d, unc_pixels, img);
	}
	else if(is_color && d->nplanes==4) {
		for(k=0; k<16; k++) {
			d->pal[k] = pal4bit[k];
		}
		read_paletted_image(c, d, unc_pixels, img);
	}
	else {
		de_make_grayscale_palette(d->pal, ((i64)1)<<((unsigned int)d->nplanes), 1);
		read_paletted_image(c, d, unc_pixels, img);
	}

	de_bitmap_write_to_file_finfo(img, fi, 0);

	de_bitmap_destroy(img);
	de_finfo_destroy(c, fi);
	dbuf_close(unc_pixels);
	return 1;
}
Exemple #5
0
/**
 * \brief Constructor.
 */
ptb::gorilla::gorilla()
  : m_progress(NULL), m_want_come_back(false), m_scan_distance(320)
{
  set_z_fixed(false);
  set_mass(100);
  set_density(2);

  m_monster_type = monster::enemy_monster;
  m_energy = 30;
  m_offensive_phase = true;
  m_offensive_force = s_gorilla_offensive_force;
  m_offensive_coefficients[normal_attack] = 1;
  get_rendering_attributes().mirror(false);
  set_category("gorilla");
} // gorilla::gorilla()
Exemple #6
0
void load(mapping data)
{
	ACCESS_CHECK(GAME());

	set_archetypes(data["archetypes"]);
	set_virtual(data["virtual"]);
	set_capacity(data["capacity"]);
	set_density(data["density"]);
	set_flexible(data["flexible"]);
	set_id(data["id"]);
	rearrange_inventory(data["inventory"]);
	set_mass(data["mass"]);
	set_max_mass(data["max_mass"]);
	set_local_properties(data["properties"]);
}
        /// Set the average number of nonzero symbols
        /// @param symbols the average number of nonzero symbols
        void set_average_nonzero_symbols(double symbols)
        {
            // If binary, check that symbols are less than
            // the total number of symbols
            assert(!fifi::is_binary<field_type>::value ||
                symbols < SuperCoder::symbols());

            // If not binary, check that symbols are less than or equal the
            // total number of symbols
            assert(fifi::is_binary<field_type>::value ||
                symbols <= SuperCoder::symbols());

            assert(symbols > 0.0);
            set_density(symbols/SuperCoder::symbols());
        }
Exemple #8
0
static int
read_header(teledisk_prop_t *prop)
{
  char buf[2048];
  struct {
    unsigned char  file_id[2];
    unsigned char  volume_sequence;
    unsigned char  check_signature;
    unsigned char  version_number;
    unsigned char  source_density;
    unsigned char  drive_type;
    unsigned char  track_density;
    unsigned char  dos_mode;
    unsigned char  heads;
    unsigned short crc;
  } h;

  struct {
    unsigned short crc;
    unsigned short len;
    unsigned char  year;
    unsigned char  month;
    unsigned char  day;
    unsigned char  hour;
    unsigned char  minute;
    unsigned char  second;
  } comment;

  const char *month[] = {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  };

  if (fread(&h, sizeof(h), 1, prop->f) != 1)
    return 0;

  /*
   *  check file identifier
   */
  if ((h.file_id[0] != 'T') && (h.file_id[0] != 't'))
    return 0;

  if ((h.file_id[1] != 'D') && (h.file_id[1] != 'd'))
    return 0;

  if (h.volume_sequence != 0)
    return 0;

  prop->id[0] = h.file_id[0];
  prop->id[1] = h.file_id[1];
  prop->id[2] = 0;
  prop->volume = h.volume_sequence;
  prop->signature = h.check_signature;
  prop->version_major = h.version_number / 16;
  prop->version_minor = h.version_number & 15;
  prop->heads = h.heads;
  prop->dos_mode = h.dos_mode;

  if (!set_density(prop, h.source_density))
    return 0;

  if (!set_drive_type(prop, h.drive_type))
    return 0;

  // check for comment
  if ((h.track_density & 0x80) != 0)
    {
      // comment header
      if (fread(&comment, sizeof(comment), 1, prop->f) != 1)
        return 0;

      snprintf(buf, sizeof(buf), "%02d. %s %04d, %02d:%02d:%02d",
             comment.day, month[comment.month], comment.year + 1900,
             comment.hour, comment.minute, comment.second);
      prop->comment_date = strdup(buf);

      if (comment.len >= (sizeof(buf) - 1))
        return 0;
      
      /*
       *  read comment
       */
      memset(buf, 0, sizeof(buf));
      if (fread(buf, 1, comment.len, prop->f) != comment.len)
        return 0;

      printf("comment: %s\n", buf);
      prop->comment = strdup(buf);
    }

  return 1;
}
Exemple #9
0
// XIMG and similar formats.
// TODO: Should this function be merged with do_gem_img()?
static int do_gem_ximg(deark *c, lctx *d)
{
	dbuf *unc_pixels = NULL;
	de_bitmap *img = NULL;
	de_finfo *fi = NULL;
	int retval = 0;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	de_dbg(c, "header (continued) at %d", 8*2);
	de_dbg_indent(c, 1);

	if((d->nplanes>=1 && d->nplanes<=8) /* || d->nplanes==24 */) {
		;
	}
	else {
		if(d->is_ximg)
			de_err(c, "%d-plane XIMG images are not supported", (int)d->nplanes);
		else
			de_err(c, "This type of %d-plane image is not supported", (int)d->nplanes);
		goto done;
	}

	if(d->header_size_in_words==25 && !d->is_ximg) {
		i64 pal_pos = d->header_size_in_bytes-32;
		de_dbg(c, "palette at %d", (int)pal_pos);
		de_dbg_indent(c, 1);
		de_fmtutil_read_atari_palette(c, c->infile, pal_pos,
			d->pal, 16, ((i64)1)<<d->nplanes, 0);
		de_dbg_indent(c, -1);
	}
	else {
		read_palette_ximg(c, d);
	}

	if(d->nplanes==1 && d->pal[0]==d->pal[1]) {
		de_dbg(c, "Palette doesn't seem to be present. Using a default palette.");
		d->pal[0] = DE_STOCKCOLOR_WHITE;
		d->pal[1] = DE_STOCKCOLOR_BLACK;
	}

	de_dbg_indent(c, -1);

	de_dbg(c, "image at %d", (int)d->header_size_in_bytes);

	unc_pixels = dbuf_create_membuf(c, d->rowspan_total*d->h, 0);
	uncompress_pixels(c, d, unc_pixels, d->header_size_in_bytes, c->infile->len-d->header_size_in_bytes);

	img = de_bitmap_create(c, d->w, d->h, 3);

	fi = de_finfo_create(c);
	set_density(c, d, fi);

	if(d->nplanes>8) {
		read_rgb_image(c, d, unc_pixels, img);
	}
	else {
		read_paletted_image(c, d, unc_pixels, img);
	}

	de_bitmap_write_to_file_finfo(img, fi, 0);

	retval = 1;

done:
	de_bitmap_destroy(img);
	de_finfo_destroy(c, fi);
	dbuf_close(unc_pixels);
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}
//-------------------------------------------------------------------------------------------------
void init() {
//-------------------------------------------------------------------------------------------------
	vb_clouds.Create( Video::VF_GENERIC );
	
	Video::point_vertex_2d verts[4]; // MOVE THIS BACK 88 DEBUG

	verts[0].x = -1.0;
	verts[0].y = 1.0;
	verts[1].x = -1.0;
	verts[1].y = -1.0;
	verts[2].x = 1.0;
	verts[2].y = -1.0;
	verts[3].x = 1.0;
	verts[3].y = 1.0;
	/*
	verts[0].x = -5000;
	verts[0].z = -5000;
	verts[1].x = -5000;
	verts[1].z = 5000;
	verts[2].x = 5000;
	verts[2].z = 5000;
	verts[3].x = 5000;
	verts[3].z = -5000;

	verts[0].y = verts[1].y = verts[2].y = verts[3].y = 0;
	
	verts[0].r = verts[0].g = verts[0].b = verts[0].a = 255;
	verts[1].r = verts[1].g = verts[1].b = verts[1].a = 255;
	verts[2].r = verts[2].g = verts[2].b = verts[2].a = 255;
	verts[3].r = verts[3].g = verts[3].b = verts[3].a = 255;

	verts[0].u = 0.0;
	verts[0].v = 0.0;
	
	verts[1].u = 0.0;
	verts[1].v = 8.0;

	verts[2].u = 8.0;
	verts[2].v = 8.0;
	
	verts[3].u = 8.0;
	verts[3].v = 0.0;
	*/
	vb_clouds.BufferData( verts, 4 * sizeof(Video::point_vertex_2d), GL_STATIC_DRAW_ARB );

	mu = 0;

	cloud_offset = cml::vector2f(0.0f,0.0f);

	writex=0;
	writey=0;
	next_texture_slot=0;
	current_texture_slot=0;

	

	set_density(0);
	set_color(1,1,1);
	set_wind(0.0001f, 0.00005f);
	//set_wind(0.001, 0.0005); // fast

	for( u32 i = 0; i < 16384; i++ ) {
		random_data[i] = (u8)rnd::next();
	}

	
	prime();

	Textures::SetTextureFiltering( Textures::CLOUDS1, true );
	Textures::SetTextureFiltering( Textures::CLOUDS2, true );
	Textures::SetTextureFiltering( Textures::CLOUDS3, true );

	Textures::SetTextureWrapping( Textures::CLOUDS1, true );
	Textures::SetTextureWrapping( Textures::CLOUDS2, true );
	Textures::SetTextureWrapping( Textures::CLOUDS3, true );

}