From e9534603c234419cd9f9dd00fce0ed28a9037aab Mon Sep 17 00:00:00 2001 From: rhn Date: Wed, 30 Jul 2014 18:07:30 +0200 Subject: [PATCH 1/6] Fixed sound on object pickup with dialog --- client/CPlayerInterface.cpp | 4 ++++ lib/mapObjects/CObjectClassesHandler.cpp | 5 +++++ lib/mapObjects/CObjectClassesHandler.h | 3 +++ 3 files changed, 12 insertions(+) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index d243f2462..d75674076 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -22,6 +22,7 @@ #include "../lib/Connection.h" #include "../lib/CSpellHandler.h" #include "../lib/CTownHandler.h" +#include "../lib/mapObjects/CObjectClassesHandler.h" // For displaying correct UI when interacting with objects #include "../lib/BattleState.h" #include "../lib/JsonNode.h" #include "CMusicHandler.h" @@ -1519,6 +1520,9 @@ void CPlayerInterface::objectRemoved( const CGObjectInstance *obj ) { const CGHeroInstance *h = static_cast(obj); heroKilled(h); + } else if (VLC->objtypeh->getObjectHandlerName(obj->ID) == "pickable") { + waitWhileDialog(); + CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); } } diff --git a/lib/mapObjects/CObjectClassesHandler.cpp b/lib/mapObjects/CObjectClassesHandler.cpp index 8c276e05a..f47c20a3c 100644 --- a/lib/mapObjects/CObjectClassesHandler.cpp +++ b/lib/mapObjects/CObjectClassesHandler.cpp @@ -318,6 +318,11 @@ std::string CObjectClassesHandler::getObjectName(si32 type, si32 subtype) const return getObjectName(type); } +std::string CObjectClassesHandler::getObjectHandlerName(si32 type) const +{ + return objects.at(type)->handlerName; +} + void AObjectTypeHandler::setType(si32 type, si32 subtype) { this->type = type; diff --git a/lib/mapObjects/CObjectClassesHandler.h b/lib/mapObjects/CObjectClassesHandler.h index 30a4ef88f..526fd8ad1 100644 --- a/lib/mapObjects/CObjectClassesHandler.h +++ b/lib/mapObjects/CObjectClassesHandler.h @@ -221,6 +221,9 @@ public: std::string getObjectName(si32 type) const; std::string getObjectName(si32 type, si32 subtype) const; + + /// Returns handler string describing the handler (for use in client) + std::string getObjectHandlerName(si32 type) const; template void serialize(Handler &h, const int version) { From a491c1130547ca351b4b2a642549d8dd61bdf65e Mon Sep 17 00:00:00 2001 From: rhn Date: Wed, 30 Jul 2014 19:49:19 +0200 Subject: [PATCH 2/6] Fixed sound effect when hero disappears --- client/CPlayerInterface.cpp | 13 ++++++++++--- lib/CSoundBase.h | 6 ++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index d75674076..ae29818db 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1516,13 +1516,20 @@ void CPlayerInterface::centerView (int3 pos, int focusTime) void CPlayerInterface::objectRemoved( const CGObjectInstance *obj ) { EVENT_HANDLER_CALLED_BY_CLIENT; + + std::string handlerName = VLC->objtypeh->getObjectHandlerName(obj->ID); + if (handlerName == "pickable") { + waitWhileDialog(); + CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); + } else if ((handlerName == "monster") || (handlerName == "hero")) { + waitWhileDialog(); + CCS->soundh->playSound(soundBase::KillFade); + } + if(obj->ID == Obj::HERO && obj->tempOwner == playerID) { const CGHeroInstance *h = static_cast(obj); heroKilled(h); - } else if (VLC->objtypeh->getObjectHandlerName(obj->ID) == "pickable") { - waitWhileDialog(); - CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); } } diff --git a/lib/CSoundBase.h b/lib/CSoundBase.h index c67ff1010..7ad38d2b1 100644 --- a/lib/CSoundBase.h +++ b/lib/CSoundBase.h @@ -3,6 +3,9 @@ // Use some magic to keep the list of files and their code name in sync. #define VCMI_SOUND_LIST \ +/* Sounds for map actions */ \ +VCMI_SOUND_NAME(KillFade) VCMI_SOUND_FILE(KILLFADE.wav) /* hero or monster disappears */ \ +/* Other sounds (TODO: separate out the sounds for units, spells and the rest */ \ VCMI_SOUND_NAME(AAGLAttack) VCMI_SOUND_FILE(AAGLATTK.wav) \ VCMI_SOUND_NAME(AAGLDefend) VCMI_SOUND_FILE(AAGLDFND.wav) \ VCMI_SOUND_NAME(AAGLKill) VCMI_SOUND_FILE(AAGLKILL.wav) \ @@ -515,7 +518,6 @@ VCMI_SOUND_NAME(ITRGKill) VCMI_SOUND_FILE(ITRGKILL.wav) \ VCMI_SOUND_NAME(ITRGMove) VCMI_SOUND_FILE(ITRGMOVE.wav) \ VCMI_SOUND_NAME(ITRGWNCE) VCMI_SOUND_FILE(ITRGWNCE.wav) \ VCMI_SOUND_NAME(KEEPShot) VCMI_SOUND_FILE(KEEPSHOT.wav) \ -VCMI_SOUND_NAME(KillFADE) VCMI_SOUND_FILE(KILLFADE.wav) \ VCMI_SOUND_NAME(LANDKill) VCMI_SOUND_FILE(LANDKILL.wav) \ VCMI_SOUND_NAME(LANDMINE) VCMI_SOUND_FILE(LANDMINE.wav) \ VCMI_SOUND_NAME(LCRSAttack) VCMI_SOUND_FILE(LCRSATTK.wav) \ @@ -1033,4 +1035,4 @@ public: }; #undef VCMI_SOUND_NAME #undef VCMI_SOUND_FILE -}; \ No newline at end of file +}; From a6151a5296633da1893d4e66f87bed2962aac5d8 Mon Sep 17 00:00:00 2001 From: rhn Date: Thu, 31 Jul 2014 11:35:27 +0200 Subject: [PATCH 3/6] added FLAC support --- lib/filesystem/ResourceID.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/filesystem/ResourceID.cpp b/lib/filesystem/ResourceID.cpp index 4209cb9c1..a1af79afa 100644 --- a/lib/filesystem/ResourceID.cpp +++ b/lib/filesystem/ResourceID.cpp @@ -110,6 +110,7 @@ EResType::Type EResTypeHelper::getTypeFromExtension(std::string extension) (".AVI", EResType::VIDEO) (".MP3", EResType::MUSIC) (".OGG", EResType::MUSIC) + (".FLAC", EResType::MUSIC) (".ZIP", EResType::ARCHIVE_ZIP) (".LOD", EResType::ARCHIVE_LOD) (".PAC", EResType::ARCHIVE_LOD) From c3a4f15edab26523a4661f59f745108b8292d2fc Mon Sep 17 00:00:00 2001 From: rhn Date: Thu, 31 Jul 2014 11:54:47 +0200 Subject: [PATCH 4/6] Updated build instructions with Fedora focus --- README.linux | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/README.linux b/README.linux index 72346f3a5..12f914307 100644 --- a/README.linux +++ b/README.linux @@ -31,43 +31,50 @@ On Debian-based systems (e.g. Ubuntu) run: sudo apt-get install cmake g++ libsdl1.2debian libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev zlib1g-dev libavformat-dev libswscale-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-locale-dev qtbase5-dev On RPM-based distributions (e.g. Fedora) run: - sudo yum install cmake gcc-c++ SDL-devel SDL_image-devel SDL_ttf-devel SDL_mixer-devel boost boost-devel boost-filesystem boost-system boost-thread boost-program-options boost-locale zlib-devel ffmpeg-devel ffmpeg-libs + sudo yum install cmake gcc-c++ SDL2-devel SDL2_image-devel SDL2_ttf-devel SDL2_mixer-devel boost boost-devel boost-filesystem boost-system boost-thread boost-program-options boost-locale zlib-devel ffmpeg-devel ffmpeg-libs II. Getting the sources VCMI is still in development. We recommend the following initial directory structure: trunk -trunk/src -> contains sources and is under SVN control +trunk/vcmi -> contains sources and is under git control trunk/build -> contains build output, makefiles, object files,... You can get latest sources with subversion: - cd trunk - svn co http://svn.code.sf.net/p/vcmi/code/trunk/ + git clone https://github.com/vcmi/vcmi.git III. Compilation Run configure: mkdir build && cd build - cmake ../src + cmake ../vcmi Additional options that you may want to use: To enable debugging: -DCMAKE_BUILD_TYPE=Debug -To enable launcher: -DENABLE_LAUNCHER=Yes +To change installation directory: -DCMAKE_INSTALL_PREFIX=$absolute_path_to_directory Notice: -The ../src/ is not a typo, it will place makefile scripts into the build dir +The ../vcmi/ is not a typo, it will place makefile scripts into the build dir as the build dir is your working dir when calling CMake. Then build vcmi: - make -j2 (j2 = compile with 2 cpu cores, you can specifiy any value) + make -j2 (j2 = compile with 2 threads, you can specify any value) -That will generate vcmiclient, vcmiserver as well as 3 .so libraries. +That will generate vcmiclient, vcmiserver, vcmilauncher as well as 3 .so libraries. III. Installing binaries To install VCMI you can use "make install" command however generation of distribution-specific packages is usually a better idea. In most cases this can be achieved using tool called "checkinstall" -If you're compiling vcmi for development puposes, it's better to use links instead. +If you're compiling vcmi for development puposes, the easiest is to use cmake prefix and then make install: + +# mkdir .../trunk/install +# cmake -DCMAKE_INSTALL_PREFIX=.../trunk/install ../vcmi +# make && make install +# .../trunk/install/bin/vcmiclient + + +it's better to use links instead. Go to /BIN_PATH/, and type: ln -s .../trunk/build/client/vcmiclient @@ -86,5 +93,3 @@ Go to /LIB_PATH/vcmi/AI, and type: Go to /DATA_PATH/vcmi, and type: ln -s .../trunk/source/config ln -s .../trunk/source/Mods - - From e4fce8fc8f184ae07625c7d2fd190e326af41289 Mon Sep 17 00:00:00 2001 From: rhn Date: Wed, 6 Aug 2014 17:14:31 +0200 Subject: [PATCH 5/6] fixed object types playing sounds --- client/CPlayerInterface.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index ae29818db..329f707f2 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1516,16 +1516,16 @@ void CPlayerInterface::centerView (int3 pos, int focusTime) void CPlayerInterface::objectRemoved( const CGObjectInstance *obj ) { EVENT_HANDLER_CALLED_BY_CLIENT; - - std::string handlerName = VLC->objtypeh->getObjectHandlerName(obj->ID); - if (handlerName == "pickable") { - waitWhileDialog(); - CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); - } else if ((handlerName == "monster") || (handlerName == "hero")) { - waitWhileDialog(); - CCS->soundh->playSound(soundBase::KillFade); + if (LOCPLINT->cb->getCurrentPlayer() == playerID) { + std::string handlerName = VLC->objtypeh->getObjectHandlerName(obj->ID); + if ((handlerName == "pickable") || (handlerName == "scholar") || (handlerName== "artifact") || (handlerName == "pandora") { + waitWhileDialog(); + CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); + } else if ((handlerName == "monster") || (handlerName == "hero")) { + waitWhileDialog(); + CCS->soundh->playSound(soundBase::KillFade); + } } - if(obj->ID == Obj::HERO && obj->tempOwner == playerID) { const CGHeroInstance *h = static_cast(obj); From c8929b364b5cac7081d05af77a6d67ffc34a0916 Mon Sep 17 00:00:00 2001 From: rhn Date: Wed, 6 Aug 2014 17:55:29 +0200 Subject: [PATCH 6/6] fixed typo --- client/CPlayerInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 329f707f2..0839fdf42 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1518,7 +1518,7 @@ void CPlayerInterface::objectRemoved( const CGObjectInstance *obj ) EVENT_HANDLER_CALLED_BY_CLIENT; if (LOCPLINT->cb->getCurrentPlayer() == playerID) { std::string handlerName = VLC->objtypeh->getObjectHandlerName(obj->ID); - if ((handlerName == "pickable") || (handlerName == "scholar") || (handlerName== "artifact") || (handlerName == "pandora") { + if ((handlerName == "pickable") || (handlerName == "scholar") || (handlerName== "artifact") || (handlerName == "pandora")) { waitWhileDialog(); CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); } else if ((handlerName == "monster") || (handlerName == "hero")) {