示例#1
0
文件: Arrow.cpp 项目: ElAleyo/solarus
/**
 * \brief Creates an arrow.
 * \param hero the hero
 */
Arrow::Arrow(Hero& hero):
  hero(hero) {

  // initialize the entity
  int direction = hero.get_animation_direction();
  set_layer(hero.get_layer());
  create_sprite("entities/arrow", true);
  get_sprite().set_current_direction(direction);
  set_bounding_box_from_sprite();
  set_xy(hero.get_center_point());
  set_optimization_distance(0); // Make the arrow continue outside the screen until disappear_date.

  std::string path = " ";
  path[0] = '0' + (direction * 2);
  Movement *movement = new PathMovement(path, 192, true, false, false);
  set_movement(movement);

  disappear_date = System::now() + 10000;
  stop_now = false;
  entity_reached = NULL;
}
示例#2
0
/**
 * \brief Creates a new stream.
 * \param name Name identifying the entity on the map or an empty string.
 * \param layer Layer of the entity to create.
 * \param x X coordinate of the entity to create.
 * \param y Y coordinate of the entity to create.
 * \param direction Direction of the stream (0 to 7).
 * \param sprite_name Animation set id of a sprite or an empty string.
 */
Stream::Stream(
    const std::string& name,
    Layer layer,
    int x,
    int y,
    int direction,
    const std::string& sprite_name
):
  Detector(COLLISION_OVERLAPPING, name, layer, x, y, 16, 16),
  speed(64),
  allow_movement(true),
  allow_attack(true),
  allow_item(true) {

  set_origin(8, 13);
  if (!sprite_name.empty()) {
    create_sprite(sprite_name);
    get_sprite().set_current_direction(direction);
  }
  set_direction(direction);
}
示例#3
0
/**
 * @brief Creates a new chest with the specified treasure.
 * @param name Name identifying this chest.
 * @param layer Layer of the chest to create on the map.
 * @param x X coordinate of the chest to create.
 * @param y Y coordinate of the chest to create.
 * @param sprite_name Name of the animation set of the
 * sprite to create for the chest. It must have animations "open" and "closed".
 * @param treasure The treasure in the chest.
 */
Chest::Chest(
    const std::string& name,
    Layer layer,
    int x,
    int y,
    const std::string& sprite_name,
    const Treasure& treasure):

  Detector(COLLISION_FACING_POINT, name, layer, x, y, 16, 16),
  treasure(treasure),
  open(treasure.is_found()),
  treasure_given(open),
  treasure_date(0) {

  // Create the sprite.
  Sprite& sprite = create_sprite(sprite_name);
  std::string animation = is_open() ? "open" : "closed";
  sprite.set_current_animation(animation);

  set_origin(get_width() / 2, get_height() - 3);
}
示例#4
0
/**
 * \brief Creates a new crystal block.
 * \param game the current game
 * \param name Unique name identifying the entity on the map or an empty string.
 * \param layer layer of the entity to create on the map
 * \param x x coordinate of the entity to create
 * \param y y coordinate of the entity to create
 * \param width width of the block (the pattern can be repeated)
 * \param height height of the block (the pattern can be repeated)
 * \param subtype subtype of raised block
 */
CrystalBlock::CrystalBlock(Game& game, const std::string& name,
    Layer layer, int x, int y, int width, int height, Subtype subtype):
  Detector(COLLISION_RECTANGLE, name, layer, x, y, width, height),
  subtype(subtype) {

  create_sprite("entities/crystal_block");

  // Don't pause the sprite animation when the crystal block is far from the
  // camera. Otherwise it looks weird if the players comes back using a
  // teletransporter.
  get_sprite().set_ignore_suspend(true);

  this->orange_raised = game.get_crystal_state();

  if (subtype == ORANGE) {
    get_sprite().set_current_animation(orange_raised ? "orange_raised" : "orange_lowered");
  }
  else {
    get_sprite().set_current_animation(orange_raised ? "blue_lowered" : "blue_raised");
  }
  get_sprite().set_current_frame(3); // to avoid the animations at the map beginning
}
示例#5
0
/**
 *
 *  rct2: 0x0067396A (water)
 *  rct2: 0x006739A4 (snow)
 */
void jumping_fountain_create(int type, int x, int y, int z, int direction, int flags, int iteration)
{
    rct_jumping_fountain *jumpingFountain;

    jumpingFountain = (rct_jumping_fountain*)create_sprite(SPRITE_IDENTIFIER_MISC);
    if (jumpingFountain == NULL)
        return;

    jumpingFountain->iteration = iteration;
    jumpingFountain->var_2E = direction;
    jumpingFountain->flags = flags;
    jumpingFountain->sprite_direction = direction << 3;
    jumpingFountain->var_14 = 33;
    jumpingFountain->var_09 = 36;
    jumpingFountain->var_15 = 12;
    jumpingFountain->sprite_identifier = SPRITE_IDENTIFIER_MISC;
    sprite_move(x, y, z, (rct_sprite*)jumpingFountain);
    jumpingFountain->misc_identifier = type == JUMPING_FOUNTAIN_TYPE_SNOW ?
                                       SPRITE_MISC_JUMPING_FOUNTAIN_SNOW :
                                       SPRITE_MISC_JUMPING_FOUNTAIN_WATER;
    jumpingFountain->var_26 = 0;
}
示例#6
0
void setup_ten_squares(
	sprite_id sprites[],
	char *bitmaps[],
	char widths[],
	char heights[],
	int sprite_count,
	int bitmap_count
	) {
	for ( int i = 0; i < sprite_count; i++ ) {

		char * bitmap = bitmaps[i % bitmap_count];
		char width = widths[i % bitmap_count];
		char height = heights[i % bitmap_count];

		sprite_id sprite = create_sprite( 0, 0, width, height, bitmap );
		double angle = ( (double) random() ) * 2 * M_PI / RAND_MAX;
		sprite->dx = cos( angle );
		sprite->dy = sin( angle );

		sprites[i] = sprite;
	}
}
示例#7
0
/**
 * \brief Creates a hookshot.
 * \param hero the hero
 */
Hookshot::Hookshot(const Hero& hero):
    MapEntity("", 0, hero.get_layer(), 0, 0, 0, 0),
    next_sound_date(System::now()),
    has_to_go_back(false),
    going_back(false),
    entity_reached(nullptr),
    link_sprite(std::make_shared<Sprite>("entities/hookshot")) {

  // initialize the entity
  int direction = hero.get_animation_direction();
  create_sprite("entities/hookshot", true);
  get_sprite().set_current_direction(direction);
  link_sprite->set_current_animation("link");

  set_size(16, 16);
  set_origin(8, 13);
  set_drawn_in_y_order(true);
  set_xy(hero.get_xy());

  std::string path = " ";
  path[0] = '0' + (direction * 2);
  set_movement(std::make_shared<PathMovement>(path, 192, true, false, false));
}
示例#8
0
/**
 * @brief Creates a hookshot.
 * @param hero the hero
 */
Hookshot::Hookshot(Hero &hero):
  next_sound_date(System::now()),
  has_to_go_back(false),
  going_back(false),
  entity_reached(NULL),
  link_sprite("entities/hookshot") {

  // initialize the entity
  int direction = hero.get_animation_direction();
  set_layer(hero.get_layer());
  create_sprite("entities/hookshot", true);
  get_sprite().set_current_direction(direction);
  link_sprite.set_current_animation("link");

  set_size(16, 16);
  set_origin(8, 13);
  set_xy(hero.get_xy());

  std::string path = " ";
  path[0] = '0' + (direction * 2);
  Movement *movement = new PathMovement(path, 192, true, false, false);
  set_movement(movement);
}
示例#9
0
/**
 * \brief Creates a new crystal block.
 * \param game The current game.
 * \param name Name identifying the entity on the map or an empty string.
 * \param layer Layer of the entity to create on the map.
 * \param xy Coordinates of the entity to create.
 * \param size Size of the block (the pattern can be repeated).
 * \param subtype subtype of raised block
 */
CrystalBlock::CrystalBlock(Game& game, const std::string& name,
    int layer, const Point& xy, const Size& size, Subtype subtype):
  Entity(name, 0, layer, xy, size),
  subtype(subtype) {

  set_collision_modes(CollisionMode::COLLISION_OVERLAPPING);
  Sprite& sprite = *create_sprite("entities/crystal_block");

  // Don't pause the sprite animation when the crystal block is far from the
  // camera. Otherwise it looks weird if the players comes back using a
  // teletransporter.
  sprite.set_ignore_suspend(true);

  this->orange_raised = game.get_crystal_state();

  if (subtype == ORANGE) {
    sprite.set_current_animation(orange_raised ? "orange_raised" : "orange_lowered");
  }
  else {
    sprite.set_current_animation(orange_raised ? "blue_lowered" : "blue_raised");
  }
  sprite.set_current_frame(sprite.get_nb_frames() - 1); // to avoid the animations at the map beginning
}
示例#10
0
void main( void )
{

 int &crap = create_sprite(185,150, 0, 0, 0);
 &temphold = &crap;
 int &amount = 0;

preload_seq(251);
preload_seq(253);
int &myrand;
sp_brain(&temphold, 0);
sp_base_walk(&temphold, 250);
sp_speed(&temphold, 0);

//set starting pic

sp_pseq(&temphold, 253);
sp_pframe(&temphold, 1);

mainloop:
wait(500);
&myrand = random(8, 1);

  if (&myrand == 1)
  {
  sp_pseq(&temphold, 253);
  }

  if (&myrand == 2)
  {
  sp_pseq(&temphold, 251);
  }

&myrand = random(20, 1);
goto mainloop;
}
示例#11
0
void main( void )
{

//playsound(43, 22050,0,0,0);

&s4-duck = 2;
&story = 11;
freeze(1);
//cutscene

//create man
int &man = create_sprite(290, 460, 0, 0, 0);
sp_base_walk(&man, 380);
sp_speed(&man, 1);
sp_timing(&man, 33);
preload_seq(381);
preload_seq(383);
preload_seq(387);
preload_seq(389);

//create little girl
int &girl = create_sprite(290, 460, 0, 0, 0);
sp_base_walk(&girl, 250);
sp_speed(&girl, 1);
sp_timing(&girl, 33);
preload_seq(251);
preload_seq(253);
preload_seq(257);
preload_seq(259);

int &junk = sp_y(1, -1);
if (&junk < 220)
   sp_dir(1, 2);

say("`0Hurry up, Kelly!", &man);
move_stop(&man, 8, 430, 1);
move_stop(&man, 9, 380, 1);
say_stop("`0This is gonna be so great and...", &man);
wait(250);
say_stop("`0WHAT THE!?!?!", &man);
sp_pseq(&man,387);
sp_pframe(&man,1);
sp_seq(&man,0);
wait(250);
sp_pseq(&man,381);
sp_pframe(&man,1);
sp_seq(&man,0);
say_stop("Uh oh.", 1);
wait(250);
sp_pseq(&man,383);
sp_pframe(&man,1);
sp_seq(&man,0);

wait(250);
sp_pseq(&man,389);
sp_pframe(&man,1);
sp_seq(&man,0);
say_stop("`0NO!!!!!", &man);
move_stop(&girl, 9, 350, 1);
move_stop(&girl, 7, 280, 1);
say_stop("`#Daddy, what happened?", &girl);
wait(250);
say_stop("`0GUARDS!!!!!!!", &man);
wait(250);
say_stop("`0HELP!", &man);
wait(250);
say_stop("`0THIS GUY KILLED THE BLESSED FOWL!", &man);
wait(250);


int &guard = create_sprite(290, 460, 0, 0, 0);
sp_base_walk(&guard, 290);
sp_speed(&guard, 1);
sp_timing(&guard, 33);
preload_seq(291);
preload_seq(293);
preload_seq(297);
preload_seq(299);

move_stop(&guard, 8, 380, 1);
say_stop("`5I MUST AVENGE THE WINGED GODDESS!", &guard);
wait(300);
say_stop("`0Kelly, what are you doing?", &man);
wait(300);
say_stop("`#I'm eating.", &girl);
wait(300);
move_stop(&guard, 9, 330, 1);
say_stop("`5Sir, your daughter is eating our god.", &guard);
wait(300);
say_stop("`5I guess we have to kill her too.", &guard);
wait(300);
say_stop("`#This meat.. tastes good!", &girl);
wait(300);
say_stop("`0Wait..isn't it all raw and such?", &man);
wait(300);
say_stop("`5I guess one piece won't hurt...", &guard);
wait(1000);
say_stop("`5IT TASTES GREAT!", &guard);
say_stop("`0LESS FILLING TOO!", &man);
wait(300);
say_stop("`5Dink, you magically changed our supreme beings into food!", &guard);
wait(300);
say_stop("No.. there is a perfect explanation, you see, the friction seemed to cook and...", 1);

wait(300);
say_stop("`0Who cares about that!", &man);
wait(300);
say_stop("`5Dink is a hero!  WE MUST GO TELL THE OTHERS!", &guard);
unfreeze(1);
move(&guard, 1, 300, 1);
move_stop(&man, 4, 300, 1);
move(&guard, 2, 480, 1);
move_stop(&man, 2, 480, 1);
move_stop(&girl, 3, 310, 1);
say_stop("`#Bye, Dink.", &girl);
move_stop(&girl, 2, 470, 1);

}
示例#12
0
 sf::Sprite & resource_manager::operator[](tile_id index)
 {
     if (m_sprite_map.count(index) == 0) create_sprite(index);
     return m_sprite_map.at(index);
 }
示例#13
0
int test_move(unsigned short xi, unsigned short yi, char *xpm[], 
				unsigned short hor, short delta, unsigned short time) {

	int ipc_status;
	message msg;
	int request;
	int irq_set1,irq_set2;
	vg_init(GRAPHIC_MODE);
	Sprite*sprite = create_sprite(xpm);
	if(!hor){
		sprite->xspeed = ((double)delta/(double)time)/FPS;
		sprite->yspeed = 0;
	}
	else{
		sprite->xspeed = 0;
		sprite->yspeed =  ((double)delta/(double)time)/FPS;
	}
	sprite->x = xi;
	sprite->y = yi;

	draw_sprite(sprite);

	counter = 0;
	irq_set1 = subscribe_kbd();
	irq_set2 = subscribe_timer();


	while (scanCode != EXIT_MAKE_CODE) {
		request = driver_receive(ANY, &msg, &ipc_status);
		if (request != 0) {
			printf("driver_receive failed with: %d", request);
			continue;
		}
		if (is_ipc_notify(ipc_status)) {
			switch (_ENDPOINT_P(msg.m_source)) {
			case HARDWARE:
				if (msg.NOTIFY_ARG & irq_set1) {
					kbd_handler();
				}
				if (msg.NOTIFY_ARG & irq_set2) {
					if(counter % (int)(60/FPS) == 0){

						update_sprite(sprite);
						draw_sprite(sprite);
					}
					if(counter == time * 60){
						unsubscribe_timer();
					}
					timer_handler();
				}
				break;
			default:
				break;
			}
		}
		else {
		}
	}
	unsubscribe_timer();
	unsubscribe_kbd();
	vg_exit();
	return 0;
	
}
示例#14
0
void main( void )
{
 int &crap;
 int &jcrap;
 sp_brain(&current_sprite, 0);
 sp_base_walk(&current_sprite, 370);
 sp_speed(&current_sprite, 2);
 sp_timing(&current_sprite, 0);
//set starting pic
 sp_pseq(&current_sprite, 377);
 sp_pframe(&current_sprite, 1);
 //Ok Go
 freeze(1);
 move_stop(1, 8, 375, 1);
 move_stop(1, 4, 300, 1);
 move_stop(1, 8, 350, 1);
 move_stop(&current_sprite, 8, 330, 1);
 //playmidi("mystery.mid");
 say_stop("`2Ok, it's up here", &current_sprite);
 move_stop(&current_sprite, 8, 200, 1);
 say_stop("`2Follow me...", &current_sprite);
 move_stop(&current_sprite, 6, 399, 1);
 move_stop(&current_sprite, 8, 165, 1);
 playsound(19, 22052, 0, 0, 0);
 wait(100);
 playsound(19, 44102, 0, 0, 0);
 wait(100);
 playsound(19, 44102, 0, 0, 0);
 say("`2Now if I can just pick this lock...", &current_sprite);
 move_stop(1, 8, 190, 1);
 move_stop(1, 6, 350, 1);
 say_stop("What are we doing?", 1);
 playsound(19, 44102, 0, 0, 0);
 wait(100);
 playsound(19, 44102, 0, 0, 0);
 say_stop("`2Just one more second...", &current_sprite);
 playmidi("battle.mid");
 //build guards
 preload_seq(291);
 preload_seq(293);
 preload_seq(297);
 preload_seq(299);
 preload_seq(722);
 preload_seq(724);
 preload_seq(725);
 preload_seq(726);
 &crap = create_sprite(380,450, 9, 0, 0);
 freeze(&crap);
 sp_base_walk(&crap, 290);
 sp_base_attack(&crap, 720); 
 sp_speed(&crap, 1);
 sp_strength(&crap, 10);
 sp_touch_damage(&crap, 2);
 sp_timing(&crap, 0);
 move(&crap, 7,250, 1);
 sp_target(&crap, 1);
 sp_hitpoints(&crap, 40);
 &jcrap = create_sprite(280,450, 9, 0, 0);
 freeze(&jcrap);
 sp_base_walk(&jcrap, 290);
 sp_base_attack(&jcrap, 720); 
 sp_strength(&jcrap, 10);
 sp_distance(&crap, 50);

 sp_touch_damage(&jcrap, 2);

 sp_speed(&jcrap, 1);
 sp_timing(&jcrap, 0);
 move_stop(&jcrap, 9,400, 1);
 sp_distance(&jcrap, 50);
 sp_target(&jcrap, 1);
 sp_hitpoints(&jcrap, 40);
 say_stop("`2Oh no, guards!!  Run for it!", &current_sprite);
 wait(250);
 sp_dir(1, 2);
 &thief = 3;
 say_stop("This ain't good.", 1);
 unfreeze(1);
 unfreeze(&jcrap);
 unfreeze(&crap);
 move_stop(&current_sprite, 6, 700, 1);
 sp_active(&current_sprite, 0);
}
示例#15
0
void main( void )
{

 preload_seq(251);
 preload_seq(253);
 preload_seq(257);
 preload_seq(259);

 if (&mayor == 1)
 {
  return;
 }

 if (&mayor == 2)
 {
  return;
 }

 if (&mayor == 5)
 {
  playmidi("lovin.mid");

  freeze(1);
  preload_seq(253);
  preload_seq(251);
  preload_seq(257);
  preload_seq(259);
  preload_seq(271);
  preload_seq(273);
  preload_seq(277);
  preload_seq(279);
  preload_seq(281);
  preload_seq(283);
  preload_seq(287);
  preload_seq(289);
  preload_seq(371);
  preload_seq(373);
  preload_seq(377);
  preload_seq(379);
  preload_seq(361);
  preload_seq(363);
  preload_seq(367);
  preload_seq(369);
  preload_seq(411);
  preload_seq(413);
  preload_seq(417);
  preload_seq(419);
  preload_seq(291);
  preload_seq(293);
  preload_seq(297);
  preload_seq(299);
  int &pp1;
  int &pp2;
  int &pp3;
  int &pp4;
  int &pp5;
  int &pp6;
  int &pp7;
  int &pp8;
  int &pp9;
  int &woman;
  int &mp1;
  int &mp2;
  int &mp3;
  int &mp4;
  int &mp5;
  int &mp6;
  int &mp7;
  //Actually Spawn the girl, and her script
  &woman = create_sprite(400, 110, 0, 0, 0);
  sp_brain(&woman, 16);
  sp_base_walk(&woman, 250);
  sp_speed(&woman, 1);
  sp_timing(&woman, 0);
  //set starting pic
  sp_pseq(&woman, 253);
  sp_pframe(&woman, 1);
  //Create more & more & more!!
  &pp1 = create_sprite(125, 115, 0, 0, 0);
  sp_brain(&pp1, 16);
  sp_base_walk(&pp1, 270);
  sp_speed(&pp1, 1);
  sp_timing(&pp1, 0);
sp_script(&pp1, "s3-peeps");
  //set starting pic
  sp_pseq(&pp1, 273);
  sp_pframe(&pp1, 1);
  &pp2 = create_sprite(250, 141, 0, 0, 0);
  sp_brain(&pp2, 16);
sp_script(&pp2, "s3-peeps");

  sp_base_walk(&pp2, 280);
  sp_speed(&pp2, 1);
  sp_timing(&pp2, 0);
  //set starting pic
  sp_pseq(&pp2, 283);
  sp_pframe(&pp2, 1);
  &pp3 = create_sprite(45, 370, 0, 0, 0);
  sp_brain(&pp3, 16);
  sp_base_walk(&pp3, 370);
  sp_speed(&pp3, 1);
sp_script(&pp3, "s3-peeps");

  sp_timing(&pp3, 0);
  //set starting pic
  sp_pseq(&pp3, 379);
  sp_pframe(&pp3, 1);
  &pp4 = create_sprite(410, 380, 0, 0, 0);
  sp_brain(&pp4, 16);
  sp_base_walk(&pp4, 360);
  sp_speed(&pp4, 1);
  sp_timing(&pp4, 0);
  //set starting pic
  sp_pseq(&pp4, 367);
  sp_pframe(&pp4, 1);
sp_script(&pp4, "s3-peeps");

  &pp5 = create_sprite(520, 360, 0, 0, 0);
  sp_brain(&pp5, 16);
  sp_base_walk(&pp5, 410);
  sp_speed(&pp5, 1);
  sp_timing(&pp5, 0);
  //set starting pic
  sp_pseq(&pp5, 417);
  sp_pframe(&pp5, 1);
sp_script(&pp5, "s3-peeps");

  &pp6 = create_sprite(70, 180, 0, 0, 0);
  sp_brain(&pp6, 16);
  sp_base_walk(&pp6, 220);
  sp_speed(&pp6, 1);
  sp_timing(&pp6, 0);
  //set starting pic
  sp_pseq(&pp6, 223);
  sp_pframe(&pp6, 1);
sp_script(&pp6, "s3-peeps");

  &pp7 = create_sprite(320, 400, 0, 0, 0);
  sp_brain(&pp7, 16);
  sp_base_walk(&pp7, 220);
  sp_speed(&pp7, 1);
  sp_timing(&pp7, 0);
  //set starting pic
  sp_pseq(&pp7, 229);
  sp_pframe(&pp7, 1);
sp_script(&pp7, "s3-peeps");

  &pp8 = create_sprite(295, 50, 0, 0, 0);
  sp_brain(&pp8, 16);
  sp_base_walk(&pp8, 370);
  sp_speed(&pp8, 1);
  sp_timing(&pp8, 0);
  //set starting pic
  sp_pseq(&pp8, 373);
  sp_pframe(&pp8, 1);
sp_script(&pp8, "s3-peeps");

  &pp9 = create_sprite(175, 350, 0, 0, 0);
  sp_brain(&pp9, 16);
  sp_base_walk(&pp9, 390);
  sp_speed(&pp9, 1);
  sp_timing(&pp9, 0);
  //set starting pic
  sp_pseq(&pp9, 399);
  sp_pframe(&pp9, 1);
sp_script(&pp9, "s3-peeps");

  //Let's Go movers!!
  &mp1 = create_sprite(640, 200, 0, 0, 0);
  sp_brain(&mp1, 16);
  sp_base_walk(&mp1, 290);
  sp_speed(&mp1, 1);
  sp_timing(&mp1, 0);
  //set starting pic
  sp_pseq(&mp1, 291);
  sp_pframe(&mp1, 1);
  &mp2 = create_sprite(640, 305, 0, 0, 0);
  sp_brain(&mp2, 16);
  sp_base_walk(&mp2, 290);
  sp_speed(&mp2, 1);
  sp_timing(&mp2, 33);
  //set starting pic
  sp_pseq(&mp2, 291);
  sp_pframe(&mp2, 1);
  &mp3 = create_sprite(640, 320, 0, 0, 0);
  sp_brain(&mp3, 16);
  sp_base_walk(&mp3, 380);
  sp_speed(&mp3, 1);
  sp_timing(&mp3, 20);
  //set starting pic
  sp_pseq(&mp3, 381);
  sp_pframe(&mp3, 1);
  &mp4 = create_sprite(700, 340, 0, 0, 0);
  sp_brain(&mp4, 16);
  sp_base_walk(&mp4, 370);
  sp_speed(&mp4, 1);
  sp_timing(&mp4, 0);
  //set starting pic
  sp_pseq(&mp4, 371);
  sp_pframe(&mp4, 1);
  &mp5 = create_sprite(670, 210, 0, 0, 0);
  sp_brain(&mp5, 16);
  sp_base_walk(&mp5, 390);
  sp_speed(&mp5, 1);
  sp_timing(&mp5, 33);
  //set starting pic
  sp_pseq(&mp5, 391);
  sp_pframe(&mp5, 1);
  &mp6 = create_sprite(710, 180, 0, 0, 0);
  sp_brain(&mp6, 16);
  sp_base_walk(&mp6, 410);
  sp_speed(&mp6, 1);
  sp_timing(&mp6, 0);
  //set starting pic
  sp_pseq(&mp6, 411);
  sp_pframe(&mp6, 1);
  &mp7 = create_sprite(640, 175, 0, 0, 0);
  sp_brain(&mp7, 16);
  sp_base_walk(&mp7, 290);
  sp_speed(&mp7, 1);
  sp_timing(&mp7, 16);
  //set starting pic
  sp_pseq(&mp7, 291);
  sp_pframe(&mp7, 1);
  //Let's Go
  freeze(&woman);
  freeze(&pp1);
  freeze(&pp2);
  //wait(1);
  freeze(&pp3);
  freeze(&pp4);
  freeze(&pp5);
  freeze(&pp6);
  freeze(&pp7);
  freeze(&pp8);
  freeze(&pp9);
	
  freeze(&mp1);
  freeze(&mp2);
  freeze(&mp3);
  freeze(&pp4);
  freeze(&mp4);
  freeze(&mp6);
  freeze(&mp7);
  move(&mp1, 4, -1500, 1);
  move(&mp2, 4, -1500, 1);
  move(&mp3, 4, -1500, 1);
  move(&mp4, 4, -1500, 1);
  move(&mp5, 4, -1500, 1);
  move(&mp6, 4, -1500, 1);
  move(&mp7, 4, -1500, 1);
  wait(500);
  say_stop("`9Dink, Dink, over here.", &woman);
  move_stop(1, 2, 105, 1);
  move_stop(1, 6, 450, 1);
  say_stop("`9Isn't it just beautiful?", &woman);
  sp_dir(1, 4);
  wait(250);
  say_stop("Yup, it's a parade allright.", 1);
  wait(250);
  say_stop("A lot of people too, I shudder at what could've happened.", 1);
  wait(250);
  say_stop("`9You really saved the town Dink...", &woman);
  wait(250);
  say_stop("`9I'm really proud of you.", &woman);
  wait(250);
  say_stop("Thanks, but I couldn't have done it without you.", 1);
  wait(250);
  say_stop("`9Well I have to be going, I have to meet with my father.", &woman);
  wait(250);
  say_stop("`9Take care Dink, I hope I'll see you again.", &woman);
  wait(1000);
  unfreeze(&pp1);
  unfreeze(&pp2);
  unfreeze(&pp3);
  unfreeze(&pp4);
  unfreeze(&pp5);
  unfreeze(&pp6);
  unfreeze(&pp7);
  unfreeze(&pp8);
  unfreeze(&pp9);
  sp_dir(1, 2);
  move_stop(&woman, 3, 660, 1);
  say_stop("Oh, you will baby, you will...", 1);
  &story = 10;
  &mayor = 6;
  unfreeze(1);
  return;
 }

 if (&mayor == 6)
 {
  int &loser;
  &loser = create_sprite(350, 210, 0, 0, 0);
  sp_brain(&loser, 16);
  sp_base_walk(&loser, 410);
  sp_speed(&loser, 1);
  sp_timing(&loser, 0);
  sp_pseq(&loser, 413);
  sp_pframe(&loser, 1);
  sp_script(&loser, "s3-loser");
  return;
 }

 if (&mayor == 7)
 {
  return;
 }
  int &poopy;
  int &woman;
  //Actually Spawn the girl, and her script
  &woman = create_sprite(300, 130, 0, 0, 0);
  sp_brain(&woman, 16);
  sp_base_walk(&woman, 250);
  sp_speed(&woman, 1);
  sp_timing(&woman, 0);
  //set starting pic
  sp_pseq(&woman, 253);
  sp_pframe(&woman, 1);
  sp_script(&woman, "s3-chick");
}
示例#16
0
void main( void )
{
 if (&caveguy == 5)
 {
  script_attach(1000);
  //preload_seq(740);  <-- for sucking.
preload_seq(375);
  preload_seq(168);
  int &junk;
  int &dude;
  int &evil;
  int &evil2;
  int &evil3;
  freeze(1);
  &dude = create_sprite(551, 157, 0, 0, 0);
  sp_brain(&dude, 0);
  sp_base_walk(&dude, 370);
  sp_speed(&dude, 2);
  sp_timing(&dude, 0);
  //set starting pic
  sp_pseq(&dude, 371);
  sp_pframe(&dude, 1);
  //Now EVIL
  &evil = create_sprite(-20, 130, 0, 0, 0);
  sp_brain(&evil, 0);
  sp_base_walk(&evil, 300);
  sp_speed(&evil, 1);
  sp_timing(&evil, 0);
  //set starting pic
  sp_pseq(&evil, 303);
  sp_pframe(&evil, 1);
  //Now EVIL's friend
  &evil2 = create_sprite(-20, 210, 0, 0, 0);
  sp_brain(&evil2, 0);
  sp_base_walk(&evil2, 300);
  sp_speed(&evil2, 1);
  sp_timing(&evil2, 0);
  //set starting pic
  sp_pseq(&evil2, 303);
  sp_pframe(&evil2, 1);
  //And the third EVIL
  &evil3 = create_sprite(300, 470, 0, 0, 0);
  sp_brain(&evil3, 0);
  sp_base_walk(&evil3, 300);
  sp_speed(&evil3, 1);
  sp_timing(&evil3, 0);
  //set starting pic
  sp_pseq(&evil3, 307);
  sp_pframe(&evil3, 1);
  Playmidi("1004.mid");
  say_stop("`5Ok, let's get going before they come.", &dude);
  wait(500);
  say_stop("`5This way.", &dude);
  move(&dude, 4, 500, 1);
  wait(50);
  move(1, 4, 550, 1);
  wait(150);
  say("`4Not so fast.", &evil);
  move(&evil, 6, 100, 1);
  wait(850);
  move(&evil3, 8, 380, 1);
  move_stop(&evil2, 6, 67, 1);
  say_stop("`4We have a small matter to discuss with your friend.", &evil);
  say("`4Hahahaaahaha", &evil);
  say("`4Haha ha ha", &evil2);
  say_stop("`4Ha ha haaa", &evil3);
  wait(800);
  sp_dir(&dude, 3);
  say_stop("`5It's okay Dink, I can take 'em.", &dude);
  wait(250);
  say("`5Allright.", &dude);
  move_stop(&dude, 4, 400, 1);
  sp_dir(&dude, 1);
  say_stop("`5Which one of you is first?", &dude);
  wait(250);
  say("`4Haha ha ha", &evil2);
  wait(500);
  say_stop("`4Ha ha haaa", &evil3);
  wait(500);
  say_stop("`4I am!!", &evil);
  move_stop(&evil, 2, 157, 1);
  move_stop(&evil, 6, 170, 1);
  wait(500);
  //say("`4I'm attacking now...", &evil);
  &junk = create_sprite(240, 157, 11, 506, 1);
  sp_seq(&junk, 506); 
  sp_dir(&junk, 6);
  sp_speed(&junk, 6);
  sp_flying(&junk, 1);
  wait(390);
  sp_active(&junk, 0);
  &junk = create_sprite(390, 157, 7, 168, 1);
  sp_seq(&junk, 168);
  sp_pseq(&dude, 375);
  sp_pframe(&dude, 1);

  say_stop("`5Ahhhhhh!", &dude);
  wait(50);
  sp_active(&junk, 0);
  //Kill guy too

  say("Noooo!!", 1);
  move(1, 4, 450, 1);
  wait(500);
  say("`4Haha ha ha", &evil2);
  say_stop("`4Ha ha haaa", &evil3);
  wait(500);
  say_stop("`4Our work is done here.", &evil);
  wait(500);
  say_stop("`4You may live, if you forget all that you've seen here.", &evil);
  wait(250);
  say_stop("Forget ...", 1);
  wait(500);
  say_stop("I'll forget allright.", 1);
  wait(250);
  move(&evil, 4, -20, 1);
  wait(360);
  move(&evil2, 4, -20, 1);
  move_stop(&evil3, 4, 180, 1);
  move_stop(&evil3, 2, 470, 1);
  sp_active(&evil, 0);
  sp_active(&evil2, 0);
  sp_active(&evil3, 0);
  wait(250);
  say_stop("Forget to remove my foot from your ASS!!", 1);
  wait(500);
  say_stop("Are you okay?", 1);
  wait(500);
  say_stop("`5I just got hit by a fireball", &dude);
  wait(500);
  say_stop("`5I'm going to die!", &dude);
  wait(250);
  say_stop("I'm sorry I wasn't fast enough.", 1);
  wait(500);
  say_stop("`5It's not your fault", &dude);
  wait(500);
  say_stop("`5Just .. just be careful... also, take this...", &dude);
  wait(500);
  say_stop("Alright.. what is it?", 1);
  wait(500);
  say_stop("`5The Mordavia scroll.  It contains magic I needed to...", &dude);
  say_stop("`5Ahhhhhh.", &dude);
  wait(1000);
  say_stop("Ah man...", 1);
  sp_active(&dude, 0);
  &caveguy = 6;
  add_magic("item-p1", 438,14);
  &story = 7;
  unfreeze(1);
  //Fade
  fade_down();
  fill_screen(0);
  //move Dink
  &player_map = 625;
  sp_x(1, 268);
  sp_y(1, 173);
  sp_dir(1, 8);
  load_screen();
  draw_screen();
  draw_status();
  fade_up();
  kill_this_task();
 }
}
示例#17
0
文件: intro.c 项目: wijnen/pydink
void main ()
{
	if (debug)
	{
		player_map = 400;
		sp_x (1, 320);
		sp_y (1, 200);
		kill_this_task ();
	}
	script_attach (1000);
	player_map = 1;
	dink_can_walk_off_screen (1);
	sp_x (1, 320);
	sp_y (1, 500);
	load_screen ();
	draw_screen ();
	wait (1);
	int daniel = sp ("daniel-intro");
	int knight = create_sprite (320, 500, "none", "silverknight 7", 1);
	sp_base_walk (knight, "silverknight");
	freeze (1);
	sp_speed (knight, 3);
	freeze (knight);
	move_stop (knight, 8, 270, 1);
	say_stop ("`7Sire! Listen!", knight);
	say_stop ("`3What is it, John?", daniel);
	say_stop ("`7The maid in the bar says Dink has been rude to her!", knight);
	say_stop ("`3What?! That's outrageous!", daniel);
	say_stop ("`3Fetch him for me!", daniel);
	say_stop ("`7At once, sire!", knight);
	move_stop (knight, 2, 500, 1);
	sp_active (knight, 0);
	say_stop ("`3What would be a good punishment...", daniel);
	sp_x (1, 320);
	sp_y (1, 500);
	move_stop (1, 8, 270, 1);
	say_stop ("`3SMALLWOOD HAS RETURNED!", daniel);
	say_stop ("And his ears hurt...", 1);
	say_stop ("`3Dink! Your behaviour is intolerable!", daniel);
	say_stop ("`3You are banished from the kingdom!", daniel);
	say_stop ("Whatever you say, Danny. Bye!", 1);
	move_stop (1, 2, 500, 1);
	say_stop ("`3I hope that was a good idea...", daniel);
	fade_down_stop ();
	player_map = 400;
	load_screen ();
	draw_screen ();
	wait (1);
	bedink.main ();
	freeze (1);
	sp_x (1, 320);
	sp_y (1, -50);
	fade_up_stop ();
	move_stop (1, 2, 200, 1);
	say_stop ("Hmm, what to do now?", 1);
	say_stop ("I need money to buy food...", 1);
	say_stop ("Stealing is too evil for me...", 1);
	say_stop ("Unless... That's an idea!", 1);
	fade_down_stop ();
	say_stop_xy ("Dink decided to steal only from those who could spare it.", 10, 200);
	say_stop_xy ("When he wasn't 'working', he wore armour to hide himself.", 10, 200);
	say_stop_xy ("After a few years, he had become a very skilled thief.", 10, 200);
	say_stop_xy ("Then, one night...", 10, 200);
	beknight.main ();
	save_game (-1);
	kill_this_task ();
}
示例#18
0
void main( void )
{
 int &guy;
 int &what;
 &what = random(3,1);
 //Spawn the guy...
 &guy = create_sprite(258, 146, 0, 0, 0);
 sp_brain(&guy, 0);
 sp_base_walk(&guy, 410);
 sp_speed(&guy, 1);
 sp_timing(&guy, 0);
 //set starting pic
 sp_pseq(&guy, 417);
 sp_pframe(&guy, 1);
 //Coversation
 freeze(1);
 freeze(&guy);
 move_stop(1, 8, 222, 1);
 move_stop(&guy, 3, 265, 1);
 wait(250);
 if (&what == 1)
 {
  say_stop("`9Can I HELP you?", &guy);
  wait(250);
  say_stop("Uhh ... maybe.", 1);
  wait(1000);
  say_stop("`9Yeah well, what the hell are you doing??", &guy);
  wait(250);
  say_stop("What do you mean?", 1);
  wait(250);
  say_stop("`9I mean you just barging in here, no knocking, nothing!", &guy);
  say_stop("`9What's with that?", &guy);
  wait(500);
  sp_dir(1, 2);
  wait(500);
  sp_dir(1, 8);
  wait(1000);
  say_stop("And there's like ... something WRONG with that?", 1);
  wait(250);
  say_stop("`9YES, now get the HELL OUT!!", &guy);
 }
 if (&what == 2)
 {
  say_stop("`9Can I HELP you?", &guy);
  wait(250);
  say_stop("Nope, just looking through houses and stuff.", 1);
  wait(750);
  say_stop("`9You know, you've got a lot of nerve.", &guy);
  wait(250);
  say_stop("Yea whatever ...", 1);
  wait(250);
  say_stop("`9Hmmmph.", &guy);
  wait(250);
  say_stop("Hey old man, the funeral house called ...", 1);
  say_stop("they're ready for you now!", 1);
  wait(250);
  say_stop("`9WHAT, now get OUT!!", &guy);
 }
 if (&what == 3)
 {
  say_stop("`9What do you want?", &guy);
  wait(250);
  say_stop("I've come for your daughter.", 1);
  wait(250);
  say_stop("`9Just ... just please leave.", &guy);
 }
 //Leave.
 unfreeze(1);
 move_stop(1, 2, 640, 0);
  unfreeze(&guy);
}
示例#19
0
void main( void )
{
 int &crap;
 &crap = create_sprite(318, 430, 0, 0, 0);
 sp_script(&crap, "s2-ryan3");
}
示例#20
0
bool32 start()
{
    irrlicht = (Irrlicht*)alloc(memory,sizeof(Irrlicht));
    init_irrlicht(false); 
    receiver = (Receiver*)alloc(memory,sizeof(Receiver));
    new (receiver) Receiver();
    irrlicht->device->setEventReceiver(receiver);
    btclock = (btClock*)alloc(memory,sizeof(btClock)); 
    new (btclock) btClock();

    score = 0;

    quadtree = (QuadTree*)alloc(memory,sizeof(QuadTree));
    init_quads(quadtree);
    clear_quads(quadtree);

    // radar map ----------------------
    sprmap = (Sprite*)alloc(memory,sizeof(Sprite));
    new (sprmap) Sprite(irrlicht->hud->getRootSceneNode(),irrlicht->hud);
    sprmap->Load(image_file,4,4,image_tiles_across,image_tiles_down);
    sprmap->setFrame(5);
    vec2 screen_pos((f4)SCREEN_WIDTH/2.0f,-(f4)SCREEN_HEIGHT/2.0f);
    screen_pos.x -= 4 * 24/2;
    screen_pos.y += 4 * 24/2;
    sprmap->setPosition(screen_pos.irr() );

    // init player ---------------------
    ply = (Player*)alloc(memory,sizeof(Player));
    ply->prev_pos = vec2(0,0);
    ply->curr_pos = vec2(0,0);
    ply->futr_pos = vec2(0,0);
    ply->direction = vec2(0,1);
    ply->velocity = 0.0f;
    ply->angle = ply->direction.angle_degrees();
    ply->motion_angle = ply->angle;
    ply->radius = 20.0f;
    ply->is_alive = true;
    ply->health = 3;
    ply->sprite = create_sprite(8);
    ply->map_sprite = create_sprite(2);
    ply->map_sprite->setParent(sprmap);

    ply->is_accelerating = false;
    ply->weapon_cooldown = 0.0f;
    ply->weapon_ready = true;
    ply->turbo_cooldown = 5.0f;
    ply->turbo_is_ready = true;
    ply->turbo_lifetime = 0.0f; 
 
    ply->num_missile = 10;
    ply->missiles = (Missile*)alloc(memory,sizeof(Missile) * ply->num_missile);

    for (s4 i = 0; i < ply->num_missile; i++)
    {
        ply->missiles[i].sprite = create_sprite(1);
        ply->missiles[i].sprite->setVisible(false);
        ply->missiles[i].map_sprite = create_sprite(2);
        ply->missiles[i].map_sprite->setParent(sprmap);
        ply->missiles[i].map_sprite->setVisible(false);
        ply->missiles[i].is_active = false;
    }

    ply->last_missile = 0;

    // init enemies -----------------------
    fleet = init_fleet();

    return true;
}
示例#21
0
/**
 * \brief Creates the sprite of this pickable treasure.
 *
 * Pickable treasures are represented with two sprites:
 * the treasure itself and, for some items, a shadow.
 *
 * \return \c true in case of success, \c false if the animation corresponding
 * to the treasure is missing.
 */
bool Pickable::initialize_sprites() {

  // Shadow sprite.
  shadow_sprite = nullptr;
  EquipmentItem& item = treasure.get_item();
  const std::string& animation = item.get_shadow();

  bool has_shadow = false;
  if (!animation.empty()) {
    shadow_sprite = std::make_shared<Sprite>("entities/shadow");
    has_shadow = shadow_sprite->has_animation(animation);
  }

  if (!has_shadow) {
    // No shadow or no such shadow animation.
    shadow_sprite = nullptr;
  }
  else {
    shadow_sprite->set_current_animation(animation);
  }

  // Main sprite.
  const std::string item_name = treasure.get_item_name();
  create_sprite("entities/items");
  Sprite& item_sprite = get_sprite();

  if( !item_sprite.has_animation(item_name)) {
    std::ostringstream oss;
    oss << "Cannot create pickable treasure '" << item_name
        << "': Sprite 'entities/items' has no animation '"
        << item_name << "'";
    Debug::error(oss.str());
    return false;
  }

  item_sprite.set_current_animation(item_name);
  int direction = treasure.get_variant() - 1;
  if (direction < 0 || direction >= item_sprite.get_nb_directions()) {
    std::ostringstream oss;
    oss << "Pickable treasure '" << item_name
        << "' has variant " << treasure.get_variant()
        << " but sprite 'entities/items' only has "
        << item_sprite.get_nb_directions() << " variant(s) in animation '"
        << item_name << "'";
    Debug::error(oss.str());
    direction = 0;  // Fallback.
  }
  item_sprite.set_current_direction(direction);
  item_sprite.enable_pixel_collisions();

  // Set the origin point and the size of the entity.
  set_size(16, 16);
  set_origin(8, 13);

  uint32_t now = System::now();

  if (falling_height != FALLING_NONE) {
    allow_pick_date = now + 700;  // The player will be allowed to take the item after 0.7 seconds.
    can_be_picked = false;
  }
  else {
    can_be_picked = true;
  }

  // Initialize the item removal.
  if (will_disappear) {
    blink_date = now + 8000;       // The item blinks after 8s.
    disappear_date = now + 10000;  // The item disappears after 10s.
  }

  return true;
}
示例#22
0
int main (int argc, char ** argv) {
	init_shmemfonts();

	yutani_t * y = yutani_init();

	if (!y) {
		fprintf(stderr, "[glogin] Connection to server failed.\n");
		return 1;
	}

	/* Load config */
	{
		confreader_t * conf = confreader_load("/etc/glogin.conf");

		LOGO_FINAL_OFFSET = confreader_intd(conf, "style", "logo_padding", LOGO_FINAL_OFFSET);
		BOX_WIDTH = confreader_intd(conf, "style", "box_width", BOX_WIDTH);
		BOX_HEIGHT = confreader_intd(conf, "style", "box_height", BOX_HEIGHT);
		BOX_ROUNDNESS = confreader_intd(conf, "style", "box_roundness", BOX_ROUNDNESS);
		CENTER_BOX_X = confreader_intd(conf, "style", "center_box_x", CENTER_BOX_X);
		CENTER_BOX_Y = confreader_intd(conf, "style", "center_box_y", CENTER_BOX_Y);
		BOX_LEFT = confreader_intd(conf, "style", "box_left", BOX_LEFT);
		BOX_RIGHT = confreader_intd(conf, "style", "box_right", BOX_RIGHT);
		BOX_TOP = confreader_intd(conf, "style", "box_top", BOX_TOP);
		BOX_BOTTOM = confreader_intd(conf, "style", "box_bottom", BOX_BOTTOM);
		BOX_COLOR_R = confreader_intd(conf, "style", "box_color_r", BOX_COLOR_R);
		BOX_COLOR_G = confreader_intd(conf, "style", "box_color_g", BOX_COLOR_G);
		BOX_COLOR_B = confreader_intd(conf, "style", "box_color_b", BOX_COLOR_B);
		BOX_COLOR_A = confreader_intd(conf, "style", "box_color_a", BOX_COLOR_A);

		WALLPAPER = confreader_getd(conf, "image", "wallpaper", WALLPAPER);
		LOGO = confreader_getd(conf, "image", "logo", LOGO);

		confreader_free(conf);

		TRACE("Loading complete");
	}

	TRACE("Loading logo...");
	load_sprite_png(&logo, LOGO);
	TRACE("... done.");

	/* Generate surface for background */
	sprite_t * bg_sprite;

	int width  = y->display_width;
	int height = y->display_height;
	int skip_animation = 0;

	/* Do something with a window */
	TRACE("Connecting to window server...");
	yutani_window_t * wina = yutani_window_create(y, width, height);
	assert(wina);
	yutani_set_stack(y, wina, 0);
	ctx = init_graphics_yutani_double_buffer(wina);
	draw_fill(ctx, rgba(0,0,0,255));
	yutani_flip(y, wina);
	TRACE("... done.");


redo_everything:
	win_width = width;
	win_height = height;

	cairo_surface_t * cs = cairo_image_surface_create_for_data((void*)ctx->backbuffer, CAIRO_FORMAT_ARGB32, ctx->width, ctx->height, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, ctx->width));
	cairo_t * cr = cairo_create(cs);


	TRACE("Loading wallpaper...");
	{
		sprite_t * wallpaper = malloc(sizeof(sprite_t));
		load_sprite_png(wallpaper, WALLPAPER);

		float x = (float)width  / (float)wallpaper->width;
		float y = (float)height / (float)wallpaper->height;

		int nh = (int)(x * (float)wallpaper->height);
		int nw = (int)(y * (float)wallpaper->width);;

		bg_sprite = create_sprite(width, height, ALPHA_OPAQUE);
		gfx_context_t * bg = init_graphics_sprite(bg_sprite);

		if (nw > width) {
			draw_sprite_scaled(bg, wallpaper, (width - nw) / 2, 0, nw, height);
		} else {
			draw_sprite_scaled(bg, wallpaper, 0, (height - nh) / 2, width, nh);
		}

		/* Three box blurs = good enough approximation of a guassian, but faster*/
		blur_context_box(bg, 20);
		blur_context_box(bg, 20);
		blur_context_box(bg, 20);

		free(bg);
		free(wallpaper);
	}
	TRACE("... done.");

	while (1) {

		yutani_set_stack(y, wina, 0);
		yutani_focus_window(y, wina->wid);

		draw_fill(ctx, rgb(0,0,0));
		draw_sprite(ctx, bg_sprite, center_x(width), center_y(height));
		flip(ctx);
		yutani_flip(y, wina);

		char * foo = malloc(sizeof(uint32_t) * width * height);
		memcpy(foo, ctx->backbuffer, sizeof(uint32_t) * width * height);

		TRACE("Begin animation.");
		if (!skip_animation) {
			struct timeval start;
			gettimeofday(&start, NULL);

			while (1) {
				uint32_t tick;
				struct timeval t;
				gettimeofday(&t, NULL);

				uint32_t sec_diff = t.tv_sec - start.tv_sec;
				uint32_t usec_diff = t.tv_usec - start.tv_usec;

				if (t.tv_usec < start.tv_usec) {
					sec_diff -= 1;
					usec_diff = (1000000 + t.tv_usec) - start.tv_usec;
				}

				tick = (uint32_t)(sec_diff * 1000 + usec_diff / 1000);
				int i = (float)LOGO_FINAL_OFFSET * (float)tick / 700.0f;
				if (i >= LOGO_FINAL_OFFSET) break;

				memcpy(ctx->backbuffer, foo, sizeof(uint32_t) * width * height);
				draw_sprite(ctx, &logo, center_x(logo.width), center_y(logo.height) - i);
				flip(ctx);
				yutani_flip_region(y, wina, center_x(logo.width), center_y(logo.height) - i, logo.width, logo.height + 5);
				usleep(10000);
			}
		}
		TRACE("End animation.");
		skip_animation = 0;

		size_t buf_size = wina->width * wina->height * sizeof(uint32_t);
		char * buf = malloc(buf_size);

		uint32_t i = 0;

		uint32_t black = rgb(0,0,0);
		uint32_t white = rgb(255,255,255);

		int x_offset = 65;
		int y_offset = 64;

		int fuzz = 3;

		char username[INPUT_SIZE] = {0};
		char password[INPUT_SIZE] = {0};
		char hostname[512];

		// we do it here to calculate the final string position
		get_updated_hostname_with_time_info(hostname);

		char kernel_v[512];

		{
			struct utsname u;
			uname(&u);
			/* UTF-8 Strings FTW! */
			uint8_t * os_name_ = "とあるOS";
			uint32_t l = snprintf(kernel_v, 512, "%s %s", os_name_, u.release);
		}

		uid = 0;

		int box_x, box_y;

		if (CENTER_BOX_X) {
			box_x = center_x(BOX_WIDTH);
		} else if (BOX_LEFT == -1) {
			box_x = win_width - BOX_RIGHT - BOX_WIDTH;
		} else {
			box_x = BOX_LEFT;
		}
		if (CENTER_BOX_Y) {
			box_y = center_y(0) + 8;
		} else if (BOX_TOP == -1) {
			box_y = win_width - BOX_BOTTOM - BOX_HEIGHT;
		} else {
			box_y = BOX_TOP;
		}

		int focus = 0;

		set_font_size(11);
		int hostname_label_left = width - 10 - draw_string_width(hostname);
		int kernel_v_label_left = 10;

		struct text_box username_box = { (BOX_WIDTH - 170) / 2, 30, 170, 20, rgb(0,0,0), NULL, 0, 0, 0, username, "Username" };
		struct text_box password_box = { (BOX_WIDTH - 170) / 2, 58, 170, 20, rgb(0,0,0), NULL, 0, 1, 0, password, "Password" };

		struct login_container lc = { box_x, box_y, BOX_WIDTH, BOX_HEIGHT, &username_box, &password_box, 0 };

		username_box.parent = &lc;
		password_box.parent = &lc;

		while (1) {
			focus = 0;
			memset(username, 0x0, INPUT_SIZE);
			memset(password, 0x0, INPUT_SIZE);

			while (1) {

				// update time info
				get_updated_hostname_with_time_info(hostname);

				memcpy(ctx->backbuffer, foo, sizeof(uint32_t) * width * height);
				draw_sprite(ctx, &logo, center_x(logo.width), center_y(logo.height) - LOGO_FINAL_OFFSET);

				set_font_size(11);
				draw_string_shadow(ctx, hostname_label_left, height - 12, white, hostname, rgb(0,0,0), 2, 1, 1, 3.0);
				draw_string_shadow(ctx, kernel_v_label_left, height - 12, white, kernel_v, rgb(0,0,0), 2, 1, 1, 3.0);

				if (focus == USERNAME_BOX) {
					username_box.is_focused = 1;
					password_box.is_focused = 0;
				} else if (focus == PASSWORD_BOX) {
					username_box.is_focused = 0;
					password_box.is_focused = 1;
				} else {
					username_box.is_focused = 0;
					password_box.is_focused = 0;
				}

				draw_login_container(cr, &lc);

				flip(ctx);
				yutani_flip(y, wina);

				struct yutani_msg_key_event kbd;
				struct yutani_msg_window_mouse_event mou;
				int msg_type = 0;
collect_events:
				do {
					yutani_msg_t * msg = yutani_poll(y);
					switch (msg->type) {
						case YUTANI_MSG_KEY_EVENT:
							{
								struct yutani_msg_key_event * ke = (void*)msg->data;
								if (ke->event.action == KEY_ACTION_DOWN) {
									memcpy(&kbd, ke, sizeof(struct yutani_msg_key_event));
									msg_type = 1;
								}
							}
							break;
						case YUTANI_MSG_WINDOW_MOUSE_EVENT:
							{
								struct yutani_msg_window_mouse_event * me = (void*)msg->data;
								memcpy(&mou, me, sizeof(struct yutani_msg_mouse_event));
								msg_type = 2;
							}
							break;
						case YUTANI_MSG_WELCOME:
							{
								struct yutani_msg_welcome * mw = (void*)msg->data;
								yutani_window_resize(y, wina, mw->display_width, mw->display_height);
							}
							break;
						case YUTANI_MSG_RESIZE_OFFER:
							{
								struct yutani_msg_window_resize * wr = (void*)msg->data;
								width = wr->width;
								height = wr->height;
								yutani_window_resize_accept(y, wina, width, height);
								reinit_graphics_yutani(ctx, wina);
								yutani_window_resize_done(y, wina);

								sprite_free(bg_sprite);
								cairo_destroy(cr);
								cairo_surface_destroy(cs);

								skip_animation = 1;
								goto redo_everything;
							}
							break;
					}
					free(msg);
				} while (!msg_type);

				if (msg_type == 1) {

					if (kbd.event.keycode == '\n') {
						if (focus == USERNAME_BOX) {
							focus = PASSWORD_BOX;
							continue;
						} else if (focus == PASSWORD_BOX) {
							break;
						} else {
							focus = USERNAME_BOX;
							continue;
						}
					}

					if (kbd.event.keycode == '\t') {
						if (focus == USERNAME_BOX) {
							focus = PASSWORD_BOX;
						} else {
							focus = USERNAME_BOX;
						}
						continue;
					}

					if (kbd.event.key) {

						if (!focus) {
							focus = USERNAME_BOX;
						}

						if (focus == USERNAME_BOX) {
							buffer_put(username, kbd.event.key);
						} else if (focus == PASSWORD_BOX) {
							buffer_put(password, kbd.event.key);
						}

					}

				} else if (msg_type == 2) {

					if ((mou.command == YUTANI_MOUSE_EVENT_DOWN
					     && mou.buttons & YUTANI_MOUSE_BUTTON_LEFT)
					    || (mou.command == YUTANI_MOUSE_EVENT_CLICK)) {
						/* Determine if we were inside of a text box */

						if (mou.new_x >= lc.x + username_box.x &&
						    mou.new_x <= lc.x + username_box.x + username_box.width &&
						    mou.new_y >= lc.y + username_box.y &&
						    mou.new_y <= lc.y + username_box.y + username_box.height) {
							/* Ensure this box is focused. */
							focus = USERNAME_BOX;
							continue;
						} else if (mou.new_x >= lc.x + password_box.x &&
						    mou.new_x <= lc.x + password_box.x + password_box.width &&
						    mou.new_y >= lc.y + password_box.y &&
						    mou.new_y <= lc.y + password_box.y + password_box.height) {
							/* Ensure this box is focused. */
							focus = PASSWORD_BOX;
							continue;
						} else {
							focus = 0;
							continue;
						}

					} else {
						goto collect_events;
					}
				}

			}

			uid = toaru_auth_check_pass(username, password);

			if (uid >= 0) {
				break;
			}
			lc.show_error = 1;
		}

		memcpy(ctx->backbuffer, foo, sizeof(uint32_t) * width * height);
		flip(ctx);
		yutani_flip(y, wina);
		syscall_yield();

		pid_t _session_pid = fork();
		if (!_session_pid) {
			setuid(uid);
			toaru_auth_set_vars();
			char * args[] = {"/bin/gsession", NULL};
			execvp(args[0], args);
		}

		free(foo);
		free(buf);

		waitpid(_session_pid, NULL, 0);
	}

	yutani_close(y, wina);


	return 0;
}
示例#23
0
void SetupGame(Game * game) {
    /*-----| General Game Settings |-----*/
    game->game_level = 0;
    game->game_over = false;
	srand(time(NULL));
	game->levelFive_stage = 0;

    /*-----| Player: Spaceship |-----*/
	// General Settings
    game->player_lives = 3;
	game->player_score = 0;

	// Generate the Sprite for the Spaceship.
    int startX = screen_width() / 2;
    int startY = screen_height() - 4;
    game->player_spaceship = create_sprite(startX, startY, 3, 1, "|^|");
    game->player_spaceship->dx = 1;

	/*-----| Player: Missile |-----*/
	// Generate the Sprite for the Missile.
	for (int i = 0; i < 5; i++) {
		game->player_missile[i] = create_sprite(0, 0, 1, 1, "|");
	    game->player_missile[i]->dy = 1;
	    game->player_missile[i]->is_visible = false;
	}

    /*-----| Enemy: Aliens |-----*/
	// Create an Array of the starting locations for the Aliens.
	int start[10][2] = {{8, 2}, {14, 2}, {20, 2}, {5, 4}, {11, 4}, {17, 4}, {23, 4}, {8, 6}, {14, 6}, {20, 6}};

	// Load the start array into our Data Structure so it can be used later.
	for (int i = 0; i < 10; i++) {
		game->enemy_start[i][0] = start[i][0];
		game->enemy_start[i][1] = start[i][1];
	}

	// Generate the Sprites for the Aliens.
	for (int i = 0; i < 10; i++) {
		game->enemy_aliens[i] = create_sprite(game->enemy_start[i][0], game->enemy_start[i][1], 1, 1, "@");
	}
	game->enemy_alive = 10;

	/*-----| Enemy: Bombs |-----*/
	// General Settings
	game->enemy_bombtimer = create_timer(3000);
	game->enemy_lastbomb = 10;

	for (int i = 0; i < 4; i++) {
		game->enemy_bombs[i] = create_sprite(0, 0, 1, 1, "Y");
		game->enemy_bombs[i]->dy = 1;
		game->enemy_bombs[i]->is_visible = false;
	}

	/*-----| Bonus Content |-----*/
	// General Settings.
	game->bonusChance = -1;
	game->bonusDrop = -1;

	// Sheild Bonus.
	game->bonus_sheild = create_sprite(0, 0, 1, 1, "S");
	game->bonus_sheild->is_visible = false;
	game->player_sheild = create_sprite(0, 0, 3, 1, "___");
	game->player_sheild->is_visible = false;

	// Missiles Bonus
	game->bonus_missiles = create_sprite(0, 0, 1, 1, "M");
	game->bonus_missiles->is_visible = false;
	game->bonusMissiles = 0;

	/*-----| Miscellaneous or Debugging |-----*/
	game->missileReleasedZ = false;
	game->missileReleasedC = false;
	game->notZ = 0;
	game->bonusMissilesActive = false;
	game->levelFive_selected = 0;

	// Left Four Stuff
	game->LevelFour_borderLeft = 4;
	game->LevelFour_borderRight = screen_width() - 5;
	game->levelFour_contract = true;
}
示例#24
0
void use( void )
{
    activate_bow();
    &mypower = get_last_bow_power();

    &mholdx = sp_x(1, -1);
    &mholdy = sp_y(1, -1);

    &mydir = sp_dir(1, -1);

    if (&mypower < 100)
    {
        return;
    }


    playsound(44, 22050,0,0,0);


    if (&mydir == 6)
    {
        &mholdx += 30;
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 6);
        sp_dir(&junk, 6);
    }

    if (&mydir == 4)
    {
        &mholdx -= 30;
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 4);
        sp_dir(&junk, 4);
    }

    if (&mydir == 2)
    {
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 2);
        sp_dir(&junk, 2);
    }

    if (&mydir == 8)
    {
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 8);
        sp_dir(&junk, 8);
    }

    if (&mydir == 9)
    {
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 5);
        sp_dir(&junk, 9);
    }
    if (&mydir == 1)
    {
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 1);
        sp_dir(&junk, 1);
    }
    if (&mydir == 7)
    {
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 7);
        sp_dir(&junk, 7);
    }

    if (&mydir == 3)
    {
        &junk = create_sprite(&mholdx, &mholdy, 11, 25, 3);
        sp_dir(&junk, 3);
    }

    &mypower / 100;
    &temp = &strength;
    &temp / 5;


    if (&temp == 0)
    {
        &temp = 1;
    }
    &mypower * &temp;
    sp_timing(&junk, 0);

    if (&bowlore == 1)
    {
        &temp = random(2, 1);

        if (&temp == 1)
        {
            //critical hit
            &mypower * 3;
            playsound(44, 14050,0,0,0);

            say("`4* POWER SHOT *", 1);
        }
    }
    sp_speed(&junk, 6);

    sp_strength(&junk, &mypower);
    sp_range(&junk, 10);
    //this makes it easier to hit stuff
    sp_flying(&junk, 1);
    sp_script(&junk, "dam-a1");
    //when the fireball hits something, it will look to this script, this way
    //we can burn trees when appropriate
    &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
    sp_brain_parm(&mshadow, &junk);
    sp_que(&mshadow, -500);
    sp_brain_parm(&junk, 1);
    sp_brain_parm2(&junk, &mshadow);
    sp_nohit(&mshadow, 1);


    return;
}
示例#25
0
文件: actor.c 项目: Df458/Halberd
actor load_actor_from_resource(const char* resource_location, const char* resource_name)
{
    xmlDocPtr doc = load_resource_to_xml(resource_location, resource_name);
    if(!doc)
        return 0;
    xmlNodePtr root = xmlDocGetRootElement(doc);
    for(; root; root = root->next)
        if(root->type == XML_ELEMENT_NODE && !xmlStrcmp(root->name, (const xmlChar*)"actor"))
            break;
    if(!root)
        return 0;
    actor a_new = malloc(sizeof(struct Actor));
    a_new->data.grid_x = 0;
    a_new->data.grid_y = 0;
    a_new->data.super_grid_x = 0;
    a_new->data.super_grid_y = 0;
    a_new->data.flags = 0;
    a_new->data.sprites = 0;
    memset(a_new->callbacks, 0, CALLBACK_COUNT * sizeof(lua_State*));
    a_new->data.speed = 0;
    a_new->data.moving = 0;
    a_new->data.orientation = 0;
    /*a_new->data.animation_index = 0;*/
    /*a_new->data.animation_playing = 0;*/
    /*a_new->data.animation_timer = 0;*/
    a_new->data.sprites_id = UINT32_MAX;

    for(xmlNodePtr node = root->children; node; node = node->next) {
        if(node->type == XML_ELEMENT_NODE && !xmlStrcmp(node->name, (const xmlChar*)"position")) {
            xmlChar* a = 0;
            if((a = xmlGetProp(node, (const xmlChar*)"x"))) {
                a_new->data.grid_x = atoi((char*)a);
                free(a);
            }
            a = 0;
            if((a = xmlGetProp(node, (const xmlChar*)"y"))) {
                a_new->data.grid_y = atoi((char*)a);
                free(a);
            }
        }
        if(node->type == XML_ELEMENT_NODE && !xmlStrcmp(node->name, (const xmlChar*)"display")) {
            xmlChar* a = 0;
            if((a = xmlGetProp(node, (const xmlChar*)"id"))) {
                a_new->data.sprites_id = atoi((char*)a);
                a_new->data.sprites = create_sprite((spriteset*)get_data_from_id(a_new->data.sprites_id));
                free(a);
            }
        }
        if(node->type == XML_ELEMENT_NODE && !xmlStrcmp(node->name, (const xmlChar*)"callback")) {
            load_callback_fn(node, a_new, resource_location, resource_name);
        }
    }
    xmlChar* a = 0;
    if((a = xmlGetProp(root, (const xmlChar*)"solid"))) {
        a_new->data.flags += strcmp((char*)a, "false") ? FLAG_SOLID : 0;
        free(a);
    }
    if((a = xmlGetProp(root, (const xmlChar*)"visible"))) {
        a_new->data.flags += strcmp((char*)a, "false") ? FLAG_VISIBLE : 0;
        free(a);
    }
    if((a = xmlGetProp(root, (const xmlChar*)"lock_to_grid"))) {
        a_new->data.flags += strcmp((char*)a, "false") ? FLAG_LOCK_TO_GRID : 0;
        free(a);
    }
    if((a = xmlGetProp(root, (const xmlChar*)"can_orient"))) {
        a_new->data.flags += strcmp((char*)a, "false") ? FLAG_CAN_ORIENT : 0;
        free(a);
    }
    if((a = xmlGetProp(root, (const xmlChar*)"block_with_solid"))) {
        a_new->data.flags += strcmp((char*)a, "false") ? FLAG_BLOCK_WITH_SOLID : 0;
        free(a);
    }

    /*if(a_new->data.sprites != 0) {*/
        /*a_new->data.animation_index = 0;*/
        /*a_new->data.animation_playing = a_new->data.sprites->animations[0].autoplay;*/
    /*}*/
    a_new->data.position_x = a_new->data.grid_x * TILE_WIDTH;
    a_new->data.position_y = a_new->data.grid_y * TILE_HEIGHT;

    xmlFreeDoc(doc);

    return a_new;
}
示例#26
0
文件: wallpaper.c 项目: etel/ponyos
int main (int argc, char ** argv) {
	yctx = yutani_init();

	int width  = yctx->display_width;
	int height = yctx->display_height;

	sprite_t * wallpaper_tmp = malloc(sizeof(sprite_t));

	char f_name[512];
	sprintf(f_name, "%s/.wallpaper.png", getenv("HOME"));
	FILE * f = fopen(f_name, "r");
	if (f) {
		fclose(f);
		load_sprite_png(wallpaper_tmp, f_name);
	} else {
		load_sprite_png(wallpaper_tmp, "/usr/share/wallpaper.png");
	}

	/* Initialize hashmap for icon cache */
	icon_cache = hashmap_create(10);

	{ /* Generic fallback icon */
		sprite_t * app_icon = malloc(sizeof(sprite_t));
		load_sprite_png(app_icon, "/usr/share/icons/48/applications-generic.png");
		hashmap_set(icon_cache, "generic", app_icon);
	}

	sprintf(f_name, "%s/.desktop", getenv("HOME"));
	f = fopen(f_name, "r");
	if (!f) {
		f = fopen("/etc/default.desktop", "r");
	}
	read_applications(f);

	/* Load applications */
	uint32_t i = 0;
	while (applications[i].icon) {
		applications[i].icon_sprite = icon_get(applications[i].icon);
		++i;
	}

	float x = (float)width  / (float)wallpaper_tmp->width;
	float y = (float)height / (float)wallpaper_tmp->height;

	int nh = (int)(x * (float)wallpaper_tmp->height);
	int nw = (int)(y * (float)wallpaper_tmp->width);;

	wallpaper = create_sprite(width, height, ALPHA_OPAQUE);
	gfx_context_t * tmp = init_graphics_sprite(wallpaper);

	if (nw > width) {
		draw_sprite_scaled(tmp, wallpaper_tmp, (width - nw) / 2, 0, nw, height);
	} else {
		draw_sprite_scaled(tmp, wallpaper_tmp, 0, (height - nh) / 2, width, nh);
	}

	free(tmp);

	win_width = width;
	win_height = height;

	wina = yutani_window_create(yctx, width, height);
	assert(wina);
	yutani_set_stack(yctx, wina, YUTANI_ZORDER_BOTTOM);
	ctx = init_graphics_yutani_double_buffer(wina);
	init_shmemfonts();

	redraw_apps();
	yutani_flip(yctx, wina);

	while (_continue) {
		yutani_msg_t * m = yutani_poll(yctx);
		waitpid(-1, NULL, WNOHANG);
		if (m) {
			switch (m->type) {
				case YUTANI_MSG_WINDOW_MOUSE_EVENT:
					wallpaper_check_click((struct yutani_msg_window_mouse_event *)m->data);
					break;
				case YUTANI_MSG_SESSION_END:
					_continue = 0;
					break;
			}
			free(m);
		}
	}

	yutani_close(yctx, wina);

	return 0;
}
示例#27
0
void check_colision(data_jeu* d)
{
    list_ball* l=&(d->file_balls);
    projectile* p=&(d->cannonball);

    node_ball* it=begin_list_ball(*l);
    node_ball* balle_inseree=0;

    while(it)
    {
        /*#1*/
        if((distance2(p->pos.x-it->val.point_courant->x,p->pos.y-it->val.point_courant->y)<32*32*1.4))
        {
	    int trouve =0;
            int nb_same_ball=1;
            node_ball* it_forward=0;
            node_ball* it_backward=0;
            node_ball* begin=0;
	    
	    node_discontinuity* r;
	    
	    /*On insere une balle au meme point courant que it*/
            insert2_list_ball(l,it,create_sprite(p->img,it->val.point_courant));
            d->nb_type_playing[find_index_projectile(p->img,d->img_ball)]++;
            
            begin=begin_list_ball(*l);
            balle_inseree=it->next; /*On pointe sur la balle inseree puis on lui donne le meme mouvement que celle avant*/
            balle_inseree->val.current_movement=it->val.current_movement;

            /*comptage du nombre de boule*/
            it_forward=balle_inseree;
            while(it_forward->next && it_forward->next->val.img==balle_inseree->val.img)
            {       
                nb_same_ball++;
                it_forward=it_forward->next;
            }

            it_backward=balle_inseree;
            while(it_backward->previous !=begin->previous && it_backward->previous->val.img==balle_inseree->val.img)
            {
                nb_same_ball++;
                it_backward=it_backward->previous;
            }

          
                /*
                  Si une balle qu'on touche est deja dans les discontinuite
                    si elle a une position paire (ie est a droite du trou)
                        on on avance la discontinuité (car la balle se place APRES it)
                 */
	    r=find_list_discontinuity(d->discontinuity,it);
	    if(r)
	      {
		int idx=index_list_discontinuity(d->discontinuity,r);
		if(idx%2==0)
		  {
		    r->val=it->next;
		  }
	      }
	      
            /*besoin de supprimer des balles*/
            if(nb_same_ball>2)
            {

		node_ball* first_discontinuity=it_backward;
		node_ball* second_discontinuity=it_forward;
		node_ball* r1=0;
		node_ball* r2=0;

		d->score+=base_score*(nb_same_ball-2);

                /*Pour gerer les cas ou au final il n'y plus qu'une balle seule*/
		if(it_backward!=it_forward)
		{
		    first_discontinuity=it_backward->previous;
		    second_discontinuity=it_forward->next;
		}
		
		r1=first_discontinuity;
		r2=second_discontinuity;
                
                /*Si une des balles qu'on supprime est une discontinuite, on indique
                qu'on va devoir reconstruire depuis zero la liste des discontinuite*/
		while(r1!=r2)
		{
		    if(find_list_discontinuity(d->discontinuity,r1))
		      {trouve=1;break;}
			r1=r1->next;
		}

                /*On retire les boules*/
		d->nb_type_playing[find_index_projectile(p->img,d->img_ball)]-=nb_same_ball;
		remove_range_list_ball(l,it_backward,it_forward);

		if(trouve)
		  {
		    research_discontinuity(d);
		  }
	
		if(size_list_ball(*l)!=0)
		{
		    /*
		    Si on est sur la tete ou sur la queue, besoin de rien faire
		    */
		    if(first_discontinuity!=l->head && second_discontinuity)
		    {        
		        /*Si on a pas shoote une discontinuite, on les ajoute normalement*/
			if(!trouve)
			{
			append_list_discontinuity(&(d->discontinuity),first_discontinuity);
			append_list_discontinuity(&(d->discontinuity),second_discontinuity);
			}

			if(first_discontinuity->val.img==second_discontinuity->val.img)
			{
			  /*On arrete de jeter des balles et on definit les mouvements*/
			  d->throw_projectile=0;  
			  do{
				first_discontinuity->val.current_movement=backward;
				first_discontinuity=first_discontinuity->previous;
			    }
			    while(first_discontinuity!=l->head);

			    do{
				second_discontinuity->val.current_movement=stay_still;
				second_discontinuity=second_discontinuity->next;
			    }
			    while(second_discontinuity && !find_list_discontinuity(d->discontinuity,second_discontinuity));

                            /*Si second_discontinuity n'est plus valide, cela signifie que la 
                            dernière boule du cortege est au niveau du début du chemin, donc il ne faut pas en ajouter tant qu'on re avance pas*/
			    if (!second_discontinuity)
			    {
				d->adding_ball=0;
			    }
			}
			/*boules differentes ; l'avant s'arrête */
			else
			{
			    do{
				first_discontinuity->val.current_movement=stay_still;
				first_discontinuity=first_discontinuity->previous;
			    }                           
			    while(first_discontinuity!=l->head);                        
			}
                    
		    }
		}/*si le cortege est non vide*/
		else
		{
		    printf("cortege vide !!");
		}
            } /*fin nb_same_ball>2: ie aucune boule a supprimer*/
            else
            {
                /*#2 : on avance les boules*/
                if(size_list_ball(*l)!=0)
                    avancer_balls(it,l);
            }
            reset_projectile(d);
            break;
            
        } /*fin check colision*/
        it=it->next;
    } /*fin boucle principale*/

} /*fin fonction*/