示例#1
0
文件: update.c 项目: andrewrk/mpd
static void * update_task(void *_path)
{
	const char *path = _path;

	if (path != NULL && *path != 0)
		g_debug("starting: %s", path);
	else
		g_debug("starting");

	modified = update_walk(path, discard);

	if (modified || !db_exists()) {
		GError *error = NULL;
		if (!db_save(&error)) {
			g_warning("Failed to save database: %s",
				  error->message);
			g_error_free(error);
		}
	}

	if (path != NULL && *path != 0)
		g_debug("finished: %s", path);
	else
		g_debug("finished");
	g_free(_path);

	progress = UPDATE_PROGRESS_DONE;
	event_pipe_emit(PIPE_EVENT_UPDATE);
	return NULL;
}
void GoS_StartMenu::update()
{
	update_jump();
	update_walk();
	update_kick();
	update_bomba();
}
void
Player::update_walk_stand()
{
  if (controller.get_axis_state(Y_AXIS) > 0) {
    TileMap* tilemap = Sector::current()->get_tilemap2();
    if (tilemap)
      {
        Point p(int(pos.x)/32, (int(pos.y)/32 + 1));
        unsigned int col = tilemap->get_pixel(p.x, p.y);

        if ((col & TILE_STAIRS) && (get_direction() == WEST && (col & TILE_LEFT) ||
                                    get_direction() == EAST && (col & TILE_RIGHT)))
          {
            delete contact;
            contact = new StairContact(tilemap, p);

            std::cout << "Stair mode" << std::endl;
            state = STAIRS_DOWN;
            //c_object->get_check_domains() & (~CollisionObject::DOMAIN_TILEMAP));
            Sector::current()->get_collision_engine()->remove(c_object);
            z_pos = -10.0f;
            return;
          }
        else
          {
            set_ducking();
            return;
          }
      }
  } else if (controller.get_axis_state(Y_AXIS) < 0) {
    TileMap* tilemap = Sector::current()->get_tilemap2();
    if (tilemap)
      {
        Point p(int(pos.x)/32 + ((get_direction() == WEST) ? -1 : +1), (int(pos.y)/32));
        unsigned int col = tilemap->get_pixel(p.x, p.y);

        if ((col & TILE_STAIRS) && (get_direction() == EAST && (col & TILE_LEFT) ||
                                    get_direction() == WEST && (col & TILE_RIGHT)))
          {
            delete contact;
            contact = new StairContact(tilemap, p);

            state = STAIRS_UP;
            //c_object->get_check_domains() & (~CollisionObject::DOMAIN_TILEMAP));
            Sector::current()->get_collision_engine()->remove(c_object);
            z_pos = -10.0f;
            return;
          }
      }    
  }

  if(state == STAND)
    update_stand();
  else
    update_walk();
}
示例#4
0
void
Pingus::update (float delta)
{
  float direction = get_direction();
  if (direction >= 0 && direction < 180)
    sprite[Direction::RIGHT].update(delta);
  else
    sprite[Direction::LEFT].update(delta);
  
  if (is_walking())
    update_walk(delta);
}
示例#5
0
static void * update_task(void *_path)
{
	const char *path = _path;

	if (path != NULL && *path != 0)
		g_debug("starting: %s", path);
	else
		g_debug("starting");

	modified = update_walk(path, discard);

	if (modified || !db_exists())
		db_save();

	if (path != NULL && *path != 0)
		g_debug("finished: %s", path);
	else
		g_debug("finished");
	g_free(_path);

	progress = UPDATE_PROGRESS_DONE;
	event_pipe_emit(PIPE_EVENT_UPDATE);
	return NULL;
}