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

天行健 君子當自強而不息

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) 評論(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一区二区三区久久| 亚洲综合电影| 最新69国产成人精品视频免费| 国产日韩成人精品| 很黄很黄激情成人| 韩国成人精品a∨在线观看| 国产欧美日本一区视频| 国产精品一区二区女厕厕| 国产日韩在线视频| 一区二区在线视频播放| 亚洲黄色影片| 亚洲一区二区三区视频| 欧美在线日韩精品| 欧美大片va欧美在线播放| 亚洲精品视频在线播放| 亚洲一区二区在线免费观看| 久久久久久九九九九| 久久久精品午夜少妇| 米奇777在线欧美播放| 亚洲国产精品成人综合| 久久综合狠狠| 亚洲激情视频在线播放| av不卡在线| 久久深夜福利免费观看| 欧美日韩成人一区二区三区| 国产亚洲一级高清| 一区二区欧美在线| 欧美 日韩 国产 一区| 一本到高清视频免费精品| 久久精品国产视频| 国产精品九九| 91久久精品国产91久久性色| 亚洲欧美日韩精品久久久| 老司机精品视频网站| 一区二区三区日韩| 欧美精品一线| 欧美一区二区三区在线观看| 亚洲精品一区二区网址| 亚洲欧美综合精品久久成人| 亚洲福利在线看| 久久久精彩视频| 国产欧美日韩视频| 亚洲一区二三| 亚洲免费高清视频| 欧美另类69精品久久久久9999| 国产亚洲精久久久久久| 亚洲视频香蕉人妖| 亚洲三级电影全部在线观看高清| 久久久久久亚洲精品不卡4k岛国| 国产欧美激情| 欧美在线视频一区二区| 99国产精品久久久久老师| 免费日韩精品中文字幕视频在线| 国产亚洲精品美女| 欧美一级黄色网| 在线视频亚洲| 国产精品久久久久久一区二区三区| 亚洲国产日韩综合一区| 免费观看亚洲视频大全| 久久成人一区二区| 国自产拍偷拍福利精品免费一| 欧美一区精品| 欧美一区二区视频在线| 国产亚洲激情在线| 久久亚洲视频| 久久综合伊人77777尤物| 亚洲国产高清在线| 欧美激情精品久久久久久| 蜜桃av一区二区| 美女啪啪无遮挡免费久久网站| 亚洲电影免费| 久久综合狠狠综合久久激情| 欧美一级大片在线免费观看| 国产日韩一区二区三区| 久久久久国产精品www| 久久精品最新地址| 91久久精品一区二区三区| 亚洲国产成人av| 欧美四级在线观看| 久久成人资源| 欧美插天视频在线播放| 亚洲一区日韩在线| 欧美一区二区视频免费观看| 亚洲高清久久| 亚洲素人在线| 国内视频一区| 91久久精品国产91久久| 国产精品theporn| 久久尤物电影视频在线观看| 女人天堂亚洲aⅴ在线观看| 亚洲午夜视频| 久久久青草婷婷精品综合日韩 | 亚洲日本中文字幕免费在线不卡| 亚洲国产欧美久久| 久久香蕉国产线看观看av| 久热re这里精品视频在线6| 一本久道久久综合中文字幕| 午夜精品久久久99热福利| 亚洲国产精品一区二区尤物区| 一区二区三区精品视频在线观看| 精品动漫3d一区二区三区| 这里只有精品视频| 亚洲激情另类| 久久精品系列| 香蕉成人久久| 欧美日韩另类在线| 欧美韩日视频| 国产真实久久| 99精品久久| 亚洲三级观看| 久久精品九九| 欧美一区中文字幕| 欧美日韩a区| 欧美激情一区二区三区全黄| 国产一区二区成人久久免费影院| 夜久久久久久| 99国产精品久久久久久久| 久久久无码精品亚洲日韩按摩| 欧美一区二区大片| 国产精品国产三级欧美二区| 欧美成人在线免费观看| 国产色爱av资源综合区| 亚洲视频视频在线| 亚洲一区在线观看视频 | 亚洲片区在线| 久久亚洲综合色一区二区三区| 欧美一级免费视频| 欧美三级午夜理伦三级中视频| 欧美激情久久久久| 亚洲国产精品激情在线观看| 欧美怡红院视频| 先锋亚洲精品| 国产精品腿扒开做爽爽爽挤奶网站| 亚洲精品专区| 亚洲小说春色综合另类电影| 欧美精品一线| 夜夜嗨一区二区| 亚洲欧美美女| 国产精品国产自产拍高清av| 一区二区三区成人精品| 亚洲午夜久久久久久尤物 | 在线国产精品一区| 久久国产精品免费一区| 久久久久久久久蜜桃| 好男人免费精品视频| 久久久中精品2020中文| 欧美成人一二三| 99香蕉国产精品偷在线观看| 欧美日韩视频免费播放| 亚洲性线免费观看视频成熟| 性欧美长视频| 国内精品99| 欧美不卡一卡二卡免费版| 亚洲人久久久| 亚洲欧美卡通另类91av| 国内精品久久久久久久97牛牛| 久久尤物视频| 亚洲理伦在线| 欧美三级欧美一级| 亚洲一区国产视频| 99热这里只有成人精品国产| 欧美日韩国产综合一区二区| av成人毛片| 久久精品在线| 99国产精品久久| 国产视频一区在线观看一区免费| 久久久久久噜噜噜久久久精品| 亚洲品质自拍| 久久久久久久网站| 一区二区成人精品| 国外精品视频| 欧美日韩免费在线| 欧美在线播放一区| 99精品久久久| 美女网站久久| 亚洲欧美日韩国产综合在线| 又紧又大又爽精品一区二区| 欧美日韩免费在线观看| 久久精品一区| 一本色道久久综合亚洲精品小说| 老司机精品导航| 午夜精品影院| 亚洲欧洲一区二区在线观看| 国产精品乱看| 欧美麻豆久久久久久中文| 久久精品国产亚洲高清剧情介绍| 亚洲免费激情| 亚洲国产欧美在线人成| 久久本道综合色狠狠五月| 亚洲美女精品久久| 黄色成人91| 国产三区二区一区久久| 欧美日韩亚洲91| 欧美激情五月| 久久综合久久综合久久| 欧美一区二区免费观在线| 99在线精品视频在线观看| 欧美高清在线视频| 另类av导航| 久久在线视频|