void SetfieldHandler::handle(InPacket& recv) const
	{
		int32_t channel = recv.read_int();
		int8_t mode1 = recv.read_byte();
		int8_t mode2 = recv.read_byte();
		if (mode1 == 0 && mode2 == 0)
		{
			change_map(recv, channel);
		}
		else
		{
			set_field(recv);
		}
	}
Exemple #2
0
void		boucle_principal(t_bal *bal, t_brick *brick, t_env *e)
{
	t_seg	s;

	while (1)
	{
		if (map_end(e))
			change_map(e);
		if (glfwWindowShouldClose(e->window))
			break ;
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		draw_bricks(e, brick);
		draw_seg(&s, e);
		if (e->space == 0)
			bal->x1 = e->x_bar + 0.125;
		draw_circle(bal, e);
		draw_barre(e->x_bar, -0.90);
		if (e->space == 1 && e->pauz == 1)
			move_bal(bal, e);
		glfwSwapBuffers(e->window);
		glfwPollEvents();
	}
}
Exemple #3
0
Fichier : sgame.c Projet : rj76/kq
/*! \brief Load game
 *
 * Uh-huh.
 * PH 20030805 Made endian-safe
 * PH 20030914 Now ignores keyboard settings etc in the save file
 * \returns 1 if load succeeded, 0 otherwise
 */
static int load_game (void)
{
   PACKFILE *sdat;
   int a;
   unsigned char tv;

   sprintf (strbuf, "sg%d.sav", save_ptr);
   sdat = pack_fopen (kqres (SAVE_DIR, strbuf), F_READ_PACKED);
   if (!sdat) {
      message (_("Could not load saved game."), 255, 0, 0, 0);
      return 0;
   }

   tv = pack_getc (sdat);
   if (tv == 92)
      a = load_game_92(sdat);
   else if (tv == 91)
      a = load_game_91(sdat);
   else {
      a = 0;
      message (_("Saved game format is not current."), 255, 0, 0, 0);
   }

   pack_fclose (sdat);
   if (!a)
      return 0;

   timer_count = 0;
   ksec = 0;
   hold_fade = 0;
   change_map (curmap, g_ent[0].tilex, g_ent[0].tiley, g_ent[0].tilex,
               g_ent[0].tiley);
   /* Set music and sound volume */
   set_volume (gsvol, -1);
   set_music_volume (((float) gmvol) / 255.0);
   return 1;
}