diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 39 | ||||
-rw-r--r-- | src/being.h | 14 | ||||
-rw-r--r-- | src/engine.cpp | 4 | ||||
-rw-r--r-- | src/gui/char_select.cpp | 12 | ||||
-rw-r--r-- | src/gui/char_select.h | 2 | ||||
-rw-r--r-- | src/player.cpp | 8 |
6 files changed, 52 insertions, 27 deletions
diff --git a/src/being.cpp b/src/being.cpp index aeb90860..b417fc34 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -218,6 +218,32 @@ Being::logic() } void +Being::drawName(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) +{ + int px = mPx + offsetX; + int py = mPy + offsetY; + + // Draw player name + if (getType() != LOCALPLAYER) { + graphics->setFont(speechFont); + graphics->drawText(mName, px + 15, py + 30, gcn::Graphics::CENTER); + } +} + +void +Being::drawEmotion(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) +{ + int px = mPx + offsetX; + int py = mPy + offsetY; + + if (emotion) + { + graphics->drawImage(emotionset->spriteset[emotion - 1], + px + 3, py - 60); + } +} + +void Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) { int px = mPx + offsetX; @@ -343,16 +369,3 @@ Being::getYOffset() const return offset; } - -void -Being::draw(Graphics *graphics, int offsetX, int offsetY) -{ - int px = mPx + offsetX; - int py = mPy + offsetY; - - if (emotion) - { - graphics->drawImage(emotionset->spriteset[emotion - 1], - px + 3, py - 60); - } -} diff --git a/src/being.h b/src/being.h index 446cb906..d87f06ab 100644 --- a/src/being.h +++ b/src/being.h @@ -189,6 +189,18 @@ class Being : public Sprite drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY); /** + * Draws the emotion picture above the being. + */ + void + drawEmotion(Graphics *graphics, Sint32 offsetX, Sint32 offsetY); + + /** + * Draws the name text below the being. + */ + void + drawName(Graphics *graphics, Sint32 offsetX, Sint32 offsetY); + + /** * Returns the type of the being. */ virtual Type getType() const; @@ -249,7 +261,7 @@ class Being : public Sprite * @see Sprite::draw(Graphics, int, int) */ void - draw(Graphics *graphics, Sint32 offsetX, Sint32 offsetY); + draw(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) {}; /** * Returns the pixel X coordinate. diff --git a/src/engine.cpp b/src/engine.cpp index dc767eb6..881a570a 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -250,11 +250,13 @@ void Engine::draw(Graphics *graphics) } } - // Draw player speech + // Draw player nickname, speech, and emotion sprite as needed Beings *beings = beingManager->getAll(); for (Beings::iterator i = beings->begin(); i != beings->end(); i++) { (*i)->drawSpeech(graphics, -map_x, -map_y); +(*i)->drawName(graphics, -map_x, -map_y); +(*i)->drawEmotion(graphics, -map_x, -map_y); } // Draw target marker if needed diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 621dc461..7ce2a77d 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -69,7 +69,7 @@ void CharDeleteConfirm::action(const std::string &eventId) } CharSelectDialog::CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *charInfo): - Window("Select Character"), mNetwork(network), mCharInfo(charInfo) + Window("Select Character"), mNetwork(network), mCharInfo(charInfo), mCharSelected(false) { selectButton = new Button("Ok"); cancelButton = new Button("Cancel"); @@ -146,6 +146,7 @@ void CharSelectDialog::action(const std::string& eventId) selectButton->setEnabled(false); previousButton->setEnabled(false); nextButton->setEnabled(false); + mCharSelected = true; attemptCharSelect(); } else if (eventId == "cancel") @@ -195,9 +196,12 @@ void CharSelectDialog::updatePlayerInfo() levelLabel->setCaption(levelCaption.str()); jobLevelLabel->setCaption(jobCaption.str()); moneyLabel->setCaption(moneyCaption.str()); - newCharButton->setEnabled(false); - delCharButton->setEnabled(true); - selectButton->setEnabled(true); + if (!mCharSelected) + { + newCharButton->setEnabled(false); + delCharButton->setEnabled(true); + selectButton->setEnabled(true); + } playerBox->hairStyle = pi->getHairStyle() - 1; playerBox->hairColor = pi->getHairColor() - 1; playerBox->showPlayer = true; diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 94d69e06..0cfc4f94 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -71,6 +71,8 @@ class CharSelectDialog : public Window, public gcn::ActionListener PlayerBox *playerBox; + bool mCharSelected; + /** * Communicate character deletion to the server. */ diff --git a/src/player.cpp b/src/player.cpp index 162f2e79..5720f0a6 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -122,12 +122,4 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY) px - 2 + 2 * hairtable[frame][dir][0], py - 50 + 2 * hairtable[frame][dir][1]); } - - // Draw player name - if (getType() != LOCALPLAYER) { - graphics->setFont(speechFont); - graphics->drawText(mName, px + 15, py + 30, gcn::Graphics::CENTER); - } - - Being::draw(graphics, offsetX, offsetY); } |