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

天行健 君子當自強而不息

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>
            在线看国产一区| 亚洲精品一区二区三区不| 在线一区免费观看| 91久久精品国产91性色tv| 久久精品毛片| 亚洲国产一区二区精品专区| 欧美国产精品专区| 欧美区在线观看| 亚洲视频成人| 午夜伦理片一区| 好看的日韩视频| 亚洲第一页在线| 欧美日韩精品在线播放| 亚洲欧美日韩精品久久奇米色影视| 亚洲一区二区久久| 韩日成人在线| 亚洲国内高清视频| 国产精品久久一卡二卡| 欧美在线看片| 麻豆精品精品国产自在97香蕉| 亚洲欧洲在线观看| 亚洲香蕉伊综合在人在线视看| 国产农村妇女精品| 蜜臀av一级做a爰片久久| 欧美国产综合一区二区| 亚洲欧美另类在线观看| 久久久久久久999精品视频| 亚洲美女电影在线| 羞羞色国产精品| 91久久精品美女高潮| 亚洲欧美精品在线| 亚洲精品日韩欧美| 亚洲欧美日韩精品久久亚洲区 | 男人天堂欧美日韩| 亚洲制服欧美中文字幕中文字幕| 午夜精品一区二区三区在线视 | 国产亚洲激情在线| 亚洲激情综合| 国产一区二区三区高清播放| 亚洲欧洲日本国产| 国产主播一区二区| 99精品免费| 亚洲精品视频免费| 久久精品欧美日韩| 亚洲欧美在线高清| 欧美国产精品一区| 免费在线亚洲欧美| 国产一区导航| 一区二区三区高清不卡| 亚洲黄色在线视频| 久久九九免费视频| 久久er精品视频| 欧美午夜一区| 日韩视频第一页| 日韩亚洲国产精品| 欧美xart系列在线观看| 狂野欧美一区| 国产综合婷婷| 久久国产日本精品| 欧美在线一级va免费观看| 国产精品高潮呻吟久久| 亚洲日本一区二区| 99riav1国产精品视频| 麻豆亚洲精品| 欧美成人一品| 亚洲国产另类久久久精品极度| 欧美一区二区三区四区视频 | 精品成人在线视频| 欧美在线观看一区二区| 久久国产免费| 国模叶桐国产精品一区| 欧美一区二区大片| 久久久噜噜噜| 尤物在线精品| 欧美成人一区二区在线| 亚洲欧洲日产国产网站| 99精品热6080yy久久| 欧美日韩成人在线观看| 亚洲九九精品| 亚洲一区尤物| 国产欧美日韩在线| 久久av一区二区三区漫画| 快she精品国产999| 亚洲三级网站| 国产精品国产三级国产专区53| 亚洲视频欧美在线| 久久av在线看| 在线精品视频一区二区| 毛片精品免费在线观看| 亚洲国产日本| 午夜一区不卡| 在线观看av一区| 欧美麻豆久久久久久中文| 亚洲色图制服丝袜| 久久精品国产亚洲aⅴ| 1769国内精品视频在线播放| 欧美精品v日韩精品v国产精品| 亚洲精品乱码久久久久久日本蜜臀| 中文网丁香综合网| 国产主播精品| 欧美国产另类| 性做久久久久久| 欧美激情va永久在线播放| 野花国产精品入口| 国产一区二区日韩| 欧美激情一区二区三区全黄| 一本色道久久99精品综合| 久久一二三四| 亚洲午夜高清视频| 亚洲第一毛片| 国产精品女主播在线观看| 久久三级福利| 亚洲欧美卡通另类91av| 亚洲成色777777在线观看影院| 久久精品国产免费| 亚洲人成7777| 蜜桃久久av一区| 亚洲一区在线观看免费观看电影高清| 一区二区三区在线高清| 国产精品国产一区二区| 免费一区二区三区| 欧美一区网站| 夜夜嗨av一区二区三区网站四季av | 欧美高清视频www夜色资源网| 午夜视频精品| 99精品免费视频| 免费视频久久| 久久久久久国产精品一区| 亚洲一区二区三区国产| 亚洲剧情一区二区| 怡红院精品视频在线观看极品| 国产精品一区二区三区四区五区| 欧美美女操人视频| 欧美激情第六页| 久久影院午夜论| 久久久久久综合网天天| 午夜精品福利视频| 亚洲一区二区三区影院| 99精品视频免费观看视频| 免费看亚洲片| 欧美jizzhd精品欧美喷水| 久久久久久伊人| 久久蜜桃av一区精品变态类天堂| 欧美在线free| 久久www免费人成看片高清| 亚洲一区在线直播| 亚洲欧美国产日韩天堂区| 亚洲视频福利| 亚洲一区二区在线看| 亚洲永久精品大片| 亚洲欧美日韩精品久久奇米色影视| 在线亚洲高清视频| 亚洲免费在线视频一区 二区| 亚洲午夜视频| 午夜免费在线观看精品视频| 亚洲欧美日韩综合| 欧美一区2区三区4区公司二百| 午夜精品久久久久久久男人的天堂| 亚洲——在线| 久久精品二区三区| 久久在线视频在线| 亚洲动漫精品| 日韩视频一区| 午夜久久美女| 美女国产一区| 欧美精品自拍| 国产精品日韩欧美| 国产一区二区在线观看免费| 在线欧美不卡| 99天天综合性| 久久精品免费电影| 亚洲国产精品www| 一道本一区二区| 亚洲欧美区自拍先锋| 久久久亚洲高清| 欧美日韩国产黄| 国产麻豆一精品一av一免费| 一区二区亚洲精品| 日韩视频在线观看国产| 亚洲欧美偷拍卡通变态| 久久综合久久久| 一级日韩一区在线观看| 久久九九电影| 欧美色网在线| 韩国欧美一区| 一本大道久久a久久综合婷婷| 午夜日韩福利| 欧美激情bt| 欧美一级久久| 欧美片在线播放| 狠狠色狠色综合曰曰| 一区二区三区久久| 免费成人黄色片| 亚洲一级一区| 欧美成人在线影院| 国内久久精品| 午夜精品网站| 日韩午夜激情| 免费日韩av| 国内精品嫩模av私拍在线观看|