diff options
author | Ira Rice <irarice@gmail.com> | 2008-12-26 22:45:24 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-26 22:45:24 -0700 |
commit | 4854bc433cd74bb072d02e25aa416f06ff6257b4 (patch) | |
tree | 13fbae3ee50ea27829d31fb328d0ef761733dcc9 | |
parent | 0289c04b5454b42676f3b6beb68571e71617500c (diff) | |
download | mana-4854bc433cd74bb072d02e25aa416f06ff6257b4.tar.gz mana-4854bc433cd74bb072d02e25aa416f06ff6257b4.tar.bz2 mana-4854bc433cd74bb072d02e25aa416f06ff6257b4.tar.xz mana-4854bc433cd74bb072d02e25aa416f06ff6257b4.zip |
Fixed a potential leak in setup, changed the default border color to
white for wallpapers (matches our wallpapers better), and fixed the
effect manager.
Signed-off-by: Ira Rice <irarice@gmail.com>
-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; } |