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

天行健 君子當自強而不息

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 閱讀(224) 評論(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>
            久久五月婷婷丁香社区| 亚洲欧美亚洲| 欧美激情一区在线| 亚洲麻豆国产自偷在线| 欧美成ee人免费视频| 另类图片国产| 亚洲精品乱码久久久久久蜜桃91 | 91久久夜色精品国产网站| 久久综合色婷婷| 鲁大师影院一区二区三区| 亚洲人成欧美中文字幕| 亚洲精品视频一区| 国产欧美69| 久热综合在线亚洲精品| 欧美成人日韩| 午夜日韩av| 可以看av的网站久久看| 亚洲精品国产视频| 亚洲砖区区免费| 在线日本成人| 99精品久久久| 好吊妞这里只有精品| 欧美国产日韩a欧美在线观看| 欧美另类在线观看| 久久久www| 欧美精品乱码久久久久久按摩| 亚洲尤物精选| 另类综合日韩欧美亚洲| 亚洲欧美激情一区二区| 巨乳诱惑日韩免费av| 亚洲欧美日韩一区二区三区在线观看 | 亚洲福利视频专区| 亚洲网站视频福利| 最新中文字幕亚洲| 欧美一级理论性理论a| 亚洲美女诱惑| 久久久久久久久久码影片| 亚洲无限乱码一二三四麻| 久久久91精品国产一区二区三区 | 一区在线观看| 亚洲男人的天堂在线| 亚洲精品国产精品久久清纯直播 | 亚洲欧美国内爽妇网| 亚洲精品久久久久久久久久久久| 亚洲在线视频观看| 一区二区三区视频免费在线观看| 久久不射2019中文字幕| 制服丝袜亚洲播放| 欧美xxxx在线观看| 欧美1区2区3区| 国产啪精品视频| 日韩一级在线观看| 99精品福利视频| 久热精品视频在线观看一区| 性做久久久久久久免费看| 欧美巨乳波霸| 欧美激情一区二区三区不卡| 好吊色欧美一区二区三区视频| 亚洲一区二区网站| 亚洲自拍另类| 欧美视频精品在线观看| 亚洲人成在线播放网站岛国| 亚洲国产精品va在线观看黑人| 久久aⅴ国产欧美74aaa| 久久精品中文字幕一区二区三区| 国产精品一区在线观看| 亚洲淫性视频| 性久久久久久久久久久久| 国产精品丝袜xxxxxxx| 亚洲视频999| 欧美一区永久视频免费观看| 国产精品久久久999| 亚洲一区二区视频在线观看| 午夜激情久久久| 国产亚洲欧美一区二区三区| 欧美一区在线直播| 麻豆国产精品一区二区三区| 激情另类综合| 欧美顶级大胆免费视频| 99re热这里只有精品视频| 亚洲——在线| 国产亚洲在线| 欧美a一区二区| 亚洲人体1000| 午夜精品亚洲一区二区三区嫩草| 国产精品久久久久久久久免费樱桃| 亚洲一区二区三区在线播放| 久久狠狠一本精品综合网| 激情综合五月天| 你懂的网址国产 欧美| 亚洲三级影片| 久久99在线观看| 亚洲国产经典视频| 国产精品成人播放| 欧美在线视频一区二区| 亚洲观看高清完整版在线观看| 日韩一级免费观看| 国产日韩综合一区二区性色av| 久久频这里精品99香蕉| 99人久久精品视频最新地址| 亚洲欧美中日韩| 亚洲国产99| 国产精品高清在线| 美日韩精品视频免费看| 这里只有精品在线播放| 久久先锋资源| 亚洲自拍偷拍色片视频| 尤物yw午夜国产精品视频明星| 欧美精品一区二区蜜臀亚洲| 亚洲欧美另类久久久精品2019| 欧美电影免费观看高清| 午夜激情综合网| 亚洲精品亚洲人成人网| 国产日韩精品一区观看| 欧美久久电影| 久久一区免费| 亚洲欧美日韩国产成人精品影院| 欧美激情偷拍| 久久久伊人欧美| 欧美亚洲三区| 亚洲色图综合久久| 亚洲黄色影片| 伊人成人网在线看| 国产欧美一区二区在线观看| 欧美乱在线观看| 免费成人激情视频| 久久不射网站| 午夜精品久久久久久久蜜桃app| 亚洲美女av在线播放| 欧美激情网友自拍| 欧美a级理论片| 久久久久久**毛片大全| 性色av一区二区三区红粉影视| 一区二区三区日韩在线观看 | 欧美日韩国产探花| 久久夜色精品国产欧美乱| 午夜在线视频一区二区区别| 一区二区三区精品视频| 日韩一区二区久久| 亚洲三级免费电影| 亚洲精品久久久久久久久久久久久| 老**午夜毛片一区二区三区| 久久精品国产精品亚洲精品| 欧美一区日韩一区| 久久爱91午夜羞羞| 欧美中文在线免费| 久久精品一级爱片| 久久人人超碰| 欧美777四色影视在线| 久久女同互慰一区二区三区| 久久精品亚洲一区二区| 久久九九热免费视频| 欧美一区三区二区在线观看| 欧美在线视频日韩| 久久精品av麻豆的观看方式| 久久经典综合| 蜜桃av综合| 亚洲国产视频a| 妖精成人www高清在线观看| 国产精品99久久久久久久久久久久| 99re6热在线精品视频播放速度| 日韩系列在线| 午夜精品国产更新| 久久噜噜噜精品国产亚洲综合| 久久久xxx| 欧美高清视频一区二区| 国产精品xxx在线观看www| 国产精品素人视频| 在线看无码的免费网站| 亚洲精品久久嫩草网站秘色| 亚洲精品一区二区三区蜜桃久| 一区二区三区精品久久久| 性久久久久久久| 男同欧美伦乱| 99视频超级精品| 久久成人一区二区| 欧美日本免费一区二区三区| 国产精品日本欧美一区二区三区| 国产一区观看| 一本久道久久久| 久久成人精品无人区| 最新日韩av| 久久电影一区| 欧美精品久久久久久久免费观看 | 亚洲欧洲日本一区二区三区| 亚洲一区二区三区高清不卡| 久久精品99久久香蕉国产色戒| 亚洲电影免费在线| 性欧美xxxx大乳国产app| 欧美成人一区二区在线| 国产亚洲欧美日韩日本| 日韩视频不卡| 久久久亚洲精品一区二区三区 | 欧美一级理论性理论a| 免费久久精品视频| 亚洲欧美日韩在线不卡| 欧美理论在线播放| 一色屋精品亚洲香蕉网站| 午夜国产欧美理论在线播放| 亚洲国产高清在线观看视频|