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

天行健 君子當自強而不息

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)  編輯 收藏 引用


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


公告

導航

統計

常用鏈接

隨筆分類(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>
            亚洲国产一区二区三区高清| 在线日韩电影| 亚洲午夜精品一区二区三区他趣| 亚洲高清不卡av| 麻豆国产精品一区二区三区| 91久久综合| 亚洲欧洲日夜超级视频| 欧美日韩国产在线| 亚洲综合精品一区二区| 午夜精品视频网站| 亚洲高清视频中文字幕| 亚洲区一区二区三区| 国产精品白丝av嫩草影院| 亚洲欧美在线播放| 久久久亚洲综合| 亚洲免费观看高清在线观看| 亚洲色图综合久久| 狠狠色狠狠色综合日日91app| 欧美激情 亚洲a∨综合| 国产精品99免费看| 久久久久久久综合色一本| 蜜桃精品一区二区三区| 中文在线不卡视频| 欧美在线国产| 一区二区三区av| 欧美在线一级va免费观看| 亚洲美女毛片| 欧美一级午夜免费电影| 99精品国产一区二区青青牛奶 | 亚洲人www| 在线亚洲欧美专区二区| 伊人久久大香线蕉综合热线| 日韩香蕉视频| 一区二区自拍| 亚洲一区二区三区免费在线观看 | 欧美国产亚洲精品久久久8v| 性做久久久久久久免费看| 久久人人爽人人爽| 欧美伊人久久| 欧美日韩在线免费| 免费看亚洲片| 国产欧美日本| 一区二区三区国产| 亚洲免费成人| 毛片一区二区三区| 久久久成人精品| 欧美色视频一区| 亚洲国产精品电影| 精品999在线播放| 亚洲欧美日本在线| 亚洲欧美偷拍卡通变态| 欧美精品一区二区三| 欧美成人综合网站| 精品va天堂亚洲国产| 亚洲男人的天堂在线观看| 在线视频一区观看| 欧美国产亚洲另类动漫| 欧美不卡一卡二卡免费版| 国产精品综合| 亚洲欧美另类在线| 午夜精品一区二区三区电影天堂 | 欧美天堂在线观看| 亚洲欧洲一级| 日韩午夜视频在线观看| 免费人成精品欧美精品| 久久综合九色99| 国产一区亚洲一区| 久久激情婷婷| 猛干欧美女孩| 亚洲国产精品va在线看黑人动漫 | 亚洲一区免费观看| 亚洲视频在线看| 国产精品xxxav免费视频| aaa亚洲精品一二三区| 亚洲一级免费视频| 国产精品系列在线| 欧美一二三区精品| 欧美成人xxx| 99成人免费视频| 欧美日韩裸体免费视频| 亚洲午夜激情在线| 久久国产日韩欧美| 在线观看成人av电影| 免费欧美在线视频| 99视频有精品| 久久精品国产99精品国产亚洲性色| 国产农村妇女精品一区二区| 久久成人18免费观看| 欧美风情在线| 亚洲一区二区黄色| 国产色产综合产在线视频| 久久国产乱子精品免费女| 欧美国产日产韩国视频| 亚洲天堂av在线免费| 国产欧美日韩在线| 欧美成人精品在线观看| 亚洲午夜免费福利视频| 久久婷婷激情| 日韩一级免费观看| 国产欧美日韩在线视频| 美日韩在线观看| 亚洲午夜视频在线| 欧美1区2区视频| 亚洲综合成人在线| 亚洲大片av| 国产精品视频大全| 女人色偷偷aa久久天堂| 亚洲免费在线视频| 亚洲国产网站| 久久久久久久高潮| 夜夜嗨av一区二区三区免费区| 国产欧美日韩高清| 欧美日韩系列| 久久久水蜜桃| 亚洲女同精品视频| 91久久亚洲| 玖玖玖国产精品| 亚洲欧美一区二区在线观看| 亚洲人被黑人高潮完整版| 国产日韩欧美91| 欧美日韩国产色站一区二区三区| 久久超碰97人人做人人爱| 国产精品99久久久久久www| 欧美激情第9页| 久久午夜色播影院免费高清| 亚洲欧美激情在线视频| 91久久精品一区二区别| 一区二区三区我不卡| 国产精品私房写真福利视频| 欧美日韩国产成人在线| 麻豆精品精华液| 久久在线视频在线| 久久久精品tv| 久久国产精品99精品国产| 亚洲在线观看视频| 亚洲一二三四久久| 亚洲免费高清| 999在线观看精品免费不卡网站| 欧美高清一区| 欧美激情一区二区三区全黄 | 亚洲日本久久| 伊甸园精品99久久久久久| 国产欧美日韩一区二区三区在线观看| 欧美日韩一二三区| 欧美美女bb生活片| 欧美精品免费观看二区| 免费中文日韩| 欧美激情第8页| 欧美日产一区二区三区在线观看 | 欧美精品在线视频| 欧美jjzz| 欧美日韩国内| 国产精品黄色在线观看| 国产精品久久久一区麻豆最新章节| 欧美视频一区| 国产精品一区亚洲| 国产亚洲激情| 亚洲福利视频二区| 99精品免费网| 亚洲欧美一区二区激情| 欧美影院视频| 久久综合网色—综合色88| 麻豆成人91精品二区三区| 欧美在线国产精品| 久久综合999| 亚洲欧洲日产国产网站| 一区二区三区精品在线| 亚洲欧美在线观看| 久久久亚洲高清| 欧美日韩国产免费观看| 国产精品欧美久久| 红桃视频欧美| 一区二区三区 在线观看视| 欧美亚洲一区二区在线| 久久亚洲高清| 亚洲老板91色精品久久| 校园激情久久| 欧美第一黄色网| 国产精品久久久久久av福利软件 | …久久精品99久久香蕉国产 | 国产精品久久久久aaaa| 国产亚洲毛片| 亚洲乱码国产乱码精品精天堂| 亚洲欧美成aⅴ人在线观看| 另类av一区二区| 99精品福利视频| 久久精品中文| 欧美天堂亚洲电影院在线播放| 国产亚洲一级| 亚洲一区二区欧美| 欧美国产第一页| 午夜精品99久久免费| 欧美日本精品| 精品999网站| 欧美亚洲系列| 日韩一本二本av| 欧美成人免费播放| 永久555www成人免费| 午夜一区二区三区在线观看| 91久久久久久国产精品|