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

天行健 君子當(dāng)自強(qiáng)而不息

Controlling Players and Characters(30)

 

Using the Character Definitions

The character definitions are templates by nature, so you really need to load up the
definitions and work with them on a per-instance basis. This means that you need
to come up with a controller that loads the definitions and tracks each instance of
a character in your game. What you need is a character controller class.

 

Creating a Character Controller Class

Now that you’ve seen what is involved in controlling and defining your game’s
characters, you can focus on constructing a controller class that takes care of everything
for you, including adding, removing, updating, and rendering the characters,
as well as handling the spell effects from the spell controller previously developed.

Because so much is involved in tracking characters, the job is split into a few structures
and a single class. Much like spells, a mesh list is required to hold the list of
used meshes. This time however, the looping information of the animations is not
contained in the character definitions; another structure is needed to contain the
character animations that need to be looped.

When working in artificial intelligence, you create a single structure to store the
coordinates of route points. Finally, another structure maintains a linked list of
characters in use. Now, examine each structure just mentioned and the information
they contain.

 

Meshes with sMeshAnim

For the character controller, you
also have to provide a list of meshes that are used to render the characters. The
sMeshAnim structure contains the mesh and animation objects and filenames.

typedef struct sMeshAnim
{
  char filename[MAX_PATH]; // filename of mesh/anim
  long count; // number of characters using mesh
  cMesh mesh;
  cAnimation anim;

  sMeshAnim() { count = 0; }
} *sCharMeshListPtr;

 

Animation Loops and sCharAnimInfo

The animations used by the characters are set in their ways; either they can or
cannot loop. Certain actions, such as standing, require a character’s mesh to constantly
repeat, giving the appearance of constant motion, whereas other animations
such as swinging the sword only need be performed once.

By storing a list of the animations that need be looped, the character controller can
pass the information on to the Graphics Core so that it can handle the hard work
for you. You store this animation loop information in the sCharAnimInfo structure,
as follows:

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

To use the structure, you must store the name of the animation (matching the animation
set name in the .X file) and a flag that tells whether to loop the associated
animation.

 

Moving with sRoutePoint

As previously discussed, you use the sRoutePoint structure to store the coordinates of
a route point that characters move toward in their never-ending movement
through the levels.

typedef struct {
  float XPos, YPos, ZPos; // Target position
} sRoutePoint;

 

Tracking Characters with sCharacter

Things are about to become more complicated because tracking each character
involves quite a bit of data. In fact, so much data is involved in tracking characters
(within an sCharacter structure) that you need to see it in pieces:

typedef struct sCharacter
{
    
long        def;
    
long        id;
    
long        type;   // PC, NPC, or MONSTER
    long        ai;     // STAND, WANDER, etc

    
bool        update_enable; 

    sCharDef    char_def;
    cCharIcs*   char_ics;

    
char        script_filename[MAX_PATH];

    
long        health_points;          // current health points
    long        mana_points;            // current mana points
    long        ailments;       
    
float       charge; 

    
long        action;                 // current action
    float       pos_x, pos_y, pos_z;    // current coordinates
    float       direction;              // angle character is facing
    long        last_anim;
    
long        last_anim_time;

    
bool        is_lock;
    
long        action_timer;

    sCharacter*     attacker;
    sCharacter*     victim;

    
long            spell_index;
    
long            target_type;
    
float           target_x, target_y, target_z;

    
long            item_index;             // item to use when ready
    sCharItem*      char_item;

    
float           distance;               // follow/evade distance
    sCharacter*     target_char;            // character to follow
    float           min_x, min_y, min_z;    // min bounding coordinates
    float           max_x, max_y, max_z;    // max bounding coordinates
    
    
long            num_points;         // number of points in route
    long            cur_point;          // current route point
    sRoutePoint*    route;              // route points

    
char            msg[128];
    
long            msg_timer;
    D3DCOLOR        msg_color;

    cObject         
object;
    cMesh           weapon_mesh;
    cObject         weapon_object;

    sCharacter*     prev;
    sCharacter*     next;

    
////////////////////////////////////////////////////////////////////////////
    
    sCharacter()
    {
        def  = 0;
        id   = -1;
        type = CHAR_PC;
        update_enable = 
false;

        ailments = 0;
        charge   = 0.0f;
        
        ZeroMemory(&char_def, 
sizeof(char_def));
        char_ics = NULL;

        script_filename[0] = 0;

        action       = CHAR_IDLE;
        last_anim    = -1;

        is_lock      = 
false;
        action_timer = 0;

        attacker     = NULL;
        victim       = NULL;

        item_index   = 0;
        char_item    = NULL;

        distance     = 0.0f;
        target_char  = NULL;

        min_x = min_y = min_z = max_x = max_y = max_z = 0;

        num_points  = 0;
        route       = NULL;

        msg[0]      = '\0';
        msg_timer   = 0;

        prev = next = NULL;
    }

    ~sCharacter()
    {
        delete char_ics;
        delete[] route;

        delete next;
    }
} *sCharacterPtr;   

posted on 2007-12-03 23:29 lovedday 閱讀(222) 評(píng)論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(178)

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

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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在线观看| 欧美日韩中国免费专区在线看| 欧美精品乱码久久久久久按摩| 欧美日本精品在线| 国产精品久久久久久妇女6080| 国产精品一页| 亚洲国产综合91精品麻豆| 在线视频精品一区| 亚久久调教视频| 欧美高清视频一区二区三区在线观看| 欧美国产日韩精品| 一区二区三区不卡视频在线观看| 亚洲性xxxx| 老司机一区二区三区| 欧美日韩在线一区| 一区在线免费观看| 在线一区二区三区四区五区| 久久精品成人一区二区三区| 亚洲激情在线播放| 亚洲欧美www| 欧美成人免费播放| 国产亚洲欧美日韩精品| 日韩系列欧美系列| 久久乐国产精品| 一区二区三区高清不卡| 美女91精品| 国产精品性做久久久久久| 欧美视频一区二区三区在线观看 | 亚洲一区欧美一区| 男人插女人欧美| 亚洲欧美日本国产有色| 欧美理论电影在线观看| 136国产福利精品导航网址应用| 亚洲一区制服诱惑| 欧美高清视频免费观看| 午夜精品福利一区二区蜜股av| 欧美岛国激情| 亚洲国产成人porn| 久久久久青草大香线综合精品| 一本到12不卡视频在线dvd| 另类天堂av| 亚洲第一网站| 久久一二三四| 久久精品一二三区| 国产手机视频一区二区| 亚洲视频免费观看| 99精品国产一区二区青青牛奶| 老司机免费视频久久| 狠狠色2019综合网| 久久免费午夜影院| 欧美主播一区二区三区| 国产欧美日韩综合一区在线观看| 亚洲伊人一本大道中文字幕| 日韩亚洲欧美成人| 欧美日韩精品一区二区天天拍小说 | 久久婷婷丁香| 久久久国产成人精品| 国产精品一区二区在线观看| 亚洲曰本av电影| 亚洲香蕉网站| 国产欧美视频一区二区| 久久久精品动漫| 久久久久久九九九九| 在线免费不卡视频| 亚洲国产成人av好男人在线观看| 久久亚洲欧美国产精品乐播| 极品尤物av久久免费看| 久久这里只有精品视频首页| 久久久久久久波多野高潮日日| 国产亚洲日本欧美韩国| 久久久av网站| 久热精品视频| 99天天综合性| 亚洲小说春色综合另类电影| 国产欧美日韩亚洲| 久久久精品免费视频| 久久精品国产久精国产爱| 亚洲第一区色| 亚洲精品欧美在线| 国产精品乱码一区二区三区| 久久9热精品视频| 久久久久中文| 一区二区三区日韩欧美| 欧美一级二级三级蜜桃| 另类欧美日韩国产在线| 日韩亚洲国产精品| 亚洲自拍高清| 黄页网站一区| 一二三四社区欧美黄| 一区精品在线| 99国产成+人+综合+亚洲欧美| 国产精品日韩欧美一区| 欧美大片免费久久精品三p | 国产区精品在线观看| 米奇777超碰欧美日韩亚洲| 欧美精品一区二区三区很污很色的 | 日韩小视频在线观看| 午夜激情综合网| 久久中文欧美| 国产日韩欧美视频在线| 亚洲国产综合在线看不卡| 国产精品人人做人人爽人人添| 免费欧美电影| 国产女主播一区二区三区| 亚洲国产精品黑人久久久| 国产欧美亚洲视频| 99pao成人国产永久免费视频| 狠狠操狠狠色综合网| 亚洲午夜激情在线| 一区二区三区高清在线 | 亚洲精品乱码久久久久久蜜桃麻豆| 国产精品日本精品| 亚洲精品一区二区在线观看| 在线精品国精品国产尤物884a| 一区二区三区日韩精品视频| 亚洲欧洲在线播放| 久久一区欧美| 久久久www成人免费无遮挡大片 | 国产精品久久久久久亚洲毛片| 欧美激情一区在线| 极品尤物av久久免费看| 亚洲一区二区动漫| 亚洲一区二区三区在线看| 欧美成人一区二区三区| 欧美xx69| 亚洲第一视频| 蜜臀av国产精品久久久久| 老司机亚洲精品| 国产一区二区日韩精品欧美精品| 中文一区二区| 先锋影音国产精品| 国产精品自拍视频| 午夜国产精品视频| 久久久久.com| 激情五月***国产精品| 久久精品国产第一区二区三区最新章节 | 亚洲欧美日韩电影| 欧美午夜精品久久久久久久| 日韩视频在线观看免费| 亚洲视频在线免费观看| 欧美视频在线看| 亚洲一区二区三区三| 久久精品国产视频| 在线看片第一页欧美| 男女视频一区二区| 亚洲精品字幕| 欧美一级黄色录像| 国产一区二区在线观看免费| 久久精品国产免费| 亚洲电影免费| 中国女人久久久| 国产精品久久夜| 欧美一区影院| 亚洲第一搞黄网站| 亚洲一区在线观看视频 | 欧美亚洲色图校园春色| 国产综合18久久久久久| 久久精品中文字幕一区二区三区| 久久综合伊人77777蜜臀| 亚洲电影激情视频网站| 欧美精品福利在线| 午夜精品电影| 亚洲国产一区二区三区a毛片 | 免费日韩成人| 一区二区三区欧美视频| 国产日韩欧美日韩| 免费观看欧美在线视频的网站| 亚洲人成久久| 欧美一级夜夜爽| 亚洲激情在线观看| 国产精品盗摄久久久| 久久久噜噜噜久久人人看| 亚洲日本在线视频观看| 久久精品视频在线看| 中文欧美字幕免费| 国产精品伦理| 欧美成人有码| 久久精品99国产精品日本| 夜夜嗨av一区二区三区四区| 欧美69wwwcom| 久久久久久综合| 亚洲欧美日本伦理| 99re这里只有精品6| 136国产福利精品导航网址| 国产精品专区第二| 欧美日韩一区二区在线观看视频 | 久久综合九色九九| 一本色道久久综合亚洲精品婷婷| 久久免费少妇高潮久久精品99| 亚洲小视频在线观看| 亚洲国产精品福利| 狠狠网亚洲精品| 国产欧美一区二区精品性| 欧美亚洲第一区| 欧美精品一区在线观看| 免费不卡在线观看| 狼人天天伊人久久| 国产日韩一区|