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

天行健 君子當自強而不息

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>
            日韩一级成人av| 国产精品伊人日日| 久久视频在线免费观看| 欧美日韩美女在线观看| 欧美电影电视剧在线观看| 国产嫩草影院久久久久 | 免费看av成人| 国产日韩欧美综合精品| 亚洲视频在线观看免费| 99精品国产在热久久婷婷| 久久亚洲高清| 久久日韩粉嫩一区二区三区| 国产精品视屏| 亚洲天堂免费观看| 亚洲永久免费视频| 国产精品jvid在线观看蜜臀| 亚洲另类视频| 99国产一区| 欧美日韩国产综合视频在线观看 | 国产在线乱码一区二区三区| 中文国产成人精品久久一| 99精品久久久| 欧美久久久久久久久| 亚洲国产欧美在线人成| 亚洲国产一区二区三区在线播| 久久一区亚洲| 亚洲电影av| 亚洲免费播放| 欧美午夜免费| 亚洲欧美中文在线视频| 久久激情视频| 伊人久久婷婷| 欧美大片91| 一区二区三区精密机械公司| 亚洲综合精品自拍| 国产毛片一区二区| 久久精品一区二区三区不卡牛牛| 蜜桃av噜噜一区二区三区| 亚洲国产精品久久精品怡红院| 欧美成人按摩| 亚洲一区二区三区精品视频| 久久精品免费播放| 亚洲国产aⅴ天堂久久| 欧美国产日韩一区二区| 亚洲视频精选| 蜜臀av一级做a爰片久久| 亚洲欧洲视频| 国产精品久线观看视频| 久久电影一区| 亚洲日本欧美日韩高观看| 午夜视频在线观看一区| 国产一本一道久久香蕉| 麻豆亚洲精品| 亚洲无亚洲人成网站77777| 久久久亚洲一区| 亚洲精品日韩在线观看| 国产精品乱码一区二区三区| 久久精品国产一区二区电影| 亚洲精品综合精品自拍| 久久av资源网站| 亚洲精品国产精品国自产观看浪潮| 欧美精品久久久久久久久老牛影院 | 欧美深夜影院| 久久久久久久尹人综合网亚洲 | 欧美性生交xxxxx久久久| 欧美在线免费播放| 亚洲精品之草原avav久久| 久久国产精品毛片| 99人久久精品视频最新地址| 国产一区高清视频| 欧美日韩一区二区视频在线观看| 久久久久久久网站| 中文亚洲视频在线| 最近中文字幕mv在线一区二区三区四区 | 99www免费人成精品| 久久久久久黄| 亚洲欧美电影院| 日韩视频一区二区三区在线播放| 国产一区二区日韩精品欧美精品| 欧美日韩伦理在线| 麻豆91精品| 久久精品女人天堂| 亚洲欧美一区二区原创| 一本色道久久88综合亚洲精品ⅰ | 久久国产视频网站| 亚洲午夜av在线| 亚洲日本欧美| 亚洲第一伊人| 激情六月婷婷久久| 国产综合自拍| 国产综合视频| 国产午夜亚洲精品不卡| 国产精品久久久一本精品| 欧美日韩精品一区二区在线播放 | 欧美激情一区二区| 久久亚洲一区| 久久人人97超碰精品888| 久久国产一区| 欧美影院成人| 久久精品国产亚洲a| 欧美亚洲综合在线| 亚洲一区自拍| 亚洲一区免费在线观看| 亚洲一区二区精品视频| 一本色道久久综合亚洲精品按摩| 日韩午夜电影| 99精品欧美一区| 一区二区av在线| 亚洲午夜日本在线观看| av不卡在线观看| 亚洲一区免费| 欧美一区综合| 久久亚洲电影| 欧美激情精品久久久久久黑人| 男人的天堂亚洲在线| 欧美激情综合五月色丁香| 欧美黄色精品| 国产精品第十页| 国产视频精品免费播放| 国产一区欧美日韩| 在线观看的日韩av| 亚洲精品一级| 亚洲中午字幕| 久久精品99无色码中文字幕| 久久亚洲春色中文字幕| 欧美二区在线| 一区二区三区免费看| 性亚洲最疯狂xxxx高清| 久久久久久999| 欧美精品在线观看播放| 国产精品无码永久免费888| 国产日韩精品在线播放| 精品动漫av| 一区二区三区三区在线| 欧美与欧洲交xxxx免费观看| 免费观看一区| 中文av字幕一区| 久久天天躁夜夜躁狠狠躁2022| 欧美激情综合五月色丁香小说| 国产精品久久二区| 在线观看成人一级片| 亚洲小说春色综合另类电影| 久久精品色图| 99re6这里只有精品| 欧美一区二区三区在线观看| 欧美国产亚洲视频| 国产偷自视频区视频一区二区| 亚洲国内在线| 欧美在线影院| 91久久黄色| 久久国产欧美| 国产精品国色综合久久| 亚洲电影免费在线观看| 亚洲免费在线视频一区 二区| 欧美成人a∨高清免费观看| 亚洲一区成人| 欧美美女日韩| 在线观看一区二区精品视频| 午夜精品一区二区三区在线播放| 欧美成熟视频| 欧美在线网站| 国产精品久久毛片a| 亚洲裸体在线观看| 久久综合中文字幕| 亚洲免费在线视频| 欧美伦理a级免费电影| 在线观看日韩专区| 久久精品国产99国产精品| 一区二区三区日韩欧美精品| 欧美国产视频在线| 亚洲电影欧美电影有声小说| 久久久久久久综合| 亚洲免费视频中文字幕| 国产精品s色| 亚洲视频一二区| 亚洲精品影院在线观看| 美国十次成人| 伊大人香蕉综合8在线视| 欧美在线观看一区二区| 亚洲天堂激情| 欧美午夜精品久久久久久久| 99精品99久久久久久宅男| 欧美二区乱c少妇| 免费成人av在线| 亚洲激情av| 亚洲福利av| 欧美成人免费网站| 亚洲啪啪91| 亚洲国产精品一区二区第四页av| 老**午夜毛片一区二区三区| 在线观看一区| 亚洲国产99| 欧美日韩激情小视频| 一本久久精品一区二区| 亚洲黄色尤物视频| 欧美激情综合在线| 亚洲小视频在线观看| 亚洲亚洲精品在线观看| 国产精品久久久久久久第一福利 | 欧美日韩人人澡狠狠躁视频|