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

天行健 君子當自強而不息

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>
            欧美在线视频观看免费网站| 午夜亚洲激情| 久久午夜视频| 亚洲韩国一区二区三区| 亚洲第一精品夜夜躁人人爽 | 久久视频精品在线| 欧美一区二区三区四区夜夜大片| 国产精品午夜在线观看| 久久久国产精彩视频美女艺术照福利| 欧美一激情一区二区三区| 国产亚洲激情视频在线| 欧美 日韩 国产精品免费观看| 免费在线国产精品| 一区二区日韩免费看| 亚洲自拍偷拍麻豆| 国产专区欧美精品| 亚洲激情小视频| 国产精品日韩欧美一区二区| 美女视频黄 久久| 欧美日韩免费一区二区三区视频| 亚洲欧美日韩在线| 美女主播精品视频一二三四| 亚洲午夜在线| 久久久亚洲精品一区二区三区 | 国产精品亚洲欧美| 牛牛国产精品| 国产精品久久久久久五月尺| 久久中文久久字幕| 欧美经典一区二区| 久久一区二区三区国产精品 | 免费在线成人| 欧美在线日韩| 欧美日韩国产首页在线观看| 久久久久久久久蜜桃| 欧美日韩高清在线观看| 久久夜色精品国产亚洲aⅴ| 欧美日韩国产成人在线91| 久久精品视频亚洲| 欧美视频中文字幕在线| 欧美.日韩.国产.一区.二区| 国产精品久久久久久久久搜平片| 欧美激情久久久| 国产一区二区三区丝袜| 中日韩美女免费视频网站在线观看| 1769国内精品视频在线播放| 香港久久久电影| 亚洲男人第一网站| 欧美精品福利| 亚洲国产成人久久综合一区| 狠狠色丁香久久婷婷综合丁香| 99精品视频免费| 99这里只有久久精品视频| 老司机午夜精品视频| 久久蜜桃精品| 国内揄拍国内精品久久| 亚洲欧美在线高清| 亚洲欧美日韩在线观看a三区| 欧美绝品在线观看成人午夜影视| 久热精品视频在线免费观看| 国产午夜精品美女视频明星a级| 在线一区免费观看| 亚洲欧美大片| 国产精品网站一区| 亚洲综合精品一区二区| 欧美一区二区在线免费播放| 国产精品三上| 亚洲欧美日韩在线一区| 欧美一区二区三区视频免费| 国产精品久久久久久久9999| 亚洲小说欧美另类社区| 亚洲欧美日韩另类| 国产欧美日韩综合一区在线观看 | 国产婷婷精品| 欧美一区二区三区视频在线观看| 久久成人精品无人区| 国产日韩欧美中文| 久久婷婷久久| 最新日韩欧美| 亚洲一区欧美二区| 国产小视频国产精品| 欧美在线精品一区| 欧美激情免费观看| 国产精品99久久久久久有的能看| 欧美日韩一级片在线观看| 一本大道久久精品懂色aⅴ| 亚洲在线一区二区三区| 国产主播喷水一区二区| 另类尿喷潮videofree| 日韩视频免费观看| 久久精品国产亚洲精品| 在线观看成人av电影| 欧美伦理一区二区| 亚洲女女女同性video| 男人的天堂成人在线| 亚洲婷婷免费| 影音先锋中文字幕一区二区| 欧美www视频| 亚洲欧美另类国产| 亚洲福利电影| 欧美一区二视频在线免费观看| 怡红院av一区二区三区| 欧美性猛交一区二区三区精品| 亚洲男人第一网站| 欧美韩日一区二区三区| 午夜精品亚洲一区二区三区嫩草| 国产真实久久| 欧美性猛交xxxx乱大交退制版| 久久久久久综合网天天| 99国内精品久久| 美女视频黄a大片欧美| 亚洲中字在线| 亚洲美女毛片| 在线不卡中文字幕播放| 国产精品亚洲第一区在线暖暖韩国| 久久资源av| 欧美伊人影院| 亚洲视频导航| 亚洲精品美女在线观看| 久久这里只精品最新地址| 亚洲自拍16p| 日韩一级成人av| 伊人久久亚洲热| 国产日韩精品视频一区| 欧美系列一区| 欧美日韩成人综合在线一区二区| 久久久久久69| 午夜精品美女久久久久av福利| 日韩一级免费| 亚洲欧洲日本在线| 亚洲国产精品久久人人爱蜜臀 | 亚洲精品精选| 欧美国产精品v| 久久人人九九| 久久婷婷av| 久久久综合网| 久久久久久国产精品mv| 久久aⅴ国产紧身牛仔裤| 亚洲一区三区在线观看| 亚洲午夜精品久久| 一区二区三区毛片| 99ri日韩精品视频| 99成人在线| 中日韩视频在线观看| 99热这里只有精品8| 99av国产精品欲麻豆| 99精品国产福利在线观看免费 | 最新热久久免费视频| 亚洲国产高清高潮精品美女| 韩日成人在线| 在线日本欧美| 亚洲黄色一区| 亚洲剧情一区二区| 亚洲视频第一页| 亚洲欧美日韩在线一区| 久久国产精彩视频| 久久久国产一区二区| 美女网站在线免费欧美精品| 欧美gay视频激情| 亚洲电影免费观看高清完整版在线观看| 欧美1区2区3区| 亚洲精品久久久久中文字幕欢迎你 | 狠狠色狠狠色综合| 亚洲国产精品一区在线观看不卡| 亚洲黄色成人网| 亚洲视频你懂的| 欧美专区在线播放| 老巨人导航500精品| 亚洲国产第一页| 99精品国产热久久91蜜凸| 亚洲在线成人| 久热这里只精品99re8久| 欧美精品尤物在线| 国产精品亚洲аv天堂网| 一区二区亚洲精品| 国产精品99久久99久久久二8| 午夜国产精品视频| 麻豆成人在线播放| 在线视频你懂得一区| 久久久久成人网| 欧美日韩三级| 在线播放中文字幕一区| 亚洲一区国产| 久久三级福利| 亚洲视频欧美视频| 久久综合伊人77777| 国产精品国产亚洲精品看不卡15| 黄色日韩网站视频| 亚洲影院在线观看| 欧美丰满少妇xxxbbb| 亚洲欧美国产高清| 欧美精品一区二区蜜臀亚洲 | 欧美激情一区二区三区在线| 国产精品亚洲综合色区韩国| 亚洲大片在线观看| 久久狠狠亚洲综合| 一个色综合av| 欧美激情精品久久久久久| 激情文学综合丁香| 亚洲欧美日韩精品久久亚洲区 | 欧美午夜精品久久久久久孕妇 |