summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp13
-rw-r--r--src/gui/chatinput.cpp4
-rw-r--r--src/gui/chatinput.h6
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/main.cpp2
-rw-r--r--src/particle.cpp8
-rw-r--r--src/particle.h3
-rw-r--r--src/particleemitter.cpp12
9 files changed, 35 insertions, 19 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 7ba9ddb9..bdb27384 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -535,10 +535,19 @@ Being::logic()
//Update particle effects
for ( std::list<Particle *>::iterator i = mChildParticleEffects.begin();
- i != mChildParticleEffects.end();
- i++)
+ i != mChildParticleEffects.end();
+
+ )
{
(*i)->setPosition((float)mPx + 16.0f, (float)mPy + 32.0f);
+ if (!(*i)->isAlive())
+ {
+ (*i)->kill();
+ i = mChildParticleEffects.erase(i);
+ }
+ else {
+ i++;
+ }
}
}
diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp
index 2aa5a159..fc5d6aab 100644
--- a/src/gui/chatinput.cpp
+++ b/src/gui/chatinput.cpp
@@ -26,9 +26,11 @@
ChatInput::ChatInput()
{
setVisible(false);
+
+ addFocusListener(this);
}
-void ChatInput::focusLost()
+void ChatInput::focusLost(const gcn::Event &event)
{
setVisible(false);
}
diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h
index 59d0daf3..da2342ae 100644
--- a/src/gui/chatinput.h
+++ b/src/gui/chatinput.h
@@ -26,10 +26,12 @@
#include "textfield.h"
+#include <guichan/focuslistener.hpp>
+
/**
* The chat input hides when it loses focus. It is also invisible by default.
*/
-class ChatInput : public TextField
+class ChatInput : public TextField, public gcn::FocusListener
{
public:
/**
@@ -41,7 +43,7 @@ class ChatInput : public TextField
* Called if the chat input loses focus. It will set itself to
* invisible as result.
*/
- void focusLost();
+ void focusLost(const gcn::Event &event);
};
#endif
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index fb7144a1..b9b15429 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -199,10 +199,6 @@ void
Gui::logic()
{
gcn::Gui::logic();
-
- // Work around Guichan bug of only applying focus on mouse or keyboard
- // events.
- mFocusHandler->applyChanges();
}
void
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 8930af3e..cd1507a7 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -264,7 +264,7 @@ void Setup_Video::apply()
}
}
} else {
- new OkDialog("Switching to FullScreen",
+ new OkDialog("Switching to full screen",
"Restart needed for changes to take effect.");
}
config.setValue("screen", fullscreen ? 1 : 0);
diff --git a/src/main.cpp b/src/main.cpp
index 3550c298..79ba49b4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -678,6 +678,8 @@ int main(int argc, char *argv[])
// Log the tmw version
#ifdef PACKAGE_VERSION
logger->log("The Mana World v%s", PACKAGE_VERSION);
+#else
+ logger->log("The Mana World - version not defined");
#endif
initXML();
diff --git a/src/particle.cpp b/src/particle.cpp
index 509c20ee..805da102 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -39,6 +39,8 @@
#include "utils/fastsqrt.h"
#include "utils/xml.h"
+#define SIN45 0.707106781f
+
class Graphics;
class Image;
@@ -122,7 +124,7 @@ Particle::update()
if (mTarget && mAcceleration != 0.0f)
{
- float distX = mPosX - mTarget->getPosX();
+ float distX = (mPosX - mTarget->getPosX()) * SIN45;
float distY = mPosY - mTarget->getPosY();
float distZ = mPosZ - mTarget->getPosZ();
float invHypotenuse;
@@ -167,8 +169,8 @@ Particle::update()
// Update position
mPosX += mVectorX;
- mPosY += mVectorY;
- mPosZ += mVectorZ;
+ mPosY += mVectorY * SIN45;
+ mPosZ += mVectorZ * SIN45;
// Update other stuff
if (mLifetimeLeft > 0)
diff --git a/src/particle.h b/src/particle.h
index 7a747a5f..9e9223c7 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -243,6 +243,9 @@ class Particle : public Sprite
void setDieDistance(float dist)
{ mInvDieDistance = 1.0f / dist; }
+ bool isAlive()
+ { return mAlive; }
+
/**
* Manually marks the particle for deletion
*/
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 2387c652..5b5e86b9 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -76,10 +76,14 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
{
mParticlePosY = readMinMax(propertyNode, 0.0f);
+ mParticlePosY.minVal *= SIN45;
+ mParticlePosY.maxVal *= SIN45;
}
else if (name == "position-z")
{
mParticlePosZ = readMinMax(propertyNode, 0.0f);
+ mParticlePosZ.minVal *= SIN45;
+ mParticlePosZ.maxVal *= SIN45;
}
else if (name == "image")
{
@@ -236,10 +240,6 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
ParticleEmitter::~ParticleEmitter()
{
- if (mParticleImage)
- {
- mParticleImage->decRef();
- }
}
@@ -294,8 +294,8 @@ ParticleEmitter::createParticles()
float power = mParticlePower.value();
newParticle->setVector(
cos(angleH) * cos(angleV) * power,
- sin(angleH) * cos(angleV) * SIN45 * power,
- sin(angleV) * SIN45 * power
+ sin(angleH) * cos(angleV) * power,
+ sin(angleV) * power
);
newParticle->setRandomnes(mParticleRandomnes.value());