当前位置: 首页>>代码示例>>C++>>正文


C++ set_action函数代码示例

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


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


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