diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | data/help/support.txt | 2 | ||||
-rw-r--r-- | src/animatedsprite.cpp | 57 | ||||
-rw-r--r-- | src/gui/chat.cpp | 9 | ||||
-rw-r--r-- | src/gui/npc_text.cpp | 42 | ||||
-rw-r--r-- | src/gui/npc_text.h | 22 | ||||
-rw-r--r-- | src/gui/npclistdialog.cpp | 47 | ||||
-rw-r--r-- | src/gui/npclistdialog.h | 27 | ||||
-rw-r--r-- | src/gui/status.cpp | 2 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 16 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 6 |
11 files changed, 137 insertions, 96 deletions
@@ -6,11 +6,14 @@ - Added support for dynamic skill names and hair colors - Added ability to add equipment to the shortcut bar - Added ability to change configuration during login phase (from Aethyra) +- Mouse cursor will now hide when not used for some time - Inventory window now displays amount of slots used - Center minimap on player when it is larger than the minimap window - Extended particle emitters with properties that can change over time - Extended the GUI font to support more characters - Only require a restart to switch to full screen with OpenGL on Windows +- Make sure news and update file list aren't cached (from Aethyra) +- Made NPC dialogs resizable (from Aethyra) - Fixed visibility of trade window on startup - Fixed a client input freeze when closing NPC script from server - Fixed dead players to lie on the ground instead of standing around diff --git a/data/help/support.txt b/data/help/support.txt index 014e37b7..dfbd588d 100644 --- a/data/help/support.txt +++ b/data/help/support.txt @@ -7,7 +7,7 @@ can't find a solution to your problem, feel free to check our Bugs/Support section of the forum: -##2 http://themanaworld.org/phpBB2/viewforum.php?f=3 +##2 http://forums.themanaworld.org/viewforum.php?f=3 or come visit us on our IRC channel: diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 840fb1e8..203a82af 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -56,7 +56,8 @@ AnimatedSprite *AnimatedSprite::load(const std::string& filename, int variant) { ResourceManager *resman = ResourceManager::getInstance(); SpriteDef *s = resman->getSprite(filename, variant); - if (!s) return NULL; + if (!s) + return NULL; AnimatedSprite *as = new AnimatedSprite(s); s->decRef(); return as; @@ -67,22 +68,18 @@ AnimatedSprite::~AnimatedSprite() mSprite->decRef(); } -void -AnimatedSprite::reset() +void AnimatedSprite::reset() { mFrameIndex = 0; mFrameTime = 0; mLastTime = 0; } -void -AnimatedSprite::play(SpriteAction spriteAction) +void AnimatedSprite::play(SpriteAction spriteAction) { Action *action = mSprite->getAction(spriteAction); if (!action) - { return; - } mAction = action; Animation *animation = mAction->getAnimation(mDirection); @@ -96,20 +93,15 @@ AnimatedSprite::play(SpriteAction spriteAction) } } -void -AnimatedSprite::update(int time) +void AnimatedSprite::update(int time) { // Avoid freaking out at first frame or when tick_time overflows if (time < mLastTime || mLastTime == 0) - { mLastTime = time; - } // If not enough time has passed yet, do nothing if (time <= mLastTime || !mAnimation) - { return; - } unsigned int dt = time - mLastTime; mLastTime = time; @@ -121,13 +113,10 @@ AnimatedSprite::update(int time) } } -bool -AnimatedSprite::updateCurrentAnimation(unsigned int time) +bool AnimatedSprite::updateCurrentAnimation(unsigned int time) { if (!mFrame || Animation::isTerminator(*mFrame)) - { return false; - } mFrameTime += time; @@ -137,9 +126,7 @@ AnimatedSprite::updateCurrentAnimation(unsigned int time) mFrameIndex++; if (mFrameIndex == mAnimation->getLength()) - { mFrameIndex = 0; - } mFrame = mAnimation->getFrame(mFrameIndex); @@ -154,30 +141,24 @@ AnimatedSprite::updateCurrentAnimation(unsigned int time) return true; } -bool -AnimatedSprite::draw(Graphics* graphics, int posX, int posY) const +bool AnimatedSprite::draw(Graphics* graphics, int posX, int posY) const { if (!mFrame || !mFrame->image) - { return false; - } return graphics->drawImage(mFrame->image, posX + mFrame->offsetX, posY + mFrame->offsetY); } -void -AnimatedSprite::setDirection(SpriteDirection direction) +void AnimatedSprite::setDirection(SpriteDirection direction) { if (mDirection != direction) { mDirection = direction; if (!mAction) - { return; - } Animation *animation = mAction->getAnimation(mDirection); @@ -190,26 +171,12 @@ AnimatedSprite::setDirection(SpriteDirection direction) } } -int -AnimatedSprite::getWidth() const +int AnimatedSprite::getWidth() const { - if (mFrame) - { - return mFrame->image->getWidth(); - } - else { - return 0; - } + return mFrame ? mFrame->image->getWidth() : 0; } -int -AnimatedSprite::getHeight() const +int AnimatedSprite::getHeight() const { - if (mFrame) - { - return mFrame->image->getHeight(); - } - else { - return 0; - } + return mFrame ? mFrame->image->getHeight() : 0; } diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index a96c2eda..b9e11dad 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -327,7 +327,10 @@ ChatWindow::chatSend(const std::string &nick, std::string msg) } else if (msg.substr(0, IS_WHERE_LENGTH) == IS_WHERE) { - chatLog(map_path, BY_SERVER); + // Display the current map, X, and Y + std::ostringstream where; + where << map_path << " " << player_node->mX << "," << player_node->mY; + chatLog(where.str(), BY_SERVER); } else if (msg.substr(0, IS_WHO_LENGTH) == IS_WHO) { @@ -339,9 +342,9 @@ ChatWindow::chatSend(const std::string &nick, std::string msg) mTextOutput->clearRows(); } else if (msg.substr(0, IS_WHISPER_LENGTH) == IS_WHISPER) - whisper(nick, msg, IS_WHISPER_LENGTH + 1); + whisper(nick, msg, IS_WHISPER_LENGTH); else if (msg.substr(0, IS_SHORT_WHISPER_LENGTH) == IS_SHORT_WHISPER) - whisper(nick, msg, IS_SHORT_WHISPER_LENGTH + 1); + whisper(nick, msg, IS_SHORT_WHISPER_LENGTH); else { chatLog("Unknown command", BY_SERVER); diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index 3c4beaf3..34c9cce1 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -32,10 +32,16 @@ NpcTextDialog::NpcTextDialog(): Window("NPC") { + setResizable(true); + + setMinWidth(200); + setMinHeight(150); + mTextBox = new TextBox; mTextBox->setEditable(false); - gcn::ScrollArea *scrollArea = new ScrollArea(mTextBox); - Button *okButton = new Button("OK", "ok", this); + + scrollArea = new ScrollArea(mTextBox); + okButton = new Button("OK", "ok", this); setContentSize(260, 175); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -52,20 +58,36 @@ NpcTextDialog::NpcTextDialog(): setLocationRelativeTo(getParent()); } -void -NpcTextDialog::setText(const std::string &text) +void NpcTextDialog::setText(const std::string &text) +{ + mText = text; + mTextBox->setTextWrapped(mText); +} + +void NpcTextDialog::addText(const std::string &text) { - mTextBox->setTextWrapped(text); + setText(mText + text + "\n"); } -void -NpcTextDialog::addText(const std::string &text) +void NpcTextDialog::widgetResized(const gcn::Event &event) { - mTextBox->setTextWrapped(mTextBox->getText() + text + "\n"); + Window::widgetResized(event); + + const gcn::Rectangle &area = getChildrenArea(); + const int width = area.width; + const int height = area.height; + + scrollArea->setDimension(gcn::Rectangle( + 5, 5, width - 10, height - 15 - okButton->getHeight())); + okButton->setPosition( + width - 5 - okButton->getWidth(), + height - 5 - okButton->getHeight()); + + // Set the text again so that it gets wrapped according to the new size + mTextBox->setTextWrapped(mText); } -void -NpcTextDialog::action(const gcn::ActionEvent &event) +void NpcTextDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "ok") { diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 2c9771d3..76161f88 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -45,18 +45,23 @@ class NpcTextDialog : public Window, public gcn::ActionListener NpcTextDialog(); /** + * Called when resizing the window + * + * @param event The calling event + */ + void widgetResized(const gcn::Event &event); + + /** * Called when receiving actions from the widgets. */ - void - action(const gcn::ActionEvent &event); + void action(const gcn::ActionEvent &event); /** * Sets the text shows in the dialog. * * @param string The new text. */ - void - setText(const std::string &string); + void setText(const std::string &string); /** * Adds the text to the text shows in the dialog. Also adds a newline @@ -64,11 +69,14 @@ class NpcTextDialog : public Window, public gcn::ActionListener * * @param string The text to add. */ - void - addText(const std::string &string); + void addText(const std::string &string); private: + gcn::Button *okButton; + gcn::ScrollArea *scrollArea; TextBox *mTextBox; + + std::string mText; }; -#endif +#endif // _TMW_NPC_TEXT_H diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 90444f1a..cdd38312 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -32,10 +32,15 @@ NpcListDialog::NpcListDialog(): Window("NPC") { + setResizable(true); + + setMinWidth(200); + setMinHeight(150); + mItemList = new ListBox(this); - ScrollArea *scrollArea = new ScrollArea(mItemList); - Button *okButton = new Button("OK", "ok", this); - Button *cancelButton = new Button("Cancel", "cancel", this); + scrollArea = new ScrollArea(mItemList); + okButton = new Button("OK", "ok", this); + cancelButton = new Button("Cancel", "cancel", this); setContentSize(260, 175); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -59,37 +64,49 @@ NpcListDialog::NpcListDialog(): setLocationRelativeTo(getParent()); } -int -NpcListDialog::getNumberOfElements() +int NpcListDialog::getNumberOfElements() { return mItems.size(); } -std::string -NpcListDialog::getElementAt(int i) +std::string NpcListDialog::getElementAt(int i) { return mItems[i]; } -void -NpcListDialog::parseItems(const std::string &itemString) +void NpcListDialog::parseItems(const std::string &itemString) { std::istringstream iss(itemString); std::string tmp; - while(getline(iss, tmp, ':')) { + while (getline(iss, tmp, ':')) mItems.push_back(tmp); - } } -void -NpcListDialog::reset() +void NpcListDialog::reset() { mItems.clear(); } -void -NpcListDialog::action(const gcn::ActionEvent &event) +void NpcListDialog::widgetResized(const gcn::Event &event) +{ + Window::widgetResized(event); + + const gcn::Rectangle &area = getChildrenArea(); + const int width = area.width; + const int height = area.height; + + scrollArea->setDimension(gcn::Rectangle( + 5, 5, width - 10, height - 15 - okButton->getHeight())); + cancelButton->setPosition( + width - 5 - cancelButton->getWidth(), + height - 5 - cancelButton->getHeight()); + okButton->setPosition( + cancelButton->getX() - 5 - okButton->getWidth(), + cancelButton->getY()); +} + +void NpcListDialog::action(const gcn::ActionEvent &event) { int choice = 0; diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index 0e6760f1..f548dbba 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.h @@ -49,41 +49,46 @@ class NpcListDialog : public Window, public gcn::ActionListener, NpcListDialog(); /** + * Called when resizing the window + * + * @param event The calling event + */ + void widgetResized(const gcn::Event &event); + + /** * Called when receiving actions from the widgets. */ - void - action(const gcn::ActionEvent &event); + void action(const gcn::ActionEvent &event); /** * Returns the number of items in the choices list. */ - int - getNumberOfElements(); + int getNumberOfElements(); /** * Returns the name of item number i of the choices list. */ - std::string - getElementAt(int i); + std::string getElementAt(int i); /** * Fills the options list for an NPC dialog. * * @param itemString A string with the options separated with colons. */ - void - parseItems(const std::string &itemString); + void parseItems(const std::string &itemString); /** * Resets the list by removing all items. */ - void - reset(); + void reset(); private: gcn::ListBox *mItemList; + gcn::ScrollArea *scrollArea; + gcn::Button *okButton; + gcn::Button *cancelButton; std::vector<std::string> mItems; }; -#endif +#endif // _TMW_GUI_NPCLISTDIALOG_H diff --git a/src/gui/status.cpp b/src/gui/status.cpp index b9f28562..1a257ae8 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -39,7 +39,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): setResizable(true); setCloseButton(true); setDefaultSize((windowContainer->getWidth() - 365) / 2, - (windowContainer->getHeight() - 255) / 2, 365, 255); + (windowContainer->getHeight() - 255) / 2, 365, 275); loadWindowState(); // ---------------------- diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index c0344b72..7f7d45fc 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -310,6 +310,17 @@ int UpdaterWindow::downloadThread(void *ptr) curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); + struct curl_slist *pHeaders = NULL; + if (uw->mDownloadStatus != UPDATE_RESOURCES) + { + // Make sure the resources2.txt and news.txt aren't cached, + // in order to always get the latest version. + pHeaders = curl_slist_append(pHeaders, "pragma: no-cache"); + pHeaders = + curl_slist_append(pHeaders, "Cache-Control: no-cache"); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, pHeaders); + } + if ((res = curl_easy_perform(curl)) != 0) { uw->mDownloadStatus = UPDATE_ERROR; @@ -334,6 +345,11 @@ int UpdaterWindow::downloadThread(void *ptr) curl_easy_cleanup(curl); + if (uw->mDownloadStatus != UPDATE_RESOURCES) + { + curl_slist_free_all(pHeaders); + } + if (!uw->mStoreInMemory) { // Don't check resources2.txt checksum diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 5ee40014..e6f2fd1f 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -125,10 +125,10 @@ void ItemDB::load() CHECK_PARAM(name, ""); CHECK_PARAM(image, ""); - // CHECK_PARAM(description, ""); - // CHECK_PARAM(effect, ""); + CHECK_PARAM(description, ""); + CHECK_PARAM(effect, ""); // CHECK_PARAM(type, 0); - CHECK_PARAM(weight, 0); + // CHECK_PARAM(weight, 0); // CHECK_PARAM(slot, 0); #undef CHECK_PARAM |