diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-06-22 12:42:35 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-06-22 12:42:35 +0000 |
commit | 1d64b7a037435aee796f068770a0c2ca2b19a93a (patch) | |
tree | e211c9da2b6a4303df5717a3ddf2ed16736f3a76 /src | |
parent | c3628bdf27c92cd7b339393e7472f9528c8a1c5c (diff) | |
download | mana-client-1d64b7a037435aee796f068770a0c2ca2b19a93a.tar.gz mana-client-1d64b7a037435aee796f068770a0c2ca2b19a93a.tar.bz2 mana-client-1d64b7a037435aee796f068770a0c2ca2b19a93a.tar.xz mana-client-1d64b7a037435aee796f068770a0c2ca2b19a93a.zip |
Detect ghosts at creation time.
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/being.h | 17 | ||||
-rw-r--r-- | src/engine.cpp | 24 | ||||
-rw-r--r-- | src/game.cpp | 22 |
4 files changed, 27 insertions, 38 deletions
diff --git a/src/being.cpp b/src/being.cpp index 7ed73b8f..88b2b9a0 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -162,7 +162,7 @@ void sort() { Being::Being(): id(0), job(0), x(0), y(0), destX(0), destY(0), direction(0), - type(0), action(0), frame(0), + action(0), frame(0), speech_color(0), walk_time(0), speed(150), diff --git a/src/being.h b/src/being.h index a2390f89..990a1e4a 100644 --- a/src/being.h +++ b/src/being.h @@ -43,23 +43,22 @@ struct PATH_NODE { class Being { public: - unsigned int id; - unsigned short job; - unsigned short x, y; - unsigned short destX, destY; - unsigned char direction; - unsigned char type; + unsigned int id; /**< Unique id */ + unsigned short job; /**< Job (player job, npc, monster, ) */ + unsigned short x, y; /**< Tile coordinates */ + unsigned short destX, destY; /**< Destination tile coordinates */ + unsigned char direction; /**< Facing direction */ unsigned char action; unsigned char frame; int speech_color; unsigned short walk_time; unsigned short speed; - unsigned char emotion; - unsigned char emotion_time; + unsigned char emotion; /**< Currently showing emotion */ + unsigned char emotion_time; /**< Time until emotion disappears */ unsigned int text_x, text_y; // temp solution to fix speech position unsigned short weapon; - char name[24]; + char name[24]; /**< Name of character */ unsigned short aspd; /**< Attack speed */ /** diff --git a/src/engine.cpp b/src/engine.cpp index 69e4c04e..3d18f8ad 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -374,30 +374,8 @@ void Engine::draw() } // Draw a player - /** - * NOTES (by Javila): - * - I'm not sure if comparing if being->id is less then 110000000 - * will create colateral effects (missing some player), but I think - * this will avoid drawing ghosts too, since they have IDs greater - * then value above. - * - Also this high ID values are used for monsters and not for - * players!!! Maybe can there be some monsters in server using - * invalid monsterset's ID... This way server send the unknown - * monster to client and tmw is guessing that this is a player... - * Errors like this are (or at least were) found in mob_db when - * monsters dropped unknown items (invalid items IDs)... Ok, I - * did check on server scripts files (CVS) and haven't found these - * errors... Do anybody have an idea about this??? - */ - else if (being->job < 10) + else if (being->isPlayer()) { - // Don't draw ghosts!!! - if ((std::string(being->name).empty()) && (being != player_node)) - { - beingIterator++; - continue; - } - being->text_x = sx * 32 + get_x_offset(being) - offset_x; being->text_y = sy * 32 + get_y_offset(being) - offset_y; diff --git a/src/game.cpp b/src/game.cpp index ce269bfa..dd7eccdb 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -724,17 +724,28 @@ void do_parse() // Add new being / stop monster case 0x0078: - being = findNode(RFIFOL(2)); + int id = RFIFOL(2); + int job = RFIFOW(14); - if (being == NULL) { + // Being with id >= 110000000 and job 0 are better known + // as ghosts, so don't create those. + if (job == 0 && id >= 110000000) + { + break; + } + + being = findNode(id); + + if (being == NULL) + { being = new Being(); - being->id = RFIFOL(2); + being->id = id; being->speed = RFIFOW(6); if (being->speed == 0) { // Else division by 0 when calculating frame being->speed = 150; } - being->job = RFIFOW(14); + being->job = job; being->setHairStyle(RFIFOW(16)); being->setHairColor(RFIFOW(28)); being->x = get_x(RFIFOP(46)); @@ -742,7 +753,8 @@ void do_parse() being->direction = get_direction(RFIFOP(46)); add_node(being); } - else { + else + { being->clearPath(); being->x = get_x(RFIFOP(46)); being->y = get_y(RFIFOP(46)); |