diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-19 12:27:11 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-19 12:27:11 +0000 |
commit | 4f92acafbe35fb0ad9d5d0e03b3cbbf7967a7019 (patch) | |
tree | 9e0a31b30f08b5d54444c74527f5ce1a3bdfb5d6 /src | |
parent | 7a92c4c076cefc2463347190f50b9bddf8d4ef6b (diff) | |
download | mana-4f92acafbe35fb0ad9d5d0e03b3cbbf7967a7019.tar.gz mana-4f92acafbe35fb0ad9d5d0e03b3cbbf7967a7019.tar.bz2 mana-4f92acafbe35fb0ad9d5d0e03b3cbbf7967a7019.tar.xz mana-4f92acafbe35fb0ad9d5d0e03b3cbbf7967a7019.zip |
Improving hair management
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 24 | ||||
-rw-r--r-- | src/being.h | 13 | ||||
-rw-r--r-- | src/engine.cpp | 10 |
3 files changed, 38 insertions, 9 deletions
diff --git a/src/being.cpp b/src/being.cpp index 70259cf3..1b2e595c 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -146,7 +146,7 @@ Being::Being(): speed(150), emotion(0), emotion_time(0), text_x(0), text_y(0), - hair_style(1), hair_color(1), + hairStyle(1), hairColor(1), weapon(0), speech_time(0), damage_time(0), @@ -173,12 +173,30 @@ void Being::setPath(std::list<PATH_NODE> path) void Being::setHairColor(int color) { - hair_color = color; + hairColor = color; + if (hairColor < 1 || hairColor > 11) + { + hairColor = 1; + } } void Being::setHairStyle(int style) { - hair_style = style; + hairStyle = style; + if (hairStyle < 1 || hairStyle > 2) + { + hairStyle = 1; + } +} + +unsigned short Being::getHairColor() +{ + return hairColor; +} + +unsigned short Being::getHairStyle() +{ + return hairStyle; } void Being::setSpeech(const std::string &text, int time) diff --git a/src/being.h b/src/being.h index 173b1d3c..9e65793d 100644 --- a/src/being.h +++ b/src/being.h @@ -42,6 +42,7 @@ class Being { std::list<PATH_NODE> path; std::string speech; std::string damage; + unsigned short hairStyle, hairColor; public: unsigned int id; @@ -58,7 +59,7 @@ class Being { unsigned char emotion; unsigned char emotion_time; unsigned int text_x, text_y; // temp solution to fix speech position - unsigned short hair_style, hair_color; + unsigned short weapon; char name[24]; unsigned int speech_time; @@ -120,6 +121,16 @@ class Being { * Sets the hair style for this being. */ void setHairStyle(int style); + + /** + * Gets the hair color for this being. + */ + unsigned short getHairColor(); + + /** + * Gets the hair style for this being. + */ + unsigned short getHairStyle(); /** * Makes this being take the next step of his path. diff --git a/src/engine.cpp b/src/engine.cpp index 417bbb92..d1feacf2 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -394,9 +394,9 @@ void Engine::draw() being->text_x - 64, being->text_y - 80); } - if (being->hair_color <= 10) { - int hf = being->hair_color - 1 + 10 * (dir + 4 * - (being->hair_style - 1)); + if (being->getHairColor() <= 10) { + int hf = being->getHairColor() - 1 + 10 * (dir + 4 * + (being->getHairStyle() - 1)); hairset->spriteset[hf]->draw(screen, being->text_x - 2 + 2 * hairtable[pf][dir][0], @@ -433,7 +433,7 @@ void Engine::draw() being->text_x + 30, being->text_y + 40); } else { - monsterset[being->job - 1002]->spriteset[dir + 4 * mf]->draw( + monsterset[being->job-1002]->spriteset[dir + 4 * mf]->draw( screen, being->text_x + 30, being->text_y + 40); } @@ -446,7 +446,7 @@ void Engine::draw() } } } - + beingIterator++; // nodes are ordered so if the next being y is > then the |