diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/being.cpp | 4 | ||||
-rw-r--r-- | src/effectmanager.cpp | 27 | ||||
-rw-r--r-- | src/effectmanager.h | 18 | ||||
-rw-r--r-- | src/graphics.cpp | 3 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/net/beinghandler.cpp | 3 |
8 files changed, 47 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2403b8f..fea11c55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -284,6 +284,8 @@ SET(SRCS configlistener.h configuration.cpp configuration.h + effectmanager.cpp + effectmanager.h engine.cpp engine.h equipment.cpp @@ -348,8 +350,6 @@ SET(SRCS textparticle.h tileset.h vector.h - effectmanager.cpp - effectmanager.h ) ADD_EXECUTABLE(aethyra ${SRCS}) diff --git a/src/being.cpp b/src/being.cpp index 3f4c5d9c..edacbc26 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -48,10 +48,6 @@ #include "utils/xml.h" #define BEING_EFFECTS_FILE "effects.xml" - -#include "utils/xml.h" - -#define BEING_EFFECTS_FILE "effects.xml" #define HAIR_FILE "hair.xml" int Being::instances = 0; diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 4b835355..89bbf8f5 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -21,14 +21,12 @@ */ #include "effectmanager.h" - -#include "particle.h" #include "log.h" +#include "particle.h" #include "sound.h" #include "utils/xml.h" - EffectManager::EffectManager() { XML::Document doc("effects.xml"); @@ -64,6 +62,29 @@ EffectManager::~EffectManager() } +bool EffectManager::trigger(int id, Being* being) +{ + bool rValue = false; + for (std::list<EffectDescription>::iterator i = mEffects.begin(); i != mEffects.end(); ++i) + { + if ((*i).id == id) + { + printf("Found effect, playing it"); + rValue = true; + if((*i).GFX != "") + { + Particle *selfFX; + selfFX = particleEngine->addEffect((*i).GFX, 0, 0); + being->controlParticle(selfFX); + } + if((*i).SFX != "") + sound.playSfx((*i).SFX); + break; + } + } + return rValue; +} + bool EffectManager::trigger(int id, int x, int y) { bool rValue = false; diff --git a/src/effectmanager.h b/src/effectmanager.h index b5451f27..e6671498 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -23,8 +23,12 @@ #ifndef _EFFECT_MANAGER_H #define _EFFECT_MANAGER_H -#include <string> #include <list> +#include <string> + +#include "being.h" + +class Being; class EffectManager { @@ -42,10 +46,16 @@ class EffectManager ~EffectManager(); /** - * Triggers a effect with the id, at x,y - * returns true if ID exists + * Triggers a effect with the id, at + * the specified being. + */ + bool trigger(int id, Being* being); + + /** + * Triggers a effect with the id, at + * the specified x and y coordinate. */ - bool trigger(int id, int x = 0, int y = 0); + bool trigger(int id, int x, int y); private: std::list<EffectDescription> mEffects; diff --git a/src/graphics.cpp b/src/graphics.cpp index 82404bce..4854d5fa 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -59,6 +59,7 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) displayFlags |= SDL_SWSURFACE; } + delete mScreen; mScreen = SDL_SetVideoMode(w, h, bpp, displayFlags); if (!mScreen) { @@ -71,7 +72,7 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) logger->log("Using video driver: %s", videoDriverName); } else { - logger->log("Using video driver: unkown"); + logger->log("Using video driver: unknown"); } const SDL_VideoInfo *vi = SDL_GetVideoInfo(); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 262c17e1..2e620095 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -401,6 +401,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) const int bpp = 0; const bool fullscreen = ((int) config.getValue("screen", 0) == 1); const bool hwaccel = ((int) config.getValue("hwaccel", 0) == 1); + // Try to set the desired video mode if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel)) { @@ -411,7 +412,9 @@ void Setup_Video::action(const gcn::ActionEvent &event) } // Initialize for drawing + graphics->_endDraw(); graphics->_beginDraw(); + graphics->updateScreen(); // TODO: Find out why the drawing area doesn't resize without a restart. new OkDialog("Screen resolution changed", diff --git a/src/main.cpp b/src/main.cpp index 378e913e..818a4e32 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -822,7 +822,7 @@ int main(int argc, char *argv[]) if (graphics->getWidth() > login_wallpaper->getWidth() || graphics->getHeight() > login_wallpaper->getHeight()) { - graphics->setColor(gcn::Color(64, 64, 64)); + graphics->setColor(gcn::Color(255, 255, 255)); graphics->fillRectangle(gcn::Rectangle( 0, 0, graphics->getWidth(), graphics->getHeight())); } diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 3c022af6..4f525e8d 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -265,8 +265,7 @@ void BeingHandler::handleMessage(MessageIn *msg) int effectType = msg->readInt32(); Being* being = beingManager->findBeing(id); - effectManager->trigger(effectType, (int) being->getPixelX(), - (int) being->getPixelY()); + effectManager->trigger(effectType, being); break; } |