diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-11-23 22:38:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-11-23 22:38:33 +0300 |
commit | c5327f3b1d10171ff2a97546ea49e350b1725c24 (patch) | |
tree | 2cd1ada4c5db1ad3452bcf7aca9c424c0ed848d2 /src | |
parent | db1e60556c72b1b87ff2a384c556ccca724c46d6 (diff) | |
parent | 6bed768bc416eed0212b62e70731d2c40cd1b69b (diff) | |
download | plus-c5327f3b1d10171ff2a97546ea49e350b1725c24.tar.gz plus-c5327f3b1d10171ff2a97546ea49e350b1725c24.tar.bz2 plus-c5327f3b1d10171ff2a97546ea49e350b1725c24.tar.xz plus-c5327f3b1d10171ff2a97546ea49e350b1725c24.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/being/being.cpp | 95 | ||||
-rw-r--r-- | src/being/being.h | 14 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/game.cpp | 5 | ||||
-rw-r--r-- | src/gui/gui.cpp | 3 | ||||
-rw-r--r-- | src/gui/gui.h | 1 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 1 | ||||
-rw-r--r-- | src/gui/sdlinput.h | 4 | ||||
-rw-r--r-- | src/gui/setupactiondata.h | 56 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_other.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_perfomance.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 181 | ||||
-rw-r--r-- | src/gui/widgets/textfield.h | 10 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 16 | ||||
-rw-r--r-- | src/input/keyboarddata.h | 79 | ||||
-rw-r--r-- | src/input/keydata.h | 11 | ||||
-rw-r--r-- | src/main.h | 4 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 12 | ||||
-rw-r--r-- | src/net/sdltcpnet.cpp | 2 | ||||
-rw-r--r-- | src/particle/particleinfo.h | 41 | ||||
-rw-r--r-- | src/render/sdl2graphics.cpp | 10 | ||||
-rw-r--r-- | src/resources/db/itemdb.cpp | 9 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 1 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 7 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 2 |
27 files changed, 500 insertions, 76 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e516662e8..e2e019117 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -708,6 +708,7 @@ SET(SRCS particle/particleemitter.cpp particle/particleemitter.h particle/particleemitterprop.h + particle/particleinfo.h party.cpp party.h being/playerinfo.cpp diff --git a/src/Makefile.am b/src/Makefile.am index ec6622a88..6a2ad876a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -155,6 +155,9 @@ manaplus_SOURCES += sdl2gfx/SDL2_framerate.c \ sdl2gfx/SDL2_framerate.h \ sdl2gfx/SDL2_rotozoom.c \ sdl2gfx/SDL2_rotozoom.h +else +dyecmd_CXXFLAGS += -DUSE_SDL2 +manaplus_CXXFLAGS += -DUSE_SDL2 endif endif @@ -840,6 +843,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ particle/particleemitter.cpp \ particle/particleemitter.h \ particle/particleemitterprop.h \ + particle/particleinfo.h \ party.cpp \ party.h \ being/playerinfo.cpp \ diff --git a/src/being/being.cpp b/src/being/being.cpp index cda6557e4..65bcc5782 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -37,6 +37,7 @@ #include "being/playerrelations.h" #include "particle/particle.h" +#include "particle/particleinfo.h" #include "gui/sdlfont.h" @@ -123,6 +124,7 @@ Being::Being(const int id, const Type type, const uint16_t subtype, mSpriteColors(), mSpriteIDs(), mSpriteColorsIds(), + mSpriteParticles(), mGuilds(), mParty(nullptr), mActionTime(0), @@ -238,6 +240,8 @@ Being::~Being() mOwner->setPet(nullptr); if (mPet) mPet->setOwner(nullptr); + + removeAllItemsParticles(); } void Being::setSubtype(const uint16_t subtype, const uint8_t look) @@ -414,7 +418,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel, if (!userPalette) return; - if (!channel.empty() && (langChatTab && langChatTab->getChannelName() + if (!channel.empty() && (!langChatTab || langChatTab->getChannelName() != channel)) { return; @@ -1917,6 +1921,10 @@ void Being::setSprite(const unsigned int slot, const int id, if (slot >= mSpriteColorsIds.size()) mSpriteColorsIds.resize(slot + 1, 1); + // here probably need more complex condition + if (slot && mSpriteIDs[slot] == id) + return; + // id = 0 means unequip if (id == 0) { @@ -1934,6 +1942,7 @@ void Being::setSprite(const unsigned int slot, const int id, if (pet) removePet(); } + removeItemParticles(id1); } } else @@ -1964,6 +1973,8 @@ void Being::setSprite(const unsigned int slot, const int id, CompoundSprite::setSprite(slot, equipmentSprite); + addItemParticles(id, info.getDisplay()); + if (isWeapon) mEquippedWeapon = &ItemDB::get(id); @@ -3092,3 +3103,85 @@ void Being::setMap(Map *const map) if (mMap) mOffsetY = mMap->getHeightOffset(mX, mY); } + +void Being::removeAllItemsParticles() +{ + FOR_EACH (SpriteParticleInfoIter, it, mSpriteParticles) + { + delete (*it).second; + } + mSpriteParticles.clear(); +} + +void Being::addItemParticles(const int id, const SpriteDisplay &display) +{ + SpriteParticleInfoIter it = mSpriteParticles.find(id); + ParticleInfo *pi = nullptr; + if (it == mSpriteParticles.end()) + { + pi = new ParticleInfo(); + mSpriteParticles[id] = pi; + } + else + { + pi = (*it).second; + } + + if (!pi->particles.empty()) + return; + + // setup particle effects + if (Particle::enabled && particleEngine) + { + FOR_EACH (StringVectCIter, itr, display.particles) + { + Particle *const p = particleEngine->addEffect(*itr, 0, 0); + controlParticle(p); + pi->files.push_back(*itr); + pi->particles.push_back(p); + } + } + else + { + FOR_EACH (StringVectCIter, itr, display.particles) + pi->files.push_back(*itr); + } +} + +void Being::removeItemParticles(const int id) +{ + SpriteParticleInfoIter it = mSpriteParticles.find(id); + if (it == mSpriteParticles.end()) + return; + ParticleInfo *const pi = (*it).second; + if (pi) + { + FOR_EACH (std::vector<Particle*>::const_iterator, itp, pi->particles) + mChildParticleEffects.removeLocally(*itp); + delete pi; + } + mSpriteParticles.erase(it); +} + +void Being::recreateItemParticles() +{ + FOR_EACH (SpriteParticleInfoIter, it, mSpriteParticles) + { + ParticleInfo *const pi = (*it).second; + if (pi && !pi->files.empty()) + { + FOR_EACH (std::vector<Particle*>::const_iterator, + itp, pi->particles) + { + mChildParticleEffects.removeLocally(*itp); + } + + FOR_EACH (std::vector<std::string>::const_iterator, str, pi->files) + { + Particle *const p = particleEngine->addEffect(*str, 0, 0); + controlParticle(p); + pi->particles.push_back(p); + } + } + } +} diff --git a/src/being/being.h b/src/being/being.h index 313a92c2d..a2316d607 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -53,6 +53,8 @@ class Party; class SpeechBubble; class Text; +struct ParticleInfo; + extern volatile int cur_time; enum Gender @@ -903,6 +905,8 @@ class Being : public ActorSprite, public ConfigListener void setMap(Map *const map); + void recreateItemParticles(); + protected: /** * Updates name's location. @@ -911,6 +915,12 @@ class Being : public ActorSprite, public ConfigListener void showName(); + void addItemParticles(const int id, const SpriteDisplay &display); + + void removeAllItemsParticles(); + + void removeItemParticles(const int id); + static int getDefaultEffectId(const int type); BeingInfo *mInfo; @@ -942,9 +952,13 @@ class Being : public ActorSprite, public ConfigListener Vector mDest; /**< destination coordinates. */ + typedef std::map<int, ParticleInfo*> SpriteParticleInfo; + typedef SpriteParticleInfo::iterator SpriteParticleInfoIter; + StringVect mSpriteColors; std::vector<int> mSpriteIDs; std::vector<int> mSpriteColorsIds; + SpriteParticleInfo mSpriteParticles; // Character guild information std::map<int, Guild*> mGuilds; diff --git a/src/defaults.cpp b/src/defaults.cpp index d4b2a5379..06cb40b5f 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -353,6 +353,7 @@ DefaultsData* getConfigDefaults() AddDEF("storageSortOrder", 0); AddDEF("buySortOrder", 0); AddDEF("showmotd", false); + AddDEF("playMapAnimations", true); return configData; } diff --git a/src/game.cpp b/src/game.cpp index 80d27a4a1..5766f724f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1013,6 +1013,7 @@ void Game::changeMap(const std::string &mapPath) if (newMap) newMap->initializeParticleEffects(particleEngine); + // Start playing new music file when necessary const std::string oldMusic = mCurrentMap ? mCurrentMap->getMusicFile() : ""; @@ -1038,6 +1039,10 @@ void Game::changeMap(const std::string &mapPath) if (mumbleManager) mumbleManager->setMap(mapPath); #endif + + if (player_node) + player_node->recreateItemParticles(); + Net::getGameHandler()->mapLoadedEvent(); BLOCK_END("Game::changeMap") } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0c75dd4e4..60924bfd4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -20,6 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "mouseinput.h" + #include "gui/gui.h" #include "gui/focushandler.h" @@ -35,7 +37,6 @@ #include "client.h" #include "configuration.h" #include "dragdrop.h" -#include "mouseinput.h" #include "touchmanager.h" #include "input/keydata.h" diff --git a/src/gui/gui.h b/src/gui/gui.h index 85ec33415..7ac546102 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -33,6 +33,7 @@ class Graphics; class GuiConfigListener; class ImageSet; class MouseEvent; +class MouseInput; class SDLFont; class SDLInput; class Window; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 3dcbd4caa..52d7a8fec 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -58,7 +58,6 @@ #include "gui/sdlinput.h" -#include "mouseinput.h" #include "sdlshared.h" #include "input/inputmanager.h" diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 368367bd2..65e0a78ce 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -61,6 +61,8 @@ #include "input/keyinput.h" +#include "mouseinput.h" + #include <SDL_events.h> #include <guichan/input.hpp> @@ -69,8 +71,6 @@ #include <queue> -class MouseInput; - namespace Key { enum diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h index 45ff55e83..97a81ce6c 100644 --- a/src/gui/setupactiondata.h +++ b/src/gui/setupactiondata.h @@ -1835,6 +1835,62 @@ static SetupActionData setupActionData8[] = "", }, { + // TRANSLATORS: input action name + N_("Ctrl"), + Input::KEY_GUI_CTRL, + "", + }, + { + "B", + Input::KEY_GUI_B, + "", + }, + { + "C", + Input::KEY_GUI_C, + "", + }, + { + "D", + Input::KEY_GUI_D, + "", + }, + { + "E", + Input::KEY_GUI_E, + "", + }, + { + "F", + Input::KEY_GUI_F, + "", + }, + { + "H", + Input::KEY_GUI_H, + "", + }, + { + "K", + Input::KEY_GUI_K, + "", + }, + { + "U", + Input::KEY_GUI_U, + "", + }, + { + "V", + Input::KEY_GUI_V, + "", + }, + { + "W", + Input::KEY_GUI_W, + "", + }, + { "", Input::KEY_NO_VALUE, "" diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index b59edfd4a..b03cf5f41 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -168,6 +168,10 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : new SetupItemCheckBox(_("Auto resize minimaps"), "", "autoresizeminimaps", this, "autoresizeminimapsEvent"); + // TRANSLATORS: settings option + new SetupItemCheckBox(_("Play map animations"), "", "playMapAnimations", + this, "playMapAnimationsEvent"); + // TRANSLATORS: settings group new SetupItemLabel(_("Moving"), "", this); diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp index 25d91841e..4f9105beb 100644 --- a/src/gui/widgets/tabs/setup_perfomance.cpp +++ b/src/gui/widgets/tabs/setup_perfomance.cpp @@ -149,7 +149,7 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : "uselonglivespritesEvent"); // TRANSLATORS: settings option - new SetupItemCheckBox(_("Cache all sounds (can use additinal memory)"), + new SetupItemCheckBox(_("Cache all sounds (can use additional memory)"), "", "uselonglivesounds", this, "uselonglivesoundsEvent"); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index a361e1a12..7a6f27ee2 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -24,14 +24,13 @@ #include "client.h" -#ifdef ANDROID +#if defined ANDROID || defined USE_SDL2 #include "input/inputmanager.h" #endif #include "input/keydata.h" #include "input/keyevent.h" -#include "gui/sdlinput.h" #include "gui/viewport.h" #include "gui/popups/popupmenu.h" @@ -277,45 +276,21 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) { case 2: // Ctrl+b { - while (mCaretPosition > 0) - { - --mCaretPosition; - if ((mText[mCaretPosition] & 192) != 128) - break; - } + moveCaretBack(); consumed = true; break; } case 6: // Ctrl+f { - const unsigned sz = static_cast<unsigned>(mText.size()); - while (mCaretPosition < sz) - { - ++mCaretPosition; - if (mCaretPosition == sz || - (mText[mCaretPosition] & 192) != 128) - { - break; - } - } + moveCaretForward(); consumed = true; break; } case 4: // Ctrl+d { - unsigned sz = static_cast<unsigned>(mText.size()); - while (mCaretPosition < sz) - { - --sz; - mText.erase(mCaretPosition, 1); - if (mCaretPosition == sz || - (mText[mCaretPosition] & 192) != 128) - { - break; - } - } + caretDelete(); consumed = true; break; } @@ -336,15 +311,11 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) break; case 21: // Ctrl+u - if (mCaretPosition > 0) - { - mText = mText.substr(mCaretPosition); - mCaretPosition = 0; - } + caretDeleteToStart(); consumed = true; break; - case 3: + case 3: // Ctrl+c handleCopy(); consumed = true; break; @@ -359,15 +330,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) break; case 23: // Ctrl+w - while (mCaretPosition > 0) - { - deleteCharLeft(mText, &mCaretPosition); - if (mCaretPosition > 0 && isWordSeparator( - mText[mCaretPosition - 1])) - { - break; - } - } + caretDeleteWord(); consumed = true; break; @@ -469,10 +432,121 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) distributeActionEvent(); if (consumed) + { keyEvent.consume(); + } +#ifdef USE_SDL2 + else + { + if (inputManager.isActionActive(static_cast<int>(Input::KEY_GUI_CTRL))) + { + switch (action) + { + case Input::KEY_GUI_B: + { + moveCaretBack(); + consumed = true; + break; + } + case Input::KEY_GUI_C: + { + handleCopy(); + consumed = true; + break; + } + case Input::KEY_GUI_D: + { + caretDelete(); + consumed = true; + break; + } + case Input::KEY_GUI_E: + { + mCaretPosition = static_cast<int>(mText.size()); + consumed = true; + break; + } + case Input::KEY_GUI_F: + { + moveCaretBack(); + consumed = true; + break; + } + case Input::KEY_GUI_H: + { + deleteCharLeft(mText, &mCaretPosition); + consumed = true; + break; + } + case Input::KEY_GUI_U: + { + caretDeleteToStart(); + consumed = true; + break; + } + case Input::KEY_GUI_K: + { + mText = mText.substr(0, mCaretPosition); + consumed = true; + break; + } + case Input::KEY_GUI_V: + { + handlePaste(); + consumed = true; + break; + } + case Input::KEY_GUI_W: + { + caretDeleteWord(); + consumed = true; + break; + } + + default: + break; + } + } + } + if (consumed) + keyEvent.consume(); +#endif fixScroll(); } +void TextField::moveCaretBack() +{ + while (mCaretPosition > 0) + { + --mCaretPosition; + if ((mText[mCaretPosition] & 192) != 128) + break; + } +} + +void TextField::moveCaretForward() +{ + const unsigned sz = static_cast<unsigned>(mText.size()); + while (mCaretPosition < sz) + { + ++mCaretPosition; + if (mCaretPosition == sz || (mText[mCaretPosition] & 192) != 128) + break; + } +} + +void TextField::caretDelete() +{ + unsigned sz = static_cast<unsigned>(mText.size()); + while (mCaretPosition < sz) + { + --sz; + mText.erase(mCaretPosition, 1); + if (mCaretPosition == sz || (mText[mCaretPosition] & 192) != 128) + break; + } +} + void TextField::handlePaste() { std::string text = getText(); @@ -485,6 +559,25 @@ void TextField::handlePaste() } } +void TextField::caretDeleteToStart() +{ + if (mCaretPosition > 0) + { + mText = mText.substr(mCaretPosition); + mCaretPosition = 0; + } +} + +void TextField::caretDeleteWord() +{ + while (mCaretPosition > 0) + { + deleteCharLeft(mText, &mCaretPosition); + if (mCaretPosition > 0 && isWordSeparator(mText[mCaretPosition - 1])) + break; + } +} + void TextField::handleCopy() const { std::string text = getText(); diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 70a722e53..3942d610a 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -126,6 +126,16 @@ class TextField : public gcn::TextField, void focusLost(const gcn::Event &event) override; + void moveCaretBack(); + + void moveCaretForward(); + + void caretDelete(); + + void caretDeleteToStart(); + + void caretDeleteWord(); + protected: void drawCaret(gcn::Graphics* graphics, int x) override final; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 79cf0eff3..576ff9fd4 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1495,15 +1495,23 @@ void ChatWindow::resortChatLog(std::string line, Own own, } } - if (langChatTab && !channel.empty()) + if (!channel.empty()) { - if (langChatTab->getChannelName() == channel) + if (langChatTab) { - langChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); + if (langChatTab->getChannelName() == channel) + { + langChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); + } + else if (mShowAllLang) + { + langChatTab->chatLog(prefix + line, own, + ignoreRecord, tryRemoveColors); + } } else if (mShowAllLang) { - langChatTab->chatLog(prefix + line, own, + localChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); } } diff --git a/src/input/keyboarddata.h b/src/input/keyboarddata.h index 42b8f9fc6..ce4f35510 100644 --- a/src/input/keyboarddata.h +++ b/src/input/keyboarddata.h @@ -1974,7 +1974,84 @@ static const KeyData keyData[Input::KEY_TOTAL] = { Input::GRP_DEFAULT, &ActionManager::moveForward, Input::KEY_NO_VALUE, 50, - COND_GAME} + COND_GAME}, + {"keyGUICtrl", + INPUT_KEYBOARD, SDLK_LCTRL, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIb", + INPUT_KEYBOARD, SDLK_b, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIc", + INPUT_KEYBOARD, SDLK_c, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUId", + INPUT_KEYBOARD, SDLK_d, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIe", + INPUT_KEYBOARD, SDLK_e, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIf", + INPUT_KEYBOARD, SDLK_f, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIh", + INPUT_KEYBOARD, SDLK_h, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIk", + INPUT_KEYBOARD, SDLK_k, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIu", + INPUT_KEYBOARD, SDLK_u, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIv", + INPUT_KEYBOARD, SDLK_v, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyGUIw", + INPUT_KEYBOARD, SDLK_w, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_GUICHAN, + nullptr, + Input::KEY_NO_VALUE, 50, + COND_DEFAULT} }; #endif // INPUT_KEYBOARDDATA_H diff --git a/src/input/keydata.h b/src/input/keydata.h index aea8c9244..6c2d6901c 100644 --- a/src/input/keydata.h +++ b/src/input/keydata.h @@ -342,6 +342,17 @@ namespace Input KEY_SHOW_WINDOWS, KEY_CHAT_MOD, KEY_MOVE_FORWARD, + KEY_GUI_CTRL, + KEY_GUI_B, + KEY_GUI_C, + KEY_GUI_D, + KEY_GUI_E, + KEY_GUI_F, + KEY_GUI_H, + KEY_GUI_K, + KEY_GUI_U, + KEY_GUI_V, + KEY_GUI_W, KEY_TOTAL }; } // namespace Input diff --git a/src/main.h b/src/main.h index 7bdcd2f25..a96abf039 100644 --- a/src/main.h +++ b/src/main.h @@ -45,8 +45,8 @@ * different interfaces, which have different implementations for each server. */ -#define SMALL_VERSION "1.3.11.10" -#define CHECK_VERSION "01.03.11.10" +#define SMALL_VERSION "1.3.11.24" +#define CHECK_VERSION "01.03.11.24" #ifdef HAVE_CONFIG_H #include "../config.h" diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 265f59cb1..7199d3b5c 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -42,6 +42,8 @@ #include "debug.h" +extern unsigned int tmwServerVersion; + namespace Ea { @@ -287,7 +289,15 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg, std::string sender_name = ((pos == std::string::npos) ? "" : chatMsg.substr(0, pos)); - if (sender_name != being->getName() && being->getType() == Being::PLAYER) + if (tmwServerVersion > 0) + { + // work around for "new" tmw server + sender_name = being->getName(); + if (sender_name.empty()) + sender_name = "?"; + } + else if (sender_name != being->getName() + && being->getType() == Being::PLAYER) { if (!being->getName().empty()) sender_name = being->getName(); diff --git a/src/net/sdltcpnet.cpp b/src/net/sdltcpnet.cpp index 4ea659ecf..b891ee3e5 100644 --- a/src/net/sdltcpnet.cpp +++ b/src/net/sdltcpnet.cpp @@ -89,6 +89,7 @@ int TcpNet::resolveHost(IPaddress *const address, const char *const host, TcpNet::Socket TcpNet::open(IPaddress *const ip) { const TcpNet::Socket sock = SDLNet_TCP_Open(ip); +#ifndef __native_client__ if (sock && ip) { const TCPsocketHack *const hack @@ -118,6 +119,7 @@ TcpNet::Socket TcpNet::open(IPaddress *const ip) } } } +#endif return sock; } diff --git a/src/particle/particleinfo.h b/src/particle/particleinfo.h new file mode 100644 index 000000000..a0bdb8397 --- /dev/null +++ b/src/particle/particleinfo.h @@ -0,0 +1,41 @@ +/* + * The ManaPlus Client + * Copyright (C) 2013 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef PARTICLE_PARTICLEINFO_H +#define PARTICLE_PARTICLEINFO_H + +#include "particle/particle.h" + +#include <string> +#include <vector> + +struct ParticleInfo +{ + ParticleInfo() : + files(), + particles() + { + } + + std::vector<std::string> files; + std::vector<Particle*> particles; +}; + +#endif // PARTICLE_PARTICLEINFO_H diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index 76cde005a..ff8da65c9 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -126,7 +126,7 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, return false; const gcn::ClipRectangle &top = mClipStack.top(); - if (!top.height) + if (!top.width || !top.height) return false; const SDL_Rect &bounds = image->mBounds; @@ -161,7 +161,7 @@ void SDLGraphics::drawImagePattern(const Image *const image, return; const gcn::ClipRectangle &top = mClipStack.top(); - if (!top.height) + if (!top.width || !top.height) return; const SDL_Rect &bounds = image->mBounds; @@ -212,7 +212,7 @@ void SDLGraphics::drawRescaledImagePattern(const Image *const image, return; const gcn::ClipRectangle &top = mClipStack.top(); - if (!top.height) + if (!top.width || !top.height) return; Image *const tmpImage = image->SDLgetScaledImage( @@ -264,7 +264,7 @@ void SDLGraphics::calcImagePattern(ImageVertexes* const vert, return; const gcn::ClipRectangle &top = mClipStack.top(); - if (!top.height) + if (!top.width || !top.height) return; const SDL_Rect &bounds = image->mBounds; @@ -341,7 +341,7 @@ void SDLGraphics::calcTileSDL(ImageVertexes *const vert, int x, int y) const return; const gcn::ClipRectangle &top = mClipStack.top(); - if (!top.height) + if (!top.width || !top.height) return; const Image *const image = vert->image; diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index f7b1f6349..03b23f01d 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -413,12 +413,13 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) { if (xmlNameEqual(itemChild, "sprite")) { - std::string attackParticle = XML::getProperty( - itemChild, "particle-effect", ""); - itemInfo->setParticleEffect(attackParticle); - loadSpriteRef(itemInfo, itemChild); } + else if (xmlNameEqual(itemChild, "particlefx")) + { + display.particles.push_back(reinterpret_cast<const char*>( + itemChild->xmlChildrenNode->content)); + } else if (xmlNameEqual(itemChild, "sound")) { loadSoundRef(itemInfo, itemChild); diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index cc7cc41c7..5845138d2 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -41,7 +41,6 @@ ItemInfo::ItemInfo() : mDescription(), mEffect(), mType(ITEM_UNUSABLE), - mParticle(), mWeight(0), mView(0), mId(0), diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 43f645e58..76a9b78c7 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -118,12 +118,6 @@ class ItemInfo final const std::string getName(const unsigned char color) const A_WARN_UNUSED; - void setParticleEffect(const std::string &particleEffect) - { mParticle = particleEffect; } - - std::string getParticleEffect() const A_WARN_UNUSED - { return mParticle; } - void setDisplay(const SpriteDisplay &display) { mDisplay = display; } @@ -318,7 +312,6 @@ class ItemInfo final std::string mDescription; /**< Short description. */ std::string mEffect; /**< Description of effects. */ ItemType mType; /**< Item type. */ - std::string mParticle; /**< Particle effect used with this item */ int mWeight; /**< Weight in grams. */ int mView; /**< Item ID of how this item looks. */ int mId; /**< Item ID */ diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index a1b087102..1e94b06f2 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -900,7 +900,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, } // create animation - if (!set) + if (!set || !config.getBoolValue("playMapAnimations")) continue; Animation *ani = new Animation; |