diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-12-14 19:35:27 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-12-14 19:35:27 +0000 |
commit | 55494057bd7e1ae5e6260816b1c5b2a84e2ff573 (patch) | |
tree | e8dac9033909041361c1ca72d8955884f2a85b7f | |
parent | 1ccc963719897ca290104f42adc9c37b792feb7a (diff) | |
download | mana-55494057bd7e1ae5e6260816b1c5b2a84e2ff573.tar.gz mana-55494057bd7e1ae5e6260816b1c5b2a84e2ff573.tar.bz2 mana-55494057bd7e1ae5e6260816b1c5b2a84e2ff573.tar.xz mana-55494057bd7e1ae5e6260816b1c5b2a84e2ff573.zip |
Removed the rather useless remaining draw function from the engine class and
fixed an issue with fading out damage texts (they were sometimes fully opaque
at the end of fading out).
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | src/being.cpp | 33 | ||||
-rw-r--r-- | src/being.h | 1 | ||||
-rw-r--r-- | src/engine.cpp | 5 | ||||
-rw-r--r-- | src/engine.h | 9 | ||||
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/utils/wingettimeofday.h | 8 |
7 files changed, 31 insertions, 40 deletions
@@ -1,8 +1,15 @@ -2006-12-12 Eugenio Favalli <elvenprogrammer@gmail.com> +2006-12-14 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/game.cpp, src/engine.h, src/engine.cpp: Removed the rather + useless remaining draw function from the engine class. + * src/being.cpp, src/being.h: Fixed an issue with fading out damage + texts (they were sometimes fully opaque at the end of fading out). + +2006-12-12 Eugenio Favalli <elvenprogrammer@gmail.com> * The Mana World.dev, tmw.cbp: Updated project files. - * src/gui/updatewindow.cpp, src/gui/updatewindow.h, src/main.cpp: Added - Adler32 checksum for updates. + * src/gui/updatewindow.cpp, src/gui/updatewindow.h, src/main.cpp: + Added Adler32 checksum for updates. * src/net/playerhandler.cpp: Fixed crash when selecting an item after death. * data/items.xml: Fixed defense values for sweaters. diff --git a/src/being.cpp b/src/being.cpp index b3cb9906..d4f68fac 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -62,7 +62,6 @@ Being::Being(Uint32 id, Uint16 job, Map *map): mSex(2), mSpeechTime(0), mDamageTime(0), - mShowSpeech(false), mShowDamage(false), mPx(0), mPy(0), mSprites(VECTOREND_SPRITE, NULL), mEquipmentSpriteIDs(VECTOREND_SPRITE, 0) @@ -134,16 +133,14 @@ void Being::setSpeech(const std::string &text, Uint32 time) { mSpeech = text; - mSpeechTime = tick_time; - mShowSpeech = true; + mSpeechTime = 500; } void Being::setDamage(Sint16 amount, Uint32 time) { mDamage = amount ? toString(amount) : "miss"; - mDamageTime = tick_time; - mShowDamage = true; + mDamageTime = 300; } void @@ -297,17 +294,13 @@ Being::nextStep() void Being::logic() { - // Determine whether speech should still be displayed - if (get_elapsed_time(mSpeechTime) > 5000) - { - mShowSpeech = false; - } + // Reduce the time that speech is still displayed + if (mSpeechTime > 0) + mSpeechTime--; - // Determine whether damage should still be displayed - if (get_elapsed_time(mDamageTime) > 3000) - { - mShowDamage = false; - } + // Reduce the time that damage is still displayed + if (mDamageTime > 0) + mDamageTime--; // Update pixel coordinates mPx = mX * 32 + getXOffset(); @@ -365,7 +358,7 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) int py = mPy + offsetY; // Draw speech above this being - if (mShowSpeech) + if (mSpeechTime > 0) { graphics->setFont(speechFont); graphics->setColor(gcn::Color(255, 255, 255)); @@ -373,7 +366,7 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) } // Draw damage above this being - if (mShowDamage && get_elapsed_time(mDamageTime) > 250) + if (mDamageTime > 0 && mDamageTime < 275) { // Selecting the right color if (mDamage == "miss") @@ -390,13 +383,13 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) } int textY = (getType() == MONSTER) ? 32 : 70; - int ft = get_elapsed_time(mDamageTime) - 1500; - float a = (ft > 0) ? 1.0 - ft / 1500.0 : 1.0; + int ft = 150 - mDamageTime; + float a = (ft > 0) ? 1.0 - ft / 150.0 : 1.0; graphics->setColor(gcn::Color(255, 255, 255, (int)(255 * a))); graphics->drawText(mDamage, px + 16, - py - textY - get_elapsed_time(mDamageTime) / 100, + py - textY - (300 - mDamageTime) / 10, gcn::Graphics::CENTER); // Reset alpha value diff --git a/src/being.h b/src/being.h index 65b501d6..38f44fb4 100644 --- a/src/being.h +++ b/src/being.h @@ -371,7 +371,6 @@ class Being : public Sprite Uint8 mSex; Uint32 mSpeechTime; Uint32 mDamageTime; - bool mShowSpeech, mShowDamage; Sint32 mPx, mPy; /**< Pixel coordinates */ std::vector<AnimatedSprite*> mSprites; diff --git a/src/engine.cpp b/src/engine.cpp index bcf6ad8c..6ed02a9d 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -128,8 +128,3 @@ void Engine::logic() beingManager->logic(); gui->logic(); } - -void Engine::draw(Graphics *graphics) -{ - gui->draw(); -} diff --git a/src/engine.h b/src/engine.h index dbe1fddc..90cee9c0 100644 --- a/src/engine.h +++ b/src/engine.h @@ -26,12 +26,12 @@ #include <iosfwd> -class Graphics; class Map; class Network; /** - * Game engine that does the main drawing. + * Game engine. Actually hardly does anything anymore except keeping track of + * the current map and loading the emotes. */ class Engine { @@ -61,11 +61,6 @@ class Engine */ void logic(); - /** - * Draws everything on the screen. - */ - void draw(Graphics *graphics); - private: Map *mCurrentMap; Network *mNetwork; diff --git a/src/game.cpp b/src/game.cpp index 0cfc72e5..97427860 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -363,7 +363,7 @@ void Game::logic() get_elapsed_time(mDrawTime / 10) > mMinFrameTime) { frame++; - engine->draw(graphics); + gui->draw(); graphics->updateScreen(); mDrawTime += mMinFrameTime; diff --git a/src/utils/wingettimeofday.h b/src/utils/wingettimeofday.h index 0f8b767a..a5537f39 100644 --- a/src/utils/wingettimeofday.h +++ b/src/utils/wingettimeofday.h @@ -1,5 +1,5 @@ /*
- * The Mana World Server
+ * The Mana World
* Copyright 2004 The Mana World Development Team
*
* This file is part of The Mana World.
@@ -17,10 +17,12 @@ * You should have received a copy of the GNU General Public License
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
*/
-#ifndef _TMWSERV_WINGETTIMEOFDAY_H_
-#define _TMWSERV_WINGETTIMEOFDAY_H_
+#ifndef _TMW_WINGETTIMEOFDAY_H_
+#define _TMW_WINGETTIMEOFDAY_H_
#ifdef WIN32
|