• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_action函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_action函数的典型用法代码示例。如果您正苦于以下问题:C++ set_action函数的具体用法?C++ set_action怎么用?C++ set_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_action函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: do_action

static void do_action(struct Player *pp, Action ac)
{
    Action pre_action;
    pre_action = previous_action(pp);
    int pre_frame = pre_action.frame;
    int nframe;

    if (equal_action(pre_action, ac))
    {
        nframe = next_frame(pp, ac, pre_frame);
        set_frame(pp, nframe);
        complete_action(pp);
    }
    else if (pre_frame != 0)    // previous action unfinished
    {
        if (action_interruptable(pre_action))
        {
            set_action(pp, ac);
            complete_action(pp); //pp->spd = spd;
        }
        else
            do_action(pp, pre_action);
    }
    else          // previous action finished, set new action
    {
        set_action(pp, ac);
       complete_action(pp);
    }
}
开发者ID:AndySpider,项目名称:freesoccer,代码行数:29,代码来源:actions.c


示例2: set_vy

void Player::set_jump(Map *map, bool catapult)
{
    m_media->play_sound("jump.wav");

    if (m_in_water) {
        if (catapult) {
            set_vy(-get_attribute("water_catapult_speed"));
            set_action(Catapult);
        }
        else {
            set_vy(-get_attribute("water_jump_speed"));
            set_action(Jump);
        }
    }
    else {
        if (catapult) {
            set_vy(-get_attribute("catapult_speed"));
            set_action(Catapult);
        }
        else {
            set_vy(-get_attribute("jump_speed"));
            set_action(Jump);
        }
    }

    m_hit_ground = false;
}
开发者ID:surdeg,项目名称:dragonscurse,代码行数:27,代码来源:player.cpp


示例3: do_add_proc

/*
 * activate the add point item in the canvas event proc
 */
static void do_add_proc(void *data)
{
    char *s;

    set_action(DO_NOTHING);

    track_add_at = (int) data;

    switch (track_add_at) {
    case ADD_POINT_BEGINNING:
        s = "Add points at the beginning of set";
        break;
    case ADD_POINT_END:
        s = "Add points to the end of set";
        break;
    case ADD_POINT_NEAREST:
        s = "Add points to the nearest position";
        break;
    default:
        return;
    }

    SetLabel(locate_point_message, s);

    set_action(ADD_POINT);
}
开发者ID:astrotycoon,项目名称:grace,代码行数:29,代码来源:ptswin.c


示例4: _learning_spell

void _learning_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Learning");
        break;
    case SPELL_DESC:
        var_set_string(res, "");
        break;
    case SPELL_CAST:
        if (p_ptr->action == ACTION_LEARN)
            set_action(ACTION_NONE);
        else
            set_action(ACTION_LEARN);
        var_set_bool(res, TRUE);
        break;
    case SPELL_ENERGY:
        var_set_int(res, 0);
        break;
    default:
        default_spell(cmd, res);
        break;
    }
}
开发者ID:MichaelDiBernardo,项目名称:poschengband,代码行数:25,代码来源:blue_mage.c


示例5: do_ptsmove_proc

/*
 * move a point
 */
static void do_ptsmove_proc(void *data)
{
    char *s;
    
    set_action(DO_NOTHING);

    track_move_dir = (int) data;

    switch (track_move_dir) {
    case MOVE_POINT_XY:
        s = "Move points";
        break;
    case MOVE_POINT_X:
        s = "Move points along x";
        break;
    case MOVE_POINT_Y:
        s = "Move points along y";
        break;
    default:
        return;
    }
    SetLabel(locate_point_message, s);

    set_action(MOVE_POINT1ST);
}
开发者ID:astrotycoon,项目名称:grace,代码行数:28,代码来源:ptswin.c


示例6: change_selection

//範囲を選択しているかどうかの状態が変わったときの動作
void change_selection(void)
{
    gboolean flag = gtk_text_buffer_get_has_selection(GTK_TEXT_BUFFER(buffer));
    
    set_action("Cut", flag);
    set_action("Copy", flag);
    set_action("Delete", flag);
}
开发者ID:kawatea,项目名称:cedit,代码行数:9,代码来源:menu_edit.c


示例7: signal_setup

void
signal_setup()
{
	set_action(SIGABRT, act_sig_handle_abort);
	set_action(SIGBUS, act_sig_handle_bus);
	set_action(SIGFPE, act_sig_handle_fpe);
	set_action(SIGILL, act_sig_handle_ill);
	set_action(SIGSEGV, act_sig_handle_segv);
}
开发者ID:aerospike,项目名称:act,代码行数:9,代码来源:trace.c


示例8: if

void
WalkingBadguy::active_update(float elapsed_time, float dest_x_velocity)
{
  BadGuy::active_update(elapsed_time);

  float current_x_velocity = physic.get_velocity_x ();

  if (frozen)
  {
    physic.set_velocity_x (0.0);
    physic.set_acceleration_x (0.0);
  }
  /* We're very close to our target speed. Just set it to avoid oscillation */
  else if ((current_x_velocity > (dest_x_velocity - 5.0))
      && (current_x_velocity < (dest_x_velocity + 5.0)))
  {
    physic.set_velocity_x (dest_x_velocity);
    physic.set_acceleration_x (0.0);
  }
  /* Check if we're going too slow or even in the wrong direction */
  else if (((dest_x_velocity <= 0.0) && (current_x_velocity > dest_x_velocity))
      || ((dest_x_velocity > 0.0) && (current_x_velocity < dest_x_velocity)))
  {
    /* acceleration == walk-speed => it will take one second to get from zero
     * to full speed. */
    physic.set_acceleration_x (dest_x_velocity);
  }
  /* Check if we're going too fast */
  else if (((dest_x_velocity <= 0.0) && (current_x_velocity < dest_x_velocity))
      || ((dest_x_velocity > 0.0) && (current_x_velocity > dest_x_velocity)))
  {
    /* acceleration == walk-speed => it will take one second to get twice the
     * speed to normal speed. */
    physic.set_acceleration_x ((-1.f) * dest_x_velocity);
  }
  else
  {
    /* The above should have covered all cases. */
    assert (23 == 42);
  }

  if (max_drop_height > -1) {
    if (on_ground() && might_fall(max_drop_height+1))
    {
      turn_around();
    }
  }

  if ((dir == LEFT) && (physic.get_velocity_x () > 0.0)) {
    dir = RIGHT;
    set_action (walk_right_action, /* loops = */ -1);
  }
  else if ((dir == RIGHT) && (physic.get_velocity_x () < 0.0)) {
    dir = LEFT;
    set_action (walk_left_action, /* loops = */ -1);
  }
}
开发者ID:brmbrmcar,项目名称:supertux,代码行数:57,代码来源:walking_badguy.cpp


示例9: set_action

void Actor::reset_attack()
{
    if (m_action == AttackLow) {
        set_action(Crouch);
    }
    else {
        set_action(Still);
    }
}
开发者ID:surdeg,项目名称:dragonscurse,代码行数:9,代码来源:actor.cpp


示例10: set_action

void Actor::set_attack(void)
{
    if (m_action == Crouch) {
        set_action(LowAttack);
    }
    else {
        set_action(MediumAttack);
    }
    set_vx(0);
}
开发者ID:gamegod,项目名称:dragonscurse,代码行数:10,代码来源:actor.cpp


示例11: set_buttn

static int set_buttn(int b, int d)
{
    if (d)
    {
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
            return set_action(gui_token(gui_click()));
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
            return set_action(GUI_BACK);
    }
    return 1;
}
开发者ID:MasaMune692,项目名称:alcexamples,代码行数:11,代码来源:st_set.c


示例12: set_ay

void Monster::move(Map *map)
{
    set_ay(get_attribute("weight"));

    switch(m_action) {
        case Still:
            break;

        case Move:
            Body::move(map);
            if (get_fall()) {
                set_action(Fall);
            }
            break;

        case Fall:
            Body::move(map);
            if (!get_fall()) {
                m_hit_ground = true;
                set_vx(0);
                set_action(Still);
            }
            break;

        case Jump:
            Body::move(map);
            if (get_fall()) {
                set_action(Still);
            }
            break;

        case Hit:
            if (m_hit == HitPerish) {
                set_vx(0);
                if (m_perish_timer.expired(get_attribute("perish_time"))) {
                    m_hit = HitPerished;
                }
            }
            else if (m_hit_timer.expired(get_attribute("hit_time"))) {
                m_hit_timer.reset();
                set_vx(0);
                set_lock_direction(false);
                m_hit = HitNone;
                set_action(Still);
            }
            Body::move(map);
            break;

        default:
            break;
    }
}
开发者ID:johnwilson69,项目名称:dragonscurse,代码行数:52,代码来源:monster.cpp


示例13: do_cmd_refill

/*
 * Refill the players lamp, or restock his torches
 */
void do_cmd_refill(void)
{
    int slot = equip_find_object(TV_LITE, SV_ANY);

    if (slot)
    {
        object_type *o_ptr = equip_obj(slot);

        if (p_ptr->special_defense & KATA_MUSOU)
            set_action(ACTION_NONE);

        switch (o_ptr->sval)
        {
        case SV_LITE_LANTERN:
            do_cmd_refill_lamp(o_ptr);
            break;
        case SV_LITE_TORCH:
            do_cmd_refill_torch(o_ptr);
            break;
        default:
            msg_print("Your light cannot be refilled.");
        }
    }
    else
        msg_print("You are not wielding a light.");
}
开发者ID:NickMcConnell,项目名称:poschengband,代码行数:29,代码来源:cmd3.c


示例14: switch

void Walker::move(Map *map)
{
    Monster::move(map);

    switch(m_action) {
        case Still:
            set_action(Move);
            break;

        case Move:
            if (check_ahead(map)) {
                swap_move_dir();
            }

            if (m_dir == Right) {
                set_vx(get_attribute("move_speed"));
            }
            else {
                set_vx(-get_attribute("move_speed"));
            }
            animate_move();
            break;

        default:
            break;
    }

}
开发者ID:baijkal,项目名称:dragonscurse,代码行数:28,代码来源:walker.cpp


示例15: kill_fall

bool
Haywire::collision_squished(GameObject& object)
{
  Player* player = dynamic_cast<Player*>(&object);
  if (player && player->is_invincible()) {
    player->bounce (*this);
    kill_fall();
    return true;
  }

  if (is_stunned) {
    player->bounce (*this);
    return true;
  }

  if (!is_exploding) {
    set_action ((dir == LEFT) ? "ticking-left" : "ticking-right", /* loops = */ -1);
    walk_left_action = "ticking-left";
    walk_right_action = "ticking-right";
    set_walk_speed (160);
    time_until_explosion = TIME_EXPLOSION;
    is_exploding = true;
  }

  time_stunned = TIME_STUNNED;
  is_stunned = true;

  player->bounce (*this);
  return true;
}
开发者ID:AndroidAppList,项目名称:Android-Supertux,代码行数:30,代码来源:haywire.cpp


示例16: GOOGLE_CHECK_NE

void RceUpdateProfile::MergeFrom(const RceUpdateProfile& from) {
  GOOGLE_CHECK_NE(&from, this);
  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (from._has_bit(0)) {
      mutable_transaction()->::MsgTransaction::MergeFrom(from.transaction());
    }
    if (from._has_bit(1)) {
      set_sku(from.sku());
    }
    if (from._has_bit(2)) {
      set_value(from.value());
    }
    if (from._has_bit(3)) {
      set_key(from.key());
    }
    if (from._has_bit(4)) {
      set_planetid(from.planetid());
    }
    if (from._has_bit(5)) {
      set_action(from.action());
    }
    if (from._has_bit(6)) {
      set_level(from.level());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
开发者ID:CrazyPro,项目名称:ape,代码行数:27,代码来源:RceUpdateProfile.pb.cpp


示例17: item_at

void map_t::way_node_add(lpos_t pos) {
  /* check if we are still hovering above the selected way */
  map_item_t *item = item_at(pos);
  if(item_is_selected_way(item)) {
    /* convert mouse position to canvas (world) position */
    const int insert_after = canvas->get_item_segment(item->item, pos);
    if(insert_after >= 0) {
      /* insert it into ways chain of nodes */
      way_t *way = item->object.way;

      /* create new node */
      node_t* node = way->insert_node(appdata.project->osm, insert_after + 1, pos);

      /* clear selection */
      item_deselect();

      /* draw the updated way */
      draw(way);

      /* and now draw the node */
      draw(node);

      /* put gui into idle state */
      set_action(MAP_ACTION_IDLE);

      /* and redo it */
      select_way(way);
    }
  }
}
开发者ID:AMDmi3,项目名称:osm2go,代码行数:30,代码来源:map_edit.cpp


示例18: get_model

// -------------------------------------------------------------
// animated, mobile object for adventure map
// -------------------------------------------------------------
void t_actor::on_model_changed()
{
	t_model const& model = get_model();

	t_abstract_adv_actor::on_model_changed();
	set_action( m_action );
}
开发者ID:sundoom,项目名称:sunstudio,代码行数:10,代码来源:actor.cpp


示例19: scaleCR

STATIC MYBOOL scaleCR(lprec *lp, REAL *scaledelta)
{
  REAL *scalechange = NULL;
  int  Result;

  if(!lp->scaling_used) {
    allocREAL(lp, &lp->scalars, lp->sum_alloc + 1, FALSE);
    for(Result = 0; Result <= lp->sum; Result++)
      lp->scalars[Result] = 1;
    lp->scaling_used = TRUE;
  }

  if(scaledelta == NULL)
    allocREAL(lp, &scalechange, lp->sum + 1, FALSE);
  else
    scalechange = scaledelta;

  Result=CurtisReidScales(lp, FALSE, scalechange, &scalechange[lp->rows]);
  if(Result>0) {

    /* Do the scaling*/
    if(scale_updaterows(lp, scalechange, TRUE) ||
       scale_updatecolumns(lp, &scalechange[lp->rows], TRUE))
      lp->scalemode |= SCALE_CURTISREID;

    set_action(&lp->spx_action, ACTION_REBASE | ACTION_REINVERT | ACTION_RECOMPUTE);
  }

  if(scaledelta == NULL)
    FREE(scalechange);

  return((MYBOOL) (Result > 0));
}
开发者ID:Akryum,项目名称:polytech-opti,代码行数:33,代码来源:lp_scale.c


示例20: get_attribute

void MekaDragon::fire()
{
    if (m_fire_timer.expired(get_attribute("fire_next"))) {
        if (m_bullet_index < m_bullets.size()) {
            if (m_dir == Right) {
                m_bullets[m_bullet_index]->fire(
                    m_x + get_attribute("attack_right"),
                    m_y + get_attribute("attack_medium"),
                    get_attribute("fire_dx"),
                    get_attribute("fire_dy"));
            }
            else if (m_dir == Left) {
                m_bullets[m_bullet_index]->fire(
                    m_x + get_attribute("attack_left"),
                    m_y + get_attribute("attack_medium"),
                    -get_attribute("fire_dx"),
                    get_attribute("fire_dy"));
            }
            m_bullet_index++;
        }
        else {
            m_bullet_index = 0;
            m_idle_timer.reset();
            set_action(Move);
            reset_attack();
        }
    }
}
开发者ID:surdeg,项目名称:dragonscurse,代码行数:28,代码来源:meka_dragon.cpp



注:本文中的set_action函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_active函数代码示例发布时间:2022-05-30
下一篇:
C++ set_a2bus_device函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap