From 4018856d2d30532ad2404de4462ff3e473938a22 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sat, 10 Jan 2009 18:19:25 -0700 Subject: Changed a few emote variable names to be more sensible, as well as removing emotions.png from the client data files (should have never been there to begin with, IMO). TODO: Simplify the emote code so that there is a lot less redundant code, as well as make filling out the possible emotes more flexible. Signed-off-by: Ira Rice --- src/gui/smileycontainer.cpp | 26 +++++++++++++------------- src/gui/smileycontainer.h | 8 ++++---- src/gui/smileyshortcutcontainer.cpp | 6 +++--- src/gui/smileywindow.cpp | 14 +++++++------- src/gui/smileywindow.h | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/gui') diff --git a/src/gui/smileycontainer.cpp b/src/gui/smileycontainer.cpp index d221f55c..f8f57c45 100644 --- a/src/gui/smileycontainer.cpp +++ b/src/gui/smileycontainer.cpp @@ -36,17 +36,17 @@ #include "../utils/gettext.h" #include "../utils/tostring.h" -const int SmileyContainer::gridWidth = 34; // item icon width + 4 -const int SmileyContainer::gridHeight = 36; // item icon height + 4 +const int SmileyContainer::gridWidth = 34; // emote icon width + 4 +const int SmileyContainer::gridHeight = 36; // emote icon height + 4 -static const int NO_ITEM = -1; +static const int NO_EMOTE = -1; SmileyContainer::SmileyContainer(): - mSelectedItemIndex(NO_ITEM) + mSelectedEmoteIndex(NO_EMOTE) { ResourceManager *resman = ResourceManager::getInstance(); - mSmileyImg = resman->getImageSet("graphics/gui/emotions.png",30,32); + mSmileyImg = resman->getImageSet("graphics/sprites/emotions.png", 30, 32); if (!mSmileyImg) logger->error(_("Unable to load emotions")); mSelImg = resman->getImage("graphics/gui/selection.png"); @@ -95,7 +95,7 @@ void SmileyContainer::draw(gcn::Graphics *graphics) mSmileyImg->get(i), itemX, itemY); // Draw selection image below selected item - if (mSelectedItemIndex == i) + if (mSelectedEmoteIndex == i) { static_cast(graphics)->drawImage( mSelImg, itemX, itemY); @@ -123,23 +123,23 @@ void SmileyContainer::recalculateHeight() int SmileyContainer::getSelectedSmiley() { - if (mSelectedItemIndex == NO_ITEM) + if (mSelectedEmoteIndex == NO_EMOTE) return 0; - return 1+mSelectedItemIndex; + return 1+mSelectedEmoteIndex; } void SmileyContainer::selectNone() { - setSelectedItemIndex(NO_ITEM); + setSelectedEmoteIndex(NO_EMOTE); } -void SmileyContainer::setSelectedItemIndex(int index) +void SmileyContainer::setSelectedEmoteIndex(int index) { if (index < 0 || index >= mMaxSmiley ) - mSelectedItemIndex = NO_ITEM; + mSelectedEmoteIndex = NO_EMOTE; else - mSelectedItemIndex = index; + mSelectedEmoteIndex = index; } void SmileyContainer::distributeValueChangedEvent() @@ -165,7 +165,7 @@ void SmileyContainer::mousePressed(gcn::MouseEvent &event) int index = mx / gridWidth + ((my / gridHeight) * columns); if (index setSmileySelected(index+1); } } diff --git a/src/gui/smileycontainer.h b/src/gui/smileycontainer.h index ddfe9ec5..88ca0b48 100644 --- a/src/gui/smileycontainer.h +++ b/src/gui/smileycontainer.h @@ -33,7 +33,7 @@ class Image; class Inventory; -class Item; +class Emote; namespace gcn { class SelectionListener; @@ -107,12 +107,12 @@ class SmileyContainer : public gcn::Widget, * Sets the currently selected item. Invalid (e.g., negative) indices set `no item'. */ - void setSelectedItemIndex(int index); + void setSelectedEmoteIndex(int index); /** * Find the current item index by the most recently used item ID */ - void refindSelectedItem(void); + void refindSelectedEmote(void); /** * Determine and set the height of the container. @@ -126,7 +126,7 @@ class SmileyContainer : public gcn::Widget, ImageSet *mSmileyImg; Image *mSelImg; - int mSelectedItemIndex; + int mSelectedEmoteIndex; int mMaxSmiley; diff --git a/src/gui/smileyshortcutcontainer.cpp b/src/gui/smileyshortcutcontainer.cpp index 6028939f..c3cd056d 100644 --- a/src/gui/smileyshortcutcontainer.cpp +++ b/src/gui/smileyshortcutcontainer.cpp @@ -41,15 +41,15 @@ SmileyShortcutContainer::SmileyShortcutContainer(): mSmileyClicked(false), mSmileyMoved(0) { - mGridWidth=1, - mGridHeight=1, + mGridWidth = 1, + mGridHeight = 1, addMouseListener(this); addWidgetListener(this); ResourceManager *resman = ResourceManager::getInstance(); mBackgroundImg = resman->getImage("graphics/gui/item_shortcut_bgr.png"); - mSmileyImg = resman->getImageSet("graphics/gui/emotions.png",30,32); + mSmileyImg = resman->getImageSet("graphics/sprites/emotions.png", 30, 32); if (!mSmileyImg) logger->error(_("Unable to load emotions")); mMaxItems = smileyShortcut->getSmileyCount(); diff --git a/src/gui/smileywindow.cpp b/src/gui/smileywindow.cpp index 570eb45c..e3e821ff 100644 --- a/src/gui/smileywindow.cpp +++ b/src/gui/smileywindow.cpp @@ -45,10 +45,10 @@ SmileyWindow::SmileyWindow(): mUseButton = new Button(_("Use"), "use", this); - mItems = new SmileyContainer(); - mItems->addSelectionListener(this); + mEmotes = new SmileyContainer(); + mEmotes->addSelectionListener(this); - mInvenScroll = new ScrollArea(mItems); + mInvenScroll = new ScrollArea(mEmotes); mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); draw(); @@ -63,12 +63,12 @@ SmileyWindow::SmileyWindow(): void SmileyWindow::action(const gcn::ActionEvent &event) { - int item = mItems->getSelectedSmiley(); + int emote = mEmotes->getSelectedSmiley(); - if (!item) + if (!emote) return; - player_node->emote(item); + player_node->emote(emote); } @@ -95,5 +95,5 @@ void SmileyWindow::widgetResized(const gcn::Event &event) int SmileyWindow::getSelectedSmiley() const { - return mItems->getSelectedSmiley(); + return mEmotes->getSelectedSmiley(); } diff --git a/src/gui/smileywindow.h b/src/gui/smileywindow.h index 81ec6663..db27fcbd 100644 --- a/src/gui/smileywindow.h +++ b/src/gui/smileywindow.h @@ -69,7 +69,7 @@ class SmileyWindow : public Window, gcn::ActionListener, private: - SmileyContainer *mItems; + SmileyContainer *mEmotes; gcn::Button *mUseButton; gcn::ScrollArea *mInvenScroll; -- cgit v1.2.3-70-g09d2