diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-10 20:59:34 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-10 20:59:34 +0000 |
commit | bb9810d704a2f81da41e99cd9a1b03593dbe3a1c (patch) | |
tree | 237a6a184397994f4f4d93db63100d4b4f1bbe18 | |
parent | 4b376c30487ba98ede708c5e219f4bc9d6a72951 (diff) | |
download | mana-client-bb9810d704a2f81da41e99cd9a1b03593dbe3a1c.tar.gz mana-client-bb9810d704a2f81da41e99cd9a1b03593dbe3a1c.tar.bz2 mana-client-bb9810d704a2f81da41e99cd9a1b03593dbe3a1c.tar.xz mana-client-bb9810d704a2f81da41e99cd9a1b03593dbe3a1c.zip |
Adding player names and fixing emoticon position
-rw-r--r-- | src/being.cpp | 13 | ||||
-rw-r--r-- | src/being.h | 15 | ||||
-rw-r--r-- | src/engine.cpp | 8 | ||||
-rw-r--r-- | src/game.cpp | 10 |
4 files changed, 38 insertions, 8 deletions
diff --git a/src/being.cpp b/src/being.cpp index ed2a62f5..51728f80 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -24,6 +24,7 @@ #include "being.h" #include "game.h" #include "net/protocol.h" +#include "net/network.h" Being *player_node = NULL; @@ -36,6 +37,13 @@ PATH_NODE::PATH_NODE(unsigned short x, unsigned short y): void add_node(Being *being) { beings.push_back(being); + // If the being is a player, request the name + //if (being-> job < 10) { + WFIFOW(0) = net_w_value(0x0094); + WFIFOL(2) = net_l_value(RFIFOL(2)); + WFIFOSET(6); + // } + } void remove_node(unsigned int id) { @@ -166,6 +174,11 @@ void Being::setDamage(const std::string &text, int time) damage_y = 0; } +void Being::setName(char *text) +{ + strcpy(name, text); +} + void Being::nextStep() { if (!path.empty()) diff --git a/src/being.h b/src/being.h index 10d1a47c..16cedb3b 100644 --- a/src/being.h +++ b/src/being.h @@ -42,10 +42,9 @@ class Being { std::list<PATH_NODE> path; std::string speech; unsigned char speech_time; - - std::string damage; - unsigned char damage_time; - float damage_y; //Y coord of damage text + std::string damage; + unsigned char damage_time; + float damage_y; // y coord of damage text public: unsigned int id; @@ -64,6 +63,7 @@ class Being { unsigned int text_x, text_y; // temp solution to fix speech position unsigned short hair_style, hair_color; unsigned short weapon; + char name[24]; /** * Constructor. @@ -102,6 +102,13 @@ class Being { * @param time The amount of time the text should stay in milliseconds. */ void setDamage(const std::string &text, int time); + + /** + * Sets the name for the being + * + * @param text The name that should appear. + */ + void setName(char *name); /** * Sets the hair color for this being. diff --git a/src/engine.cpp b/src/engine.cpp index 047fa332..563247df 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -386,13 +386,17 @@ void Engine::draw() if (being->emotion != 0) { emotionset->spriteset[being->emotion - 1]->draw(screen, - sx * 32 - 5 + get_x_offset(being) - offset_x, - sy * 32 - 45 + get_y_offset(being) - offset_y); + sx * 32 + 5 + get_x_offset(being) - offset_x, + sy * 32 - 65 + get_y_offset(being) - offset_y); being->emotion_time--; if (being->emotion_time == 0) { being->emotion = 0; } } + + graphics->drawText(being->name, + being->text_x + 15, being->text_y + 30, + gcn::Graphics::CENTER); } else if (being->job == 45) { // Draw a warp } else { // Draw a monster diff --git a/src/game.cpp b/src/game.cpp index 2b63c023..3def09f5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -575,11 +575,11 @@ void do_parse() { } fclose(file); */ -#ifdef __DEBUG +//#ifdef __DEBUG FILE *file = fopen("./docs/packet.list", "a"); fprintf(file, "%x\n", RFIFOW(0)); fclose(file); -#endif +//#endif // Parse packet based on their id switch (id) { case SMSG_LOGIN_SUCCESS: @@ -1488,6 +1488,12 @@ void do_parse() { break; } break; + // Get being name + case 0x0095: + being = find_node(RFIFOL(2)); + if (being) + strcpy(being->name, RFIFOP(6)); + break; // Manage non implemented packets default: logger.log("Unhandled packet: %x", id); |