青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

Controlling Players and Characters(40)

Things are winding down with the controller at this point. You use the following
functions to equip, use, and drop an item:

bool cCharController::equip(sCharacter* character, long item_index, long equip_type, bool equip_now)
{
    
if(m_mil == NULL || character == NULL)
        
return false;

    
// make sure allow equiping of item
    if(! check_bit(m_mil[item_index].usage, character->char_def.class_index))
        
return false;

    
// remove current item first and equip new one
    switch(equip_type)
    {
    
case WEAPON:
        character->char_def.weapon = -1;
        character->weapon_mesh.free();

        
if(equip_now && m_mil[item_index].category == WEAPON)
        {
            character->char_def.weapon = item_index;

            
if(m_mil[item_index].mesh_filename)
            {
                
char path[MAX_PATH];
                sprintf(path, "%s%s", m_weapon_mesh_path, m_mil[item_index].mesh_filename);

                character->weapon_mesh.load(path, m_texture_path);
                character->weapon_object.create(&character->weapon_mesh);
                character->weapon_object.attach_to_object(&character->
object, "WeaponHand");
            }
        }

        
break;

    
case ARMOR:
        character->char_def.armor = -1;

        
if(equip_now && m_mil[item_index].category == ARMOR)
            character->char_def.armor = item_index;

        
break;

    
case SHIELD:
        character->char_def.shield = -1;

        
if(equip_now && m_mil[item_index].category == SHIELD)
            character->char_def.shield = item_index;

        
break;

    
case ACCESSORY:
        character->char_def.accessory = -1;

        
if(equip_now && m_mil[item_index].category == ACCESSORY)
            character->char_def.accessory = item_index;

        
break;

    
default:
        
return false;
    }

    
return true;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

void cCharController::use_item(sCharacter* owner, sCharacter* target, 
                               
long item_index, sCharItem* char_item)
{
    
if(owner == NULL || target == NULL || m_mil == NULL)
        
return;

    sItem* item = &m_mil[item_index];

    
// make sure allow to use of item
    if(! check_bit(item->usage, target->char_def.class_index))
        
return;

    
// use specified item
    switch(item->category)
    {
    
case EDIBLE:
    
case HEALING:   // alter health
        target->health_points += item->value;
        
break;
    }

    
// decrease quantity and remove object if needed
    if(check_bit(item->flags, USEONCE) && char_item)
    {
        char_item->quantity--;

        
if(char_item->quantity <= 0 && owner->char_ics)
            owner->char_ics->remove(char_item);
    }
}

///////////////////////////////////////////////////////////////////////////////////////////////////

bool cCharController::drop(sCharacter* character, sCharItem* char_item, long quantity)
{
    
if(char_item == NULL || m_mil == NULL || character == NULL)
        
return false;

    
// make sure item can be dropped
    if(! check_bit(m_mil[char_item->item_index].flags, CANDROP))
        
return false;

    char_item->quantity -= quantity;

    
// remove item from ics if no more left
    if(char_item->quantity <= 0 && character->char_ics)
        character->char_ics->remove(char_item);

    
return true;
}

With equip, you must specify the character to modify and the item number (from
the MIL) of the item being equipped. You use the equip_type argument to specify which
item type to equip (WEAPON, ARMOR, SHIELD, or ACCESSORY) and the equip_now flag to tell the
controller to equip the specified item (set equip_now to true) or just to unequip the currently
used item (by setting equip_now to false).

As for the use item function (use_item), two characters are required: the owner of the
item and the character on which the item is being used. In that way, one character
can use a healing potion on another character. Specify the MIL item number being
used, as well as a pointer to the owner’s ICS char_item structure so that the quantity
of the item can be decreased.

The next function is required to process the teleport spell effect on PCs. Whenever a
teleport spell is used on a PC, the character controller calls the following function to
handle the effects. Both the pointer to the target character and spell structure are
passed:

virtual bool pc_teleport(sCharacter* character, const sSpell* spell)
{
  return true;
}

Finishing up the character controller class functions is the one that is responsible
for preparing a character to perform an action. You use this function mostly when
controlling your PC via the pc_update function:

    void set_char_action(sCharacter* character, long action, long action_timer)
    {
        
if(character == NULL)
            
return;

        
// make sure attack, spell, and item supporting charge.
        if(action == CHAR_ATTACK || action == CHAR_SPELL || action == CHAR_ITEM)
        {
            
if(character->charge < 100.0f)
                
return;
        }

        character->action = action;
        play_action_sound(character);

        
long mesh_index = character->char_def.mesh_index;

        
// set action timer
        if(action_timer == -1)
            character->action_timer = 1;
        
else
        {
            
ulong anim_length = m_mesh_anim[mesh_index].anim.get_time_length(m_char_anim[action].name);
            character->action_timer = action_timer + anim_length * 30;
        }
    }

When a PC (or any character for that matter) does something, a matching action is
performed. Walking is an action, attacking is an action, and so on. Previously, actions
were defined as CHAR_IDLE, CHAR_MOVE, CHAR_ATTACK, and so on, for example. You need to
set the action argument to one of those values in order to initiate a character action.

For each action that a character can perform, there is a matching animation in the
sCharAnimInfo structure array used to initialize the controller. When a character
performs an action, the appropriate animation is set, as well as the action timer
used to count down the time until the animation is complete. Remember that no
further actions can be performed until the current action is complete.

The last argument in the list, add_timer, is used to add additional milliseconds to the
action timer. Specifying a value of -1 for add_timer, forces set_char_action to not use the
action timer, which means that the action clears on the next update.

posted on 2007-12-04 20:13 lovedday 閱讀(223) 評論(0)  編輯 收藏 引用

公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            9i看片成人免费高清| 日韩天堂av| 久久免费偷拍视频| 欧美一区二区私人影院日本| 国产亚洲欧美激情| 麻豆国产精品777777在线 | 亚洲午夜黄色| 亚洲一区二区三区777| 国产啪精品视频| 免费看的黄色欧美网站| 欧美黄色视屏| 欧美一区二区成人| 久久综合久久久| 日韩午夜av| 亚洲欧美日韩在线不卡| 亚洲第一精品影视| 亚洲美女中文字幕| 国产一区二区三区在线观看视频| 模特精品在线| 国产精品视频观看| 欧美高清视频在线| 国产精品毛片大码女人| 免费观看国产成人| 国产精品毛片| 亚洲电影第1页| 国产精品视频导航| 亚洲第一级黄色片| 国产一区二区三区在线观看视频| 亚洲国产精品福利| 国产一区二区三区高清| 亚洲精品国精品久久99热一| 国产日韩精品久久| 一本色道久久综合亚洲精品按摩| 国产一区日韩二区欧美三区| 日韩视频永久免费| 亚洲国产天堂网精品网站| 午夜精品久久久久久久久| 99亚洲一区二区| 久久香蕉国产线看观看网| 欧美一区影院| 欧美三级电影网| 亚洲黄色在线视频| 精品动漫一区| 亚洲天堂网在线观看| 亚洲精选91| 久久国产精品久久久久久久久久| 亚洲春色另类小说| 欧美一区二区三区视频在线| 亚洲无线视频| 国产自产精品| 一本色道久久88精品综合| 亚洲精品一区中文| 亚洲性色视频| 欧美在线999| 亚洲一区美女视频在线观看免费| 欧美阿v一级看视频| 亚洲欧洲偷拍精品| 欧美一区二区精品在线| 亚洲综合电影| 午夜欧美精品| 免费毛片一区二区三区久久久| 欧美一区二区黄| 国产情侣久久| 亚洲永久精品大片| 亚洲欧美激情视频| 国产精品有限公司| 亚洲欧美日韩网| 久久久综合网站| 伊人成年综合电影网| 久久久精品国产免大香伊| 玖玖综合伊人| 亚洲精品欧洲精品| 欧美乱在线观看| 99亚洲视频| 欧美一区二区三区在线观看| 国产日韩欧美中文| 久久久噜噜噜久久中文字免| 欧美激情黄色片| 夜夜夜久久久| 国产精品一区二区三区成人| 欧美一区二区三区喷汁尤物| 免费观看欧美在线视频的网站| 亚洲精品护士| 国产精品免费小视频| 欧美在线观看视频| 亚洲高清视频在线| 性做久久久久久免费观看欧美| 国产在线播精品第三| 欧美jizzhd精品欧美巨大免费| 亚洲免费精品| 久久人人97超碰国产公开结果| 亚洲第一区在线观看| 欧美日韩国产一中文字不卡| 亚洲欧美卡通另类91av| 欧美96在线丨欧| 亚洲视频精选| 在线观看免费视频综合| 欧美日韩精品三区| 久久精品一区| 夜色激情一区二区| 老司机午夜免费精品视频 | 久久久久免费视频| 亚洲毛片在线| 快播亚洲色图| 亚洲欧美春色| 亚洲美女精品一区| 国模精品一区二区三区| 欧美人成网站| 久久男女视频| 校园激情久久| 一区二区欧美在线| 欧美黄色片免费观看| 欧美呦呦网站| 亚洲午夜视频| 亚洲精品1234| 国内一区二区三区| 欧美视频福利| 欧美成人亚洲| 久久九九免费视频| 亚洲天堂视频在线观看| 亚洲日本免费| 毛片一区二区| 久久久久国产精品厨房| 亚洲一区影院| 宅男噜噜噜66国产日韩在线观看| 精品不卡在线| 黄色成人在线观看| 国产欧美精品| 国产女人水真多18毛片18精品视频| 欧美久久婷婷综合色| 鲁大师成人一区二区三区| 久久精品国产69国产精品亚洲| 亚洲永久精品国产| 亚洲一区国产精品| 亚洲永久网站| 亚洲欧美在线网| 小黄鸭精品密入口导航| 亚洲女人天堂成人av在线| 一区二区三区四区五区精品视频| 亚洲人午夜精品免费| 亚洲欧洲偷拍精品| 亚洲免费电影在线观看| 一区二区三区黄色| 亚洲特黄一级片| 亚洲免费视频一区二区| 亚洲一区视频在线| 午夜久久黄色| 久久精品国产欧美激情| 久久一区二区三区国产精品 | 亚洲欧美中文日韩v在线观看| 亚洲一二三区在线观看| 亚洲欧美日韩另类| 欧美在线免费观看| 久久久777| 欧美理论在线| 国产精品狼人久久影院观看方式| 国产欧美日韩视频一区二区三区| 国产嫩草一区二区三区在线观看| 国产欧美日韩不卡| 雨宫琴音一区二区在线| 亚洲精品一区二| 亚洲免费一级电影| 久久久成人精品| 亚洲激情专区| 亚洲一区二区免费在线| 欧美在线日韩| 欧美精品激情| 国产精品一区二区男女羞羞无遮挡| 国产一区二区三区在线观看免费视频| 伊人天天综合| 一区二区三区免费网站| 香蕉久久国产| 欧美福利专区| 亚洲你懂的在线视频| 六月婷婷久久| 国产精品天美传媒入口| 亚洲成人影音| 亚洲欧美偷拍卡通变态| 美日韩精品视频免费看| 一本大道久久a久久精二百| 欧美一区二区精品| 欧美日韩成人综合天天影院| 国产精品午夜视频| 亚洲人成在线观看| 久久国产精品电影| 日韩一区二区高清| 美日韩在线观看| 国产精品中文在线| 夜夜嗨av色综合久久久综合网 | 亚洲精品看片| 久久久噜噜噜| 亚洲色图制服丝袜| 欧美国产激情| 激情欧美日韩| 午夜精品电影| 亚洲理论在线| 欧美电影免费观看大全| 国外精品视频| 久久久999国产| 午夜精品久久久|