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

天行健 君子當自強而不息

Controlling Players and Characters(32)

The cCharController Class

The brains of the character operation is the cCharController class,
which is probably the biggest non-game core class you’ll work with.

The cCharController class maintains a list of active characters, each character
being stored within a sCharacter structure. For each type of character, there is a
matching entry into an array of sMeshAnim structures (and a matching sCharAnimInfo structure).

A macro is defined at the beginning of the Char.h file.

// Number of characters in file
#define NUM_CHARACTER_DEF 256

Following this definition are the macros you’ve already seen—character types, artificial
intelligence types, and status ailments. The macros after that trio are ones you
haven’t seen, but you should understand them by now; they are the actions that a
character can perform (and the matching animations). Take a look at the macros:

// Character types
#define CHAR_PC 0
#define CHAR_NPC 1
#define CHAR_MONSTER 2

// AI types
#define CHAR_STAND 0
#define CHAR_WANDER 1
#define CHAR_ROUTE 2
#define CHAR_FOLLOW 3
#define CHAR_EVADE 4

// Action/Animation types
#define CHAR_IDLE 0
#define CHAR_MOVE 1
#define CHAR_ATTACK 2
#define CHAR_SPELL 3
#define CHAR_ITEM 4
#define CHAR_HURT 5
#define CHAR_DIE 6
#define CHAR_TALK 7

// Status ailments
#define AILMENT_POISON 0x0001
#define AILMENT_SLEEP 0x0002
#define AILMENT_PARALYZE 0x0004
#define AILMENT_WEAK 0x0008
#define AILMENT_STRONG 0x0010
#define AILMENT_ENCHANTED 0x0020
#define AILMENT_BARRIER 0x0040
#define AILMENT_DUMBFOUNDED 0x0080
#define AILMENT_CLUMSY 0x0100
#define AILMENT_SUREFOOTED 0x0200
#define AILMENT_SLOW 0x0400
#define AILMENT_FAST 0x0800
#define AILMENT_BLIND 0x1000
#define AILMENT_HAWKEYE 0x2000
#define AILMENT_SILENCED 0x4000

/************************************************************************************************/

typedef struct sRoutePoint
{
  float pos_x, pos_y, pos_z;
} *sRoutePointPtr;

typedef struct sCharAnimInfo
{
  char name[32]; // name of animation
  bool is_loop;
} *sCharAnimInfoPtr;

From here, it’s all left up to the controller class.

typedef class cCharController
{
private:
    cSpellController*   m_spell_controller;
    cFrustum*           m_frustum;

    
char                m_def_file[MAX_PATH];
    sItem*              m_mil;      
// master item list
    sSpell*             m_msl;      // master spell list

    
long                m_num_char;
    sCharacter*         m_root_char;

    
long                m_num_mesh_anim;
    sMeshAnim*          m_mesh_anim;
    
    
char                m_weapon_mesh_path[MAX_PATH];
    
char                m_texture_path[MAX_PATH];

    
long                m_num_char_anim;
    sCharAnimInfo*      m_char_anim;

    ID3DXFont*          m_font;
    
    
/////////////////////////////////////////////////////////////////////////////////////////////

You use the frustum object as you use the one in the spell controller.
Next comes the filename of the MCL, the pointers to the MIL and MSL, and finally
a pointer to the spell controller.

As characters are added to the game, a counter (m_num_char) keeps track of how
many are in use. Following the counter is the pointer to the parent (root) sCharacter
structure in the linked list of structures:

You use a list of mesh and animation structures much like you use the spell controller.
This time, in addition to storing the texture path, you also create a directory
path where the meshes are located. Why use a mesh directory? In the case of
attaching weapons to a character, the sItem structure stores only the filename, not
the path. This means that weapon meshes must be located in the same directory
as the character meshes.

That wraps up the internal data of the sCharController class. Now, you can turn
your attention to the private functions. You use the first function, get_xz_radius, to calculate
the maximum bounding radius along the X- and Z-axes.

    float get_xz_radius(sCharacter* character)
    {
        
if(character == NULL)
            
return 0.0f;

        
float min_x, max_x, min_z, max_z;
        character->
object.get_bounds(&min_x, NULL, &min_z, &max_x, NULL, &max_z, NULL);

        
float x = max(fabs(min_x), fabs(max_x));
        
float z = max(fabs(min_z), fabs(max_z));

        
return max(x, z);
    }

You use the X/Z radius to enhance the reliability of bounding sphere collision detection.
To see what I mean, take a look at Figure 16.16.

Taller characters in the game have the unfortunate side effect of having large
bounding spheres. To remedy this, only the farthest point of the character in the
X- and Z-axes is used to compute the bounding sphere size, because those two axes
represent the character’s width and depth, not height.

Getting on with the functions, you insert a virtual function that is used to play a sound
effect whenever an action is initiated. It’s your job to derive the cCharController
class in order to override the function to make it do something useful:

virtual void play_action_sound(sCharacter* character)
{
}

posted on 2007-12-04 16:19 lovedday 閱讀(272) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美在线三级| 久久久久久网址| 国产精品久久久久久久久久妞妞| 亚洲免费福利视频| 午夜精品av| 狠狠v欧美v日韩v亚洲ⅴ| 另类图片综合电影| 99精品国产福利在线观看免费| 亚洲男人第一网站| 国产一区二区日韩| 欧美激情精品久久久久久变态| 一区电影在线观看| 久久精品一二三区| 日韩视频中文| 国产性猛交xxxx免费看久久| 男女av一区三区二区色多| 日韩五码在线| 久久综合国产精品| 亚洲一区二区网站| 一区精品久久| 欧美视频日韩视频在线观看| 久久成人亚洲| 一本色道久久综合一区| 麻豆久久婷婷| 亚洲欧美日韩国产成人精品影院| 很黄很黄激情成人| 欧美三级视频在线| 久久女同互慰一区二区三区| 中文亚洲视频在线| 欧美激情第4页| 性色av一区二区三区| 亚洲精品国偷自产在线99热| 国产日韩欧美一区二区| 欧美精品免费看| 欧美制服第一页| 一区二区三区www| 欧美黄色大片网站| 久久精品三级| 午夜欧美精品久久久久久久| 亚洲精品视频免费观看| 激情欧美一区| 国产精品一区免费观看| 欧美日韩第一页| 美国十次了思思久久精品导航| 亚洲一区二区三区色| 亚洲精品乱码久久久久久按摩观| 久久欧美肥婆一二区| 午夜久久福利| 亚洲婷婷国产精品电影人久久| 在线免费观看日本欧美| 国产婷婷一区二区| 国产欧美日韩另类一区| 欧美日韩一卡二卡| 欧美日韩国产大片| 欧美电影免费观看大全| 欧美+日本+国产+在线a∨观看| 欧美一区二区日韩一区二区| 亚洲一区二区三区四区中文 | 欧美国产精品专区| 久久久国产精品亚洲一区| 午夜在线观看免费一区| 夜夜夜久久久| 一本色道精品久久一区二区三区| 亚洲国产另类精品专区| 在线播放豆国产99亚洲| 激情久久久久久久| 在线播放中文字幕一区| 在线成人亚洲| 亚洲国产精品成人一区二区| 亚洲电影免费观看高清完整版在线| 国产在线观看91精品一区| 国产日韩精品入口| 国产一区欧美日韩| 伊人成年综合电影网| 亚洲第一精品久久忘忧草社区| 黑人中文字幕一区二区三区| 在线播放中文字幕一区| 亚洲国内精品在线| 夜夜夜久久久| 亚洲一区二区视频在线| 亚洲欧美另类久久久精品2019| 午夜激情综合网| 久久精品导航| 麻豆成人在线| 亚洲级视频在线观看免费1级| 亚洲日本欧美天堂| 亚洲午夜激情在线| 性色av一区二区三区在线观看| 欧美在线免费| 美日韩精品免费| 欧美人成在线| 国产精品区一区| 狠狠操狠狠色综合网| 亚洲精品日产精品乱码不卡| 中文一区二区| 久久久7777| 亚洲国产成人久久| 在线一区欧美| 久久久www成人免费毛片麻豆| 媚黑女一区二区| 欧美视频在线免费| 好看的日韩av电影| 亚洲伦理精品| 久久精品中文字幕一区| 亚洲福利视频一区| 亚洲免费视频观看| 免费久久99精品国产自在现线| 欧美日在线观看| 激情亚洲一区二区三区四区| 99视频一区| 久久米奇亚洲| 日韩一级片网址| 久久福利视频导航| 欧美三级午夜理伦三级中视频| 狠狠色狠色综合曰曰| 9l国产精品久久久久麻豆| 久久精品亚洲一区二区| 亚洲欧洲日产国产综合网| 午夜久久电影网| 欧美日韩国产va另类| 国产一区自拍视频| 亚洲午夜精品网| 欧美黄网免费在线观看| 西瓜成人精品人成网站| 欧美精品网站| 亚洲福利在线看| 久久精品亚洲一区| 亚洲无线观看| 欧美日韩麻豆| 亚洲精品日产精品乱码不卡| 久久久国产午夜精品| 一区二区三区欧美视频| 欧美大片国产精品| 在线免费观看成人网| 欧美在线观看一二区| 99re6热只有精品免费观看| 免费观看成人| 在线免费观看日本一区| 久久精品国产91精品亚洲| 一区二区日韩| 欧美人与性禽动交情品| 亚洲国产欧美日韩精品| 久热精品视频| 欧美一区深夜视频| 国产精品一区二区三区久久久| 一区二区三区视频在线播放| 亚洲国产你懂的| 免费高清在线视频一区·| 影音先锋亚洲视频| 久久三级福利| 久久精品国产精品| 国内精品亚洲| 久久蜜桃精品| 久久九九久久九九| 韩国一区二区三区美女美女秀| 久久国产精品网站| 欧美一级播放| 国产中文一区| 久久综合网hezyo| 久久久久久91香蕉国产| 国内精品久久久久久久果冻传媒| 久久av一区二区| 午夜精品在线看| 国产资源精品在线观看| 久久久久综合| 久久另类ts人妖一区二区| 在线看成人片| 欧美福利一区二区| 欧美寡妇偷汉性猛交| 亚洲精选91| 99亚洲一区二区| 国产精品午夜春色av| 久久精品成人欧美大片古装| 久久国产精品久久国产精品| 亚洲成人资源| 亚洲人成网站777色婷婷| 欧美精品一区二区三区蜜臀| 一区二区三区四区五区精品视频 | 亚洲国产精品成人久久综合一区| 免费的成人av| 亚洲少妇自拍| 午夜精品久久久久久久99樱桃 | 99精品福利视频| 国产精品日韩在线| 久久午夜激情| 欧美激情精品久久久久久免费印度| 夜夜嗨av一区二区三区中文字幕 | 欧美 日韩 国产 一区| 欧美成人午夜激情| 亚洲一区二区三区久久 | 亚洲日本精品国产第一区| 亚洲另类在线视频| 国产嫩草一区二区三区在线观看| 久久精品伊人| 欧美精品三级| 欧美伊久线香蕉线新在线| 美女精品在线观看| 亚洲一区二区三区高清| 久久精品青青大伊人av| 日韩视频在线永久播放|