Esempio n. 1
0
void game_init() {
	shape_init("models.stz");
	model.player=shapesprite_new("player walk", 2);
	model.gun=shape_load("gun");
	model.bullet=shape_load("bullet");
	model.grenade=shape_load("grenade");
	model.enemy[0]=shape_load("enemy_left");
	model.enemy[1]=shape_load("enemy_gunner");
	model.enemy[2]=shape_load("enemy_grenadier");
	model.enemy[3]=shape_load("tank");
	model.enemy_right=shape_load("enemy_right");
	model.explosion=shape_load("explosion");
	model.flamethrower=shape_load("flamethrower");
	model.powerup[0]=shape_load("powerup_hp");
	model.powerup[1]=shape_load("powerup_grenades");
	
	sound.explosion=d_sound_streamed_load("explosion.ogg", DARNIT_AUDIO_PRELOAD, DARNIT_AUDIO_STEREO);
	sound.jump=d_sound_streamed_load("jump.ogg", DARNIT_AUDIO_PRELOAD, DARNIT_AUDIO_STEREO);
	sound.shoot=d_sound_streamed_load("shoot.ogg", DARNIT_AUDIO_PRELOAD, DARNIT_AUDIO_STEREO);
	sound.enemy_kill=d_sound_streamed_load("enemy_kill.ogg", DARNIT_AUDIO_PRELOAD, DARNIT_AUDIO_STEREO);
	sound.powerup=d_sound_streamed_load("powerup.ogg", DARNIT_AUDIO_PRELOAD, DARNIT_AUDIO_STEREO);
	sound.powerup_small=d_sound_streamed_load("powerup_small.ogg", DARNIT_AUDIO_PRELOAD, DARNIT_AUDIO_STEREO);
	
	sound.music=d_sound_tracked_load("music.mod", DARNIT_AUDIO_STREAM, DARNIT_AUDIO_MONO);
	if(sound.music)
		d_sound_play(sound.music, 0, 96, 96, 0);
	
	grenade_explosion=shape_copy_copy(model.explosion);
	flamethrower=shape_copy_copy(model.flamethrower);
}
Esempio n. 2
0
/* initialize blue and opengl stuff */
void blue_gl_init(INITFUNC_ARGS){
    /* Blue type initialization */
    window_type = window_init(lib, Module);
    view_type   = view_init(lib, Module);
    layer_type  = layer_init(lib, Module);
    shape_type  = shape_init(lib, Module);
    image_type  = image_init(lib, Module);
    light_type  = light_init(lib, Module);
    text_type  = text_init(lib, Module);
}
Esempio n. 3
0
File: shape.c Progetto: olegrok/4sem
Shape * shape_initWithValue(double x, double y, double z, char * form)
{
	Shape * p = shape_init();
	if(p == NULL)
		return NULL;
	p -> x = x;
	p -> y = y;
	p -> z = z;	
	if(form != NULL)
		strncpy(p -> form, form, size);
	return p;
}
int main(int argc, char **argv)
{
  FILE *fp;
  DBFHandle dbase;
  SHPHandle shape;
  char multimatchFile[255], shapeFile[255], line[512];
  float ref_x, ref_y, ref_z, ref_x_pixel_size, ref_y_pixel_size, ref_start_x;
  float ref_start_y, search_x, search_y, search_z, search_x_pixel_size;
  float search_y_pixel_size, search_start_x, search_start_y, dx, dy, dz;
  float speed, direction;
  double lat, lon;
  int n=0, ref_utm_zone, search_utm_zone;
  
  if (argc != 3)
    usage();

  strcpy(multimatchFile, argv[1]);
  strcpy(shapeFile, argv[2]);
	 
  asfSplashScreen(argc, argv);
  
  // Open shop for business
  shape_init(shapeFile, MULTIMATCH);
  open_shape(shapeFile, &dbase, &shape);
  fp = FOPEN(multimatchFile, "r");

  // Reference data header
  fgets(line, 512, fp); // Data file type
  fgets(line, 512, fp); // Data file dimensions
  fgets(line, 512, fp); // Post spacing
  sscanf(line, "%f %f", &ref_x_pixel_size, &ref_y_pixel_size);
  fgets(line, 512, fp); // Starting corner position (s,c)
  sscanf(line, "%f %f", &ref_start_x, &ref_start_y);
  fgets(line, 512, fp); // Peg position (WGS-84)
  fgets(line, 512, fp); // UTM zone
  sscanf(line, "%d", &ref_utm_zone);
  fgets(line, 512, fp); // blank line for value

  // Search data header
  fgets(line, 512, fp); // Data file type
  fgets(line, 512, fp); // Data file dimensions
  fgets(line, 512, fp); // Post spacing
  sscanf(line, "%f %f", &search_x_pixel_size, &search_y_pixel_size);
  fgets(line, 512, fp); // Starting corner position (s,c)
  sscanf(line, "%f %f", &search_start_x, &search_start_y);
  fgets(line, 512, fp); // Peg position (WGS-84)
  fgets(line, 512, fp); // UTM zone
  sscanf(line, "%d", &search_utm_zone);
  fgets(line, 512, fp); // blank line for value

  // Read matching information
  while (fgets(line, 512, fp)) {
    sscanf(line, "%f %f %f %f %f %f %f %f %f",
	   &ref_x, &ref_y, &ref_z, &search_x, &search_y, &search_z,
	   &dx, &dy, &dz);
    UTM2latLon(ref_start_x + ref_x_pixel_size*ref_x, 
	       ref_start_y + ref_y_pixel_size*ref_y, 
	       ref_z, ref_utm_zone, &lat, &lon);
    speed = sqrt(dx*dx + dy*dy);
    direction = atan2(dx, dy)*R2D;
    if (direction < 0)
      direction += 360.0;
    sprintf(line, "%.4lf,%.4lf,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.3f,%.3f,%3.f,"
	    "%.4f,%.1f", lat, lon, ref_x, ref_y, ref_z, search_x, search_y, 
	    search_z, dx, dy, dz, direction, speed);
    multimatch2shape(line, dbase, shape, n);
    n++;
  }
  FCLOSE(fp);

  // Clean up
  close_shape(dbase, shape);
  write_esri_proj_file(shapeFile);
  
  return(0);
}