From 00fb4bde7974a20aacfc1c52e48fff2faee2d385 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Fri, 4 May 2007 13:09:25 +0000 Subject: Merged particle engine into main eAthena branch. --- ChangeLog | 838 +++++++++++++++++++++++++------------------- README | 1 - src/CMakeLists.txt | 10 + src/Makefile.am | 12 +- src/animationparticle.cpp | 51 +++ src/animationparticle.h | 49 +++ src/being.cpp | 98 ++++-- src/being.h | 10 +- src/engine.cpp | 7 + src/game.cpp | 5 + src/graphics.cpp | 11 + src/graphics.h | 8 + src/gui/debugwindow.cpp | 10 + src/gui/debugwindow.h | 1 + src/imageparticle.cpp | 67 ++++ src/imageparticle.h | 46 +++ src/map.cpp | 23 ++ src/map.h | 25 +- src/net/beinghandler.cpp | 17 +- src/particle.cpp | 366 +++++++++++++++++++ src/particle.h | 278 +++++++++++++++ src/particleemitter.cpp | 313 +++++++++++++++++ src/particleemitter.h | 108 ++++++ src/resources/mapreader.cpp | 24 ++ src/simpleanimation.cpp | 87 ++++- src/simpleanimation.h | 27 +- src/utils/fastsqrt.h | 23 ++ src/utils/minmax.h | 47 +++ src/utils/wingettimeofday.h | 226 ++++++------ src/utils/xml.cpp | 23 ++ src/utils/xml.h | 11 + tmw.cbp | 20 ++ 32 files changed, 2313 insertions(+), 529 deletions(-) create mode 100644 src/animationparticle.cpp create mode 100644 src/animationparticle.h create mode 100644 src/imageparticle.cpp create mode 100644 src/imageparticle.h create mode 100644 src/particle.cpp create mode 100644 src/particle.h create mode 100644 src/particleemitter.cpp create mode 100644 src/particleemitter.h create mode 100644 src/utils/fastsqrt.h create mode 100644 src/utils/minmax.h diff --git a/ChangeLog b/ChangeLog index 74b6b931..ad63a707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,31 @@ -2007-04-22 Björn Steinbrink +2007-05-02 Philipp Sehmisch + + * src/particle.cpp: Fixed a compiler warning. + +2007-05-02 Björn Steinbrink + + * src/Makefile.am: Add the new particle subclasses to the automake + configuration. + * src/imageparticle.h, src/textparticle.h, src/particle.h, + src/animationparticle.h, src/CMakeLists.txt, src/particleemitter.cpp, + src/animationparticle.cpp, src/particle.cpp, src/imageparticle.cpp, + src/textparticle.cpp, src/utils/xml.cpp, src/utils/xml.h: Split the + particle class into subclasses based on their appeareance. + +2007-04-24 Philipp Sehmisch + + * src/particle.cpp, src/particle.h: Some minor code cleanups, speed + optimizations and a bit of documentation. + +2007-04-23 Philipp Sehmisch + + * data/graphics/particles/flame.particle.xml, + data/graphics/particles/blaze.png: Added two files I forgot with the last + commit. + * src/resources/mapreader.cpp, src/particle.cpp, src/particleemitter.cpp: + Using XML child node iteration macro. + +2007-04-22 Björn Steinbrink * src/configuration.cpp, src/utils/xml.h, src/resources/mapreader.cpp, src/resources/spritedef.cpp, src/resources/monsterdb.cpp, @@ -8,7 +35,17 @@ * src/resources/itemdb.cpp: Made the parameter checks more terse and manageable. -2007-04-15 Bjørn Lindeijer +2007-04-19 Philipp Sehmisch + + * src/resources/mapreader.cpp: Emitter positions are now read from map + files. + * src/engine.cpp: Removed the player follow effect used for testing. + * data/maps/new_4-1.tmx.gz, data/maps/new_5-1.tmx.gz: Added flame effect + to all lamps on the cave maps + * data/maps/new_9-1.tmx.gz: Added waterfall effect to the upper right + corner of NW woodland map. + +2007-04-15 Bjørn Lindeijer * src/openglgraphics.cpp: Rely on default 0 value for z axis. * src/CMakeLists.txt, src/gui/window.cpp, src/gui/widgets, @@ -22,6 +59,30 @@ problem with setting window content size which was introduced with the new resize grip. +2007-04-13 Björn Steinbrink + + * data/graphics/gui/CMakeLists.txt: Added target cursor graphics to + the set of files to be installed. + +2007-03-25 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Improved programming style and documentation + and added some small tweaks. + * src/engine.cpp, src/map.cpp, src/map.h, src/resources/mapreader.cpp: + Prepared getting the emitter positions from the map file by storing them + in the Map class and setting them up from the MapReader. + +2007-03-22 Philipp Sehmisch + + * src/simpleanimation.cpp, src/simpleanimation.h: Added new constructor + for simple animation that allows to build the animation based on an + xmlNodePtr pointing to an node. + * src/particle.cpp, src/particle.h: Added support for and + childtags for effect root particles. + * data/graphics/particles/playerglow.particle.xml: New player follow + effect that demonstrates an animated root particle with an emitter. + 2007-04-05 Eugenio Favalli * src/main.cpp: Unified storage of configuration, updates and @@ -45,19 +106,14 @@ * src/game.cpp: Screenshots are no longer saved directly in the users home directory on UNIX systems but in the sub folder /.tmw/. A chatlog message about the success of the screenshot saving does appear now. - Based on a patch by Patrick "the-me" Matthäi. + Based on a patch by Patrick "the-me" Matthäi. -2007-03-27 Bjørn Lindeijer +2007-03-27 Bjørn Lindeijer * src/main.cpp: Icon loading doesn't necessarily succeed, so better not crash when it doesn't. -2007-03-20 Philipp Sehmisch - - * src/gui/updatewindow.cpp: Cancel button is now disabled after - downloading is finished. - -2007-03-24 Bjørn Lindeijer +2007-03-24 Bjørn Lindeijer * src/main.cpp: Changed the order of network message handling and logic, in order to prevent an incoming character delete message from @@ -76,14 +132,14 @@ * src/gui/register.h, src/gui/register.cpp: Only enable Register button when all necessary fields are filled in. -2007-03-23 Bjørn Lindeijer +2007-03-23 Bjørn Lindeijer * src/gui/char_select.cpp, src/gui/char_select.h, src/net/charserverhandler.h, src/net/charserverhandler.cpp: Clarified the error message when character creation fails and made sure the character creation dialog doesn't close when creation failed. -2007-03-22 Bjørn Lindeijer +2007-03-22 Bjørn Lindeijer * src/gui/login.cpp, src/gui/login.h, src/gui/register.h, src/gui/register.cpp: Only enable login button when a username, @@ -99,7 +155,7 @@ data/icons/tmw-32x32.png: Removed 32x32 non-alpha layered window icon again, and instead used the icon in the executable on Windows. -2007-03-21 Bjørn Lindeijer +2007-03-21 Bjørn Lindeijer * src/main.cpp, src/gui/viewport.cpp, src/resources/image.h, src/resources/image.cpp: Reduced amount of useless logging, calculate @@ -122,6 +178,11 @@ src/resources/resourcemanager.cpp, src/resources/spriteset.cpp, src/resources/spritedef.h: Renamed Spriteset to ImageSet. +2007-03-20 Philipp Sehmisch + + * src/gui/updatewindow.cpp: Cancel button is now disabled after + downloading is finished. + 2007-03-20 David Athay * src/gui/viewport.cpp: Fixed target cursor animation, and changed @@ -140,9 +201,9 @@ src/net/equipmenthandler.cpp, src/localplayer.h, src/net/protocol.h: Added target cursor. -2007-03-18 Bjørn Lindeijer +2007-03-18 Bjørn Lindeijer - * docs/Makefile.am, docs/tmw.6: Added man page by Patrick Matthäi. + * docs/Makefile.am, docs/tmw.6: Added man page by Patrick Matthäi. * src/resources/image.cpp: Restored alpha layer check, since it should be more efficient in software mode when SDL knows an image doesn't use the alpha layer. @@ -167,16 +228,16 @@ 2007-03-18 Rogier Polak * src/main.cpp: Added (-v) version to the arguments. (Applied a patch - by Patrick Matthäi). + by Patrick Matthäi). * src/resources/image.cpp: Deleted the "pink code", which added transparancy with SDL_SetColorKey. -2007-03-18 Bjørn Lindeijer +2007-03-18 Bjørn Lindeijer * icons/tmw.ico, icons/tmw.png, icons/tmw.xpm: Replaced icons with the green globe that is also used on the website. -2007-03-14 Bjørn Lindeijer +2007-03-14 Bjørn Lindeijer * src/main.cpp, src/tmw.rc, data/icons/tmw-icon.png, data/icons/tmw-icon.xpm, data/icons/tmw.ico, data/icons/tmw-icon.ico, @@ -189,8 +250,10 @@ * src/simpleanimation.cpp, src/simpleanimation.h, src/CmakeLists.txt, src/Makefile.am: Added a simple animation class that hosts a looping animation without the action and direction stuff from AnimatedSprite. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp: Used said + simple animation class for animated particles. -2007-03-12 Bjørn Lindeijer +2007-03-12 Bjørn Lindeijer * data/graphics/items/armor-head-rangerhat.png: New version of ranger hat icon by Pauan. @@ -200,7 +263,15 @@ * src/map.cpp, src/gui/viewport.cpp: Fixed a bug that made the engine not draw the last row and column of the map. -2007-03-09 Bjørn Lindeijer +2007-03-09 Philipp Sehmisch + + * src/particle.cpp: Reimplemented physics mode that uses the default + square root function as fallback for systems where the fastInvSqrt + function doesn't work properly. + * src/particle.cpp, src/particle.h: Some performance optimizations + suggested by Rogier "Avaniel" Polak. + +2007-03-09 Bjørn Lindeijer * data/graphics/gui/target-cursor-blue.png, data/graphics/gui/target-cursor-red.png: Added targeting cursors by @@ -216,7 +287,7 @@ containers now display the button of the active tab pressed all the time. -2007-02-26 Bjørn Lindeijer +2007-02-26 Bjørn Lindeijer * configure.ac: Made OpenGL enabled by default. @@ -227,6 +298,17 @@ data/sfx/pinkie-hit1.ogg, data/sfx/pinkie-miss1.ogg, data/monsters.xml: New sound effects by Cosmostrator. +2007-02-25 Philipp Sehmisch + + * src/particle.h, src/particleemitter.h: Just some documentation work. + +2007-02-22 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Added new particle property "bounce" that makes + particles bounce off the ground and use it with the damage numbers. + + 2007-02-21 Philipp Sehmisch * src/gui/char-server.cpp, src/gui/updatewindow.cpp, src/gui/main.cpp, @@ -238,152 +320,183 @@ update archives and drop it in the customdata folder and the files in it override the default data and the updates. -2007-02-20 Bjørn Lindeijer - - * src/log.cpp: Applied patch by trapdoor to fix the usage of a - deprecated function on MacOS X 10.4 and later. - * src/being.cpp, src/monster.cpp, src/net/beinghandler.cpp, - src/localplayer.h, src/being.h, src/monster.h: Now different sounds - can play when a monster misses the player. - * src/main.cpp: Applied patch by trapdoor which makes TMW use a more - standard location for the data on MacOS X. +2007-02-15 Philipp Sehmisch -2007-02-17 Bjørn Lindeijer - - * data/help/header.txt, NEWS, README: Updated release date. - * data/graphics/sprites/Makefile.am, - data/graphics/sprites/CMakeLists.txt, data/graphics/CMakeLists.txt: - Excluded sprites directory from installed files. + * src/engine.cpp: The name conflict problem with guichan seems to be solved + with version 0.6.1. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Added support for animated particles. + * data/graphics/particles/playerglow.particle.xml: Created a new player + follow particle that spawns a swarm of animated bats that follow the + player. -2007-02-16 Rogier Polak +2007-02-09 Philipp Sehmisch - * src/gui/updatewindow.cpp: Fixed the update bug (hopefully), by - modifying the usage of the synchronisation between threads. Added a - check for existence of the updated file. + * src/particle.cpp: Fixed a misspelled include and another optimisation at + the vector calculation. -2007-02-15 Bjørn Lindeijer +2007-02-08 Philipp Sehmisch - * src/winver.h, README, configure.ac, data/help/header.txt, NEWS, - CMakeLists.txt: Changed version to 0.0.22.2. + * src/particle.cpp, src/utils/fastsqrt.h: Added a faster function to + calculate square roots and using it for hypotenuse calculations. Thanks + to Rogier aka Avaniel for finding the function. -2007-02-13 Philipp Sehmisch +2007-02-07 Philipp Sehmisch - * src/gui/register.cpp, src/logindata.h, src/main.cpp: Fixed the _M/_F - username bug. - -2007-02-11 Philipp Sehmisch - - * data/maps/new_1-9.tmx.gz, data/maps/new_1-14.tmx.gz, - data/maps/new_1-16.tmx.gz: Restored the cloud shadow overlays in the - woodland that got lost somehow during the halloween and christmas chaos. - -2007-02-11 Bjørn Lindeijer - - * data/graphics/sprites/chest_cotton_female.png: Removed this strange - duplicate. - * data/graphics/sprites/Makefile.am, - data/graphics/sprites/CMakeLists.txt: Some updates. - -2007-02-10 Philipp Sehmisch - - * src/gui/viewport.cpp: Fixed the bug in the scrolling limitation that made - it possible to scroll outside of the map in the south and east. - -2007-02-04 Bjørn Lindeijer - - * src/gui/menuwindow.cpp: Fixed a small glitch when dragging the menu - window. - -2007-02-03 Philipp Sehmisch - - * data/graphics/sprites/player-female-base.png: Made the standing and - walking of the female characters more feminine. - * data/equipment.xml, data/graphics/sprites/leg-cotton-male.png, - data/graphics/sprites/leg-cotton-male.xml, - data/graphics/sprites/leg-cotton-female.png, - data/graphics/sprites/leg-cotton-female.xml, - data/graphics/sprites/leg-jeans-male.png, - data/graphics/sprites/leg-jeans-male.xml, - data/graphics/sprites/leg-jeans-female.png, - data/graphics/sprites/leg-jeans-female.xml: Added different sprites - for male and female pants. - -2007-02-02 Bjørn Lindeijer - - * src/engine.h, src/engine.cpp, src/being.h, src/being.cpp: Moved - responsibility of loading emoticons to the Being class. - -2007-02-01 Eugenio Favalli - - * src/gui/updatewindow.cpp: File handle should be closed before - attempting to remove/rename files. - * src/gui/button.h: Fixed buttons loosing focus. - -2007-02-01 Bjørn Lindeijer - - * src/gui/updatewindow.cpp, src/gui/updatewindow.h: A bit of cleanup - and defined a helper function for calculating the alder32 checksum of - a file. Probably not fixing any bug though. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp: Renamed + Particle::MAX_PARTICLES to Particle::maxCount and read the value from + config ("particleMaxCount") + * src/particle.cpp: Added fast physics mode that replaces the trigonometric + calculations made for calculating the acceleration by much less cpu intense + but also less accurate formulas. To enable it set the config option + "particleFastPhysics" to "1". + * src/particle.cpp: Added the config option "particleEmitterSkip" that + allows to reduces the output of the emitters by making them spawn particles + only every n-th game tick. + * src/graphics.cpp, src/graphics.h: Added a new method + "drawImageTransparent" to the graphic engine that blits an image with an + alpha factor. + * src/particle.cpp: Using new drawImageTransparent method. 2007-02-01 Philipp Sehmisch - * data/equipment.xml, data/items.xml, - data/graphics/items/armor-chest-chainmail.png, - data/graphics/sprites/chest-chainmail-female.png, - data/graphics/sprites/chest-chainmail-female.xml, - data/graphics/sprites/chest-chainmail-male.png, - data/graphics/sprites/chest-chainmail-male.xml: Added chainmail by - "The Judge". The proposed values are: Item ID: 625, Sprite ID: 25, - Defence: 12, Weight: 120. - * data/graphics/sprites/chest-cotton-female.png: Huh? Shouldn't this - be on svn for ages? + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Implemented die-distance (particles are deleted + when they reached a certain proximity to their target) + * src/particle.cpp: Fixed a bug in the acceleration vector calculation. + * src/particle.cpp, src/particle.h: Fixed a problem with particles with + unlimited lifetime and fade-in. + * data/graphics/particles/playerglow.particle.xml: And again a new player + follow particle. This time it demonstrates die-distance and the fixed + acceleration vector calculation. + * src/engine.cpp, data/graphics/particles/snow.particle.xml, + data/graphics/particles/snowflake.png: I can't stand the begging anymore. + Now it snows in the snow area... and the forest... and the desert... and + under the earth... and indoors... Are you happy now, Rotonen and Elven? ;-) + * src/particle.cpp: Removed some debug log messages. + * src/being.cpp: Avoided crash when attempting to control an invalid + particle. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Cleaned the includes up. + +2007-01-31 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Changed some variable names. + * data/graphics/particles/waterfall.particle.xml, + data/graphics/particles/waterfall-a.png: New waterfall with Modanungs + waterfall particle. + * src/particle.cpp: forgot to remove a svn conflict marker and changed the + order of initialisations to fix some compiler warnings. 2007-01-30 Eugenio Favalli - * tmw.cbp: Updated Code::blocks project. - -2007-01-30 Bjørn Lindeijer - - * src/CMakeLists.txt, src/Makefile.am, src/net/packet.h, - src/net/packet.cpp, src/net/messageout.cpp: Removed unused Packet - class. - -2007-01-28 Bjørn Lindeijer - - * data/maps/new_8-1.tmx.gz, data/maps/new_11-1.tmx.gz: Map fixes by - Pauan. - -2007-01-23 Bjørn Lindeijer - - * src/gui/shoplistbox.cpp, docs/INSTALL/win32.txt, INSTALL, NEWS: - Upgraded to Guichan 0.6.1. - -2007-01-22 Bjørn Lindeijer - - * src/gui/updatewindow.cpp: Identify ourselves when requesting files - from the update server. - -2007-01-17 Eugenio Favalli - - * docs/win32-release.txt, src/gui/register.cpp, src/main.cpp: Changed - default server. + * tmw.cbp: Updated Code::blocks project file. + +2007-01-30 Philipp Sehmisch + + * src/net/beinghandler.cpp, data/graphics/particles/skillup.particle.xml: + Added different particle effect for job levelup. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Renamed "alphafade" to "fade-out", added new property + "fade-in". + * data/graphics/particles/playerglow.particle.xml: Added a new player effect + (a fire) demonstrating how to use fade-in and fade-out to fade one color + into another. + +2007-01-29 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Added a new particle property "alphafade" that makes + the particles fade into alpha before their lifetime ends. + * src/particle.cpp, src/particle.h: fixed an issue with particles that have + a lifetime of 0 and an issue with the momentum property. + * data/graphics/particles/waterfall.particle.xml, + data/graphics/particles/fog-medium-white-a.png, + data/graphics/particles/fog-medium-white-b.png, + data/graphics/particles/fog-medium-white-c.png: Added fog to the waterfall + effect demonstrating the new alphafade feature. + +2007-01-28 Philipp Sehmisch + + * src/utils/xml.cpp, src/utils/xml.h, src/particleemitter.cpp: Most values + are now read as floating point values from the emitter files. + * data/graphics/particles/fountain.particle.xml, + data/graphics/particles/hit.particle.xml, + data/graphics/particles/playerglow.particle.xml: Changed some values as + floating point values. Made the player follow effect magenta to improve the + visibility of the hit effects. + * src/engine.cpp, data/graphics/particles/waterfall.particle.xml: Removed + the fountain and added a waterfall instead. + * src/particle.h: Corrected the drawing order of the particles in relation + to the other sprites. + * src/gui/debugwindow.cpp, src/gui/debugwindow.h: Added particle count to + debug window. + * src/particle.cpp: Allowed momentum without acceleration and implement + the acceleration properly. + * src/utils/minmax.h, src/particleemitter.cpp, src/particleemitter.h: Added + a structure to hold a pair of numeric minimum and maximum values and used + it to store all numeric emitter properties. + * src/utils/randbetween.h: Removed (the functionality is now in struct + MinMax) + +2007-01-27 Bjørn Lindeijer + + * src/gui/shoplistbox.cpp: Fixed compilation against Guichan 0.6.1. + * src/utils/randbetween.h: Fixed integer overflow causing the + randBetween function not to work properly on Linux. + +2007-01-27 Philipp Sehmisch + + * src/net/beinghandler.cpp: Fixed a compiler issue. + +2007-01-27 Philipp Sehmisch + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h, src/engine.cpp: Emitter data is read from + external xml files. Reimplemented target-based particles with the + difference that they don't target beings or locations but other + particles (at the moment the host particle of the effect). + * src/being.cpp: Beings now move controlled particles to their center + instead of their upper left corner. + * data/graphics/particles/orb*: Added a bunch of new particles. + * data/graphics/particles/fountain.particle.xml: Reimplementation of + the fountain effect in XML. + * data/graphics/particles/playerglow.particle.xml: New effect that + spawns orbs that orbit around the origin. + * src/being.cpp, data/graphics/particles/hit.particle.xml: Added + particle effect on hit. + * src/net/beinghandler.cpp, + data/graphics/particles/levelup.particle.xml: Added particle effect on + levelup (own or other player). + +2007-01-24 Philipp Sehmisch + + * src/particle.cpp: Initialized all variables of the particles in the + constructor. + * src/particleemitter.cpp, src/particleemitter.h: minor cleanups. -2007-01-15 Bjørn Lindeijer +2007-01-22 Philipp Sehmisch - * src/gui/viewport.cpp, src/gui/viewport.h: Fixed issue where the - player stops walking. - * docs/INSTALL/win32.txt, INSTALL: Updated to mention Guichan 0.6.0. + * src/being.cpp, src/being.h, src/particle.cpp, src/particle.h + src/particleemitter.cpp, src/particleemitter.h, src/engine.cpp: + Particle effects are now created in child particles of the root + particle. Particle emitters have no longer a being they check every + frame. Instead beings have the ability to take control of particles. -2007-01-15 Eugenio Favalli +2007-01-19 Philipp Sehmisch - * data/help/header.txt, NEWS, README: Updated release date. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Implemented emitters that follow a being. + * src/engine.cpp: Added an emitter that follows the local player. + * src/particle.cpp: Fixed the crash on exit (reason was that the + mSpriteIterator wasn't initialized in every case) -2007-01-14 Eugenio Favalli +2007-01-18 Bjørn Lindeijer - * src/gui/updatewindow.cpp, src/main.cpp, tmw.cbp: Fixed windows - headers issues. + * src/particle.h, src/particle.cpp, src/CMakeLists.txt, + src/Makefile.am: Fixed compilation issues on Linux. -2007-01-14 Bjørn Lindeijer +2007-01-15 Philipp Sehmisch * src/game.cpp, src/main.cpp, src/gui/trade.cpp, src/gui/sell.cpp, src/gui/connection.cpp, src/gui/buddywindow.cpp, src/gui/browserbox.h, @@ -413,23 +526,34 @@ src/gui/viewport.h, src/gui/tabbedcontainer.h, src/gui/npclistdialog.cpp, src/gui/help.h, src/gui/chatinput.h, src/gui/chatinput.cpp, src/net/tradehandler.cpp, - src/net/playerhandler.cpp: Upgraded to Guichan 0.6.0 (merge from - guichan-0.6.0 branch). - * src/winver.h, configure.ac, data/help/header.txt, NEWS, README, - CMakeLists.txt: Updated version to 0.0.22.1. + src/net/playerhandler.cpp: Upgraded to Guichan 0.6.0 (merge from 0.0 + branch) + * src/game.cpp, src/particle.cpp, src/particle.h, src/particleemitter.h: + Made the particle count global and more performant. + +2007-01-14 Philipp Sehmisch -2007-01-13 Bjørn Lindeijer + * src/particle.cpp, src/particle.h; src/particleemitter.cpp, + src/particleemitter.h, src/utils/randbetween.h: + Implemented particle engine. + * src/engine.cpp, src/game.cpp: added calls to the particle engine + * data/graphics/particles/*: added a bunch of particle graphics for + testing purpose. + * particleengine-todo.txt: Added particle engine todo list (please + omit when merging) + +2007-01-13 Bjørn Lindeijer * data/graphics/sprites/Makefile.am, data/graphics/sprites/CMakeLists.txt: Updated with regard to renaming of cotton equipment. -2007-01-13 Eugenio Favalli +2006-01-13 Eugenio Favalli * src/gui/debugwindow.cpp, src/gui/viewport.h: Fixed mouse coordinates display in debug window. -2007-01-12 Bjørn Lindeijer +2007-01-12 Bjørn Lindeijer * src/gui/viewport.cpp: Fixed initialization of mPlayerFollowMouse, the lack of which sometimes caused the player to start walking when @@ -440,7 +564,7 @@ * data/graphics/icecave.png: Added new tiles and fixes by Nickman and made some other cosmetical corrections. -2007-01-07 Bjørn Lindeijer +2007-01-07 Bjørn Lindeijer * data/graphics/sprites/monster-mountsnake.xml, data/graphics/sprites/monster-mountsnake.png, data/monsters.xml: Added @@ -456,16 +580,16 @@ cottonshirt sprites. * data/equipment.xml: Fixed some wrong armor values. -2007-01-05 Björn Steinbrink +2007-01-05 Björn Steinbrink * src/CMakeLists.txt, data/graphics/images/ambient/Makefile.am, data/graphics/sprites/CMakeLists.txt: Synchronized build files. -2007-01-04 Eugenio Favalli +2006-12-12 Eugenio Favalli * tools/Purger.java: Removed purger tool. -2006-12-25 Bjørn Lindeijer +2006-12-25 Bjørn Lindeijer * data/graphics/tiles/christmastree.png, data/maps/new_11-1.tmx.gz: Added Christmas tree by Pauan. @@ -481,7 +605,7 @@ sprites by Pauan. * data/items.xml: Fixes to descriptions and weights by Pauan. -2006-12-24 Bjørn Lindeijer +2006-12-24 Bjørn Lindeijer * src/gui/shoplistbox.cpp: Don't try to draw an icon when it is not defined or failed to load properly. @@ -490,7 +614,7 @@ most of the time, we're only drawing a small subimage of them. * README, data/help/header.txt, NEWS: Filled in release dates. -2006-12-23 Bjørn Lindeijer +2006-12-23 Bjørn Lindeijer * configure.ac, data/graphics/items/Makefile.am, data/graphics/items/CMakeLists.txt, data/graphics/images/Makefile.am, @@ -509,7 +633,7 @@ databases at the start of the LOGIN state, after the updates are loaded. -2006-12-22 Bjørn Lindeijer +2006-12-22 Bjørn Lindeijer * data/graphics/items/armor-head-rangerhat.png, data/graphics/items/generic-redstocking.png, @@ -531,7 +655,7 @@ data/graphics/sprites/CMakeLists.txt, data/Makefile.am, data/CMakeLists.txt: Updated Makefiles. -2006-12-21 Bjørn Lindeijer +2006-12-21 Bjørn Lindeijer * configure.ac, CMakeLists.txt, README, data/help/header.txt: Updated version to 0.0.22. @@ -541,7 +665,7 @@ * data/graphics/items/armor-chest-vnecksweater.png: New version of the inventory icon for the V-neck sweater by Saphy. -2006-12-17 Bjørn Lindeijer +2006-12-17 Bjørn Lindeijer * src/gui/sell.cpp, src/gui/shoplistbox.h, src/gui/listbox.h, src/gui/shop.cpp, src/gui/buy.cpp, src/gui/shoplistbox.cpp, @@ -550,7 +674,7 @@ current selection. Also aligned the text a bit better and put the price in parenthesis. -2006-12-16 Bjørn Lindeijer +2006-12-16 Bjørn Lindeijer * src/gui/connection.cpp, src/gui/chargedialog.cpp: Fixed dialog visibility. @@ -563,7 +687,7 @@ * data/graphics/tiles/desert1.png: Removed some unused legacy tiles and added variant tiles for the cliffs. -2006-12-14 Bjørn Lindeijer +2006-12-14 Bjørn Lindeijer * src/game.cpp, src/engine.h, src/engine.cpp: Removed the rather useless remaining draw function from the engine class. @@ -580,7 +704,7 @@ * data/items.xml: Fixed defense values for sweaters. * src/net/playerhandler.cpp: Hide all NPC dialogs after death. -2006-12-12 Bjørn Lindeijer +2006-12-12 Bjørn Lindeijer * src/animatedsprite.h, src/CMakeLists.txt, src/animatedsprite.cpp, src/resources/action.h, src/resources/animation.h, @@ -611,7 +735,7 @@ data/sfx/slime-hit1.ogg: Normalized versions of sound effects by Cosmostrator. -2006-12-11 Bjørn Lindeijer +2006-12-11 Bjørn Lindeijer * src/gui/updatewindow.cpp: Fixed visibility of the update window. @@ -650,7 +774,7 @@ * data/graphics/sprites/npcs.png: Added pirate NPC. -2006-12-09 Bjørn Lindeijer +2006-12-09 Bjørn Lindeijer * src/sprite.h, src/gui/playerbox.h, src/gui/char_select.cpp, src/gui/playerbox.cpp, src/gui/passwordfield.h, src/gui/char_select.h, @@ -659,7 +783,7 @@ Shows equipment and allowed for some cleanup. Had a bit of help from the patch by VictorSan. -2006-12-08 Bjørn Lindeijer +2006-12-08 Bjørn Lindeijer * src/base64.cpp, src/base64.h, src/resources/mapreader.cpp: Downgraded to base64 codec from PHP 3 to resolve licensing issues. @@ -674,7 +798,7 @@ * data/graphics/tiles/desert1.png, data/graphics/tiles/desert2.png: More tiling related fixes at the cliffs. -2006-12-06 Bjørn Lindeijer +2006-12-06 Bjørn Lindeijer * src/gui/item_amount.cpp: Fixed visibility of item amount window. @@ -684,7 +808,7 @@ of the cliffs (still not gridless but at least the edges fit together in the most common situations) -2006-12-04 Bjørn Lindeijer +2006-12-04 Bjørn Lindeijer * src/game.cpp, src/engine.h, src/gui/windowcontainer.h, src/gui/viewport.cpp, src/gui/gui.cpp, src/gui/gui.h, @@ -695,7 +819,7 @@ from the Gui class. Also, it's a Container itself which should allow for extending it to show Guichan widgets on map coordinates. -2006-12-03 Bjørn Lindeijer +2006-12-03 Bjørn Lindeijer * src/sound.cpp, src/monster.cpp, src/sound.h, src/resources/soundeffect.cpp, src/resources/resourcemanager.cpp: @@ -742,7 +866,7 @@ data/sfx/slime-hit1.ogg, data/sfx/Makefile.AM, data/sfx/CMakeLists.txt: Added a lot of sound effects by Cosmostrator. -2006-11-30 Bjørn Lindeijer +2006-11-30 Bjørn Lindeijer * data/maps/Makefile.am: Fixed small trailing slash issue. * src/player.cpp: Optimized setSex and setWeapon by first loading the @@ -757,7 +881,7 @@ * The Mana World.dev, tmw.cbp: Updated project files. -2006-11-29 Bjørn Lindeijer +2006-11-29 Bjørn Lindeijer * src/monster.cpp: Small fix to resource path. @@ -777,7 +901,7 @@ Renamed all monster sprites to more associative names (whew, we got to train some monkeys for tasks like that). -2006-11-27 Bjørn Lindeijer +2006-11-27 Bjørn Lindeijer * tmw.cbp: Updated Code::Blocks project file. @@ -786,7 +910,7 @@ * src/log.cpp, src/util/wingettimeofday.h: Added implementation of gettimeofday() for windows machines. -2006-11-26 Bjørn Lindeijer +2006-11-26 Bjørn Lindeijer * src/log.cpp: Higher precision log timestamps. * src/graphics.cpp, src/gui/gui.cpp, src/openglgraphics.cpp, @@ -797,12 +921,12 @@ XML::getProperty and updated log statements. * src/resources/image.cpp: Added support for loading TGA images. -2006-11-26 Björn Steinbrink +2006-11-26 Björn Steinbrink * src/resources/resourcemanager.cpp: Remove unnecessary check for file existance, loading will just fail with the correct error message. -2006-11-26 Bjørn Lindeijer +2006-11-26 Bjørn Lindeijer * src/game.cpp, src/being.cpp, src/net/beinghandler.cpp, src/being.h: Made Being::mDirection protected, forcing the use of setDirection. @@ -851,7 +975,7 @@ * The Mana World.dev, tmw.cbp: Updated project files. -2006-11-19 Bjørn Lindeijer +2006-11-19 Bjørn Lindeijer * src/gui/setup_joystick.cpp: Fixed joystick option to show enabled when the joystick is enabled. @@ -864,7 +988,7 @@ src/resources/spriteset.h, src/resources/spritedef.cpp: Separated sprite definition from playback. -2006-11-17 Björn Steinbrink +2006-11-17 Björn Steinbrink * data/graphics/sprites/CMakeLists.txt: Fixed some filenames. @@ -890,7 +1014,7 @@ Added woodland village outdoor tileset and maps. Modified gates on the nearby maps. -2006-11-15 Bjørn Lindeijer +2006-11-15 Bjørn Lindeijer * src/animatedsprite.h, src/CMakeLists.txt, src/animatedsprite.cpp, src/utils/xml.cpp, src/utils/xml.h, src/Makefile.am, @@ -902,7 +1026,7 @@ * The Mana World.dev, tmw.cbp: Updated project files. * The Mana World.dev, tmw.cbp: Fixed dynamic linking of libcurl. -2006-11-14 Bjørn Lindeijer +2006-11-14 Bjørn Lindeijer * src/action.h, src/action.cpp, src/animation.h, src/CMakeLists.txt, src/animatedsprite.cpp, src/animation.cpp, src/Makefile.am: Separated @@ -914,7 +1038,7 @@ calculate animation length during loading instead of summing it up each time it is requested. -2006-11-12 Bjørn Lindeijer +2006-11-12 Bjørn Lindeijer * src/map.cpp, src/map.h: Made pathfinding algorithm cope better with beings blocking the road. This is done by allowing walking over other @@ -929,7 +1053,7 @@ The Mana World.dev, tmw.cbp: Fixed a conflict with Windows headers and updated project files. -2006-11-05 Bjørn Lindeijer +2006-11-05 Bjørn Lindeijer * src/gui/trade.cpp: Fixed money field to no longer hide below the bottom of the window. @@ -939,7 +1063,7 @@ * src/main.cpp, src/net/beinghandler.cpp, src/net/skillhandler.cpp, src/net/network.cpp: Changed some printf statements to log statements. -2006-11-05 Bjørn Lindeijer +2006-11-05 Bjørn Lindeijer * data/graphics/images/login_wallpaper.png: Reverted to standard wallpaper. @@ -967,7 +1091,7 @@ dialog. * src/gui/sell.cpp: Fixes the money value after selling something. -2006-11-05 Björn Steinbrink +2006-11-05 Björn Steinbrink * data/graphics/sprites/Makefile.am: Use tabs instead of spaces as required by automake (AFAIK). @@ -984,7 +1108,7 @@ src/player.h, src/being.cpp, src/being.h, data/items.xml: Added scythe as a permanent weapon (ID: 623) -2006-11-04 Bjørn Lindeijer +2006-11-04 Bjørn Lindeijer * data/maps/new_1-1.tmx.gz, data/maps/new_10-1.tmx.gz, data/maps/new_11-1.tmx.gz, data/maps/new_14-1.tmx.gz, @@ -1004,17 +1128,17 @@ * data/maps/new_10-1.tmx.gz, maps/new_11-1.tmx.gz: Fixed some map bugs (please update server sided walkmap) -2006-11-03 Bjørn Lindeijer +2006-11-03 Bjørn Lindeijer * src/gui/updatewindow.cpp, src/main.cpp: Updated to the new default updatehost. -2006-11-01 Bjørn Lindeijer +2006-11-01 Bjørn Lindeijer * src/gui/gui.cpp, src/gui/browserbox.cpp, data/graphics/gui/rpgfont_wider.png, data/graphics/gui/browserfont.png, data/graphics/gui/fixedfont.png: - Added support for Ã¥ and Ã… (with help of HÃ¥kan Rönn). + Added support for Ã¥ and Ã… (with help of HÃ¥kan Rönn). 2006-10-31 Philipp Sehmisch @@ -1076,19 +1200,19 @@ * data/graphics/sprites/Makefile.am: Fixed wrong filenames. * data/graphics/sprites/weapon0.png: Replaced knife with scythe. -2006-10-30 Björn Steinbrink +2006-10-30 Björn Steinbrink * data/graphics/items/CMakeLists.txt: Synced with autotools config. * data/graphics/items/CMakeLists.txt: Added new items to CMake config. * src/being.cpp: Properly initialize sprite vector. -2006-10-29 Bjørn Lindeijer +2006-10-29 Bjørn Lindeijer * configure.ac, The Mana World.dev, CMakeLists.txt, data/help/header.txt, NEWS: Set version to 0.0.21.1. * src/player.cpp: Fixed excessive unnecessary reloading of sprites. -2006-10-28 Björn Steinbrink +2006-10-28 Björn Steinbrink * src/main.c: Reload wallpaper after updates are fetched. * data/graphics/sprites/Makefile.am: Added monster20. @@ -1108,12 +1232,12 @@ * data/graphics/images/ambient/night.png: added graphic for night ambient effect. -2006-10-23 Bjørn Lindeijer +2006-10-23 Bjørn Lindeijer * configure.ac: Added zlib check before PhysFS check. The PhysFS check was failing on MSYS because of a missing -lz. -2006-10-22 Björn Steinbrink +2006-10-22 Björn Steinbrink * CMakeLists.txt, src/CMakeLists.txt: Add PACKAGE_VERSION support. * CMakeLists.txt, src/CMakeLists.txt: Setup the binary dir in the main @@ -1121,7 +1245,7 @@ * src/main.h: Include config.h only when we have it. * src/CMakeLists.txt: Properly set build flags for the tmw target. -2006-10-18 Björn Steinbrink +2006-10-18 Björn Steinbrink * src/CMakeLists.txt, data/graphics/tiles/CMakeLists.txt, data/graphics/items/CMakeLists.txt, data/graphics/gui/CMakeLists.txt, @@ -1136,7 +1260,7 @@ * src/CMakeLists.txt: Adjusted path for Windows. -2006-10-16 Björn Steinbrink +2006-10-16 Björn Steinbrink * CMakeLists.txt: Enable OpenGL by default. * CMake/Modules/FindLibcurl.cmake: Fix libcurl library not being @@ -1167,7 +1291,7 @@ * /data/graphics/sprites/npcs.png: Updated the clothes salesman, it was way out of date. -2006-10-12 Cédric Borgese +2006-10-12 Cédric Borgese * data/graphics/tiles/Woodland_x3.png: Enlarge the trunk and the base of the trees in the woodland tileset. @@ -1177,7 +1301,7 @@ * src/gui/buysell.cpp, src/gui/buy.cpp : A little tweak to the buy dialogs. -2006-10-07 Bjørn Lindeijer +2006-10-07 Bjørn Lindeijer * src/resources/mapreader.cpp: Added support for gzip compressed map layers. @@ -1195,7 +1319,7 @@ * The Mana World.dev, tmw.cbp: Updated project files. -2006-10-03 Bjørn Lindeijer +2006-10-03 Bjørn Lindeijer * data/graphics/sprites/item006.xml, data/graphics/sprites/item007.xml, @@ -1209,7 +1333,7 @@ data/graphics/sprites/item010.png: Removed empty frames from headgears. -2006-10-03 Björn Steinbrink +2006-10-03 Björn Steinbrink * src/map.cpp, src/map.h, src/Makefile.am, src/resources/mapreader.cpp, src/resources/ambientoverlay.cpp, @@ -1221,17 +1345,17 @@ * tools/Purger.java: Added a tool to purge old accounts from eAthena's database files. -2006-10-01 Bjørn Lindeijer +2006-10-01 Bjørn Lindeijer * src/game.cpp, src/gui/trade.cpp, src/gui/inventorywindow.cpp: Accepted patches by GDO and VictorSan that fix problems with hiding windows using h and problems with trade window positioning. -2006-09-28 Björn Steinbrink +2006-09-28 Björn Steinbrink * src/map.cpp: Fix random crashes when map tiles are missing. -2006-09-28 Bjørn Lindeijer +2006-09-28 Bjørn Lindeijer * data/graphics/maps/new_2-1.tmx.gz: Matt Howe fixed up cave map. @@ -1239,7 +1363,7 @@ * data/graphics/maps/new_6-1.tmx.gz: Alderan fixed a map issue. -2006-09-25 Bjørn Lindeijer +2006-09-25 Bjørn Lindeijer * data/graphics/sprites/hairstyle*.png, data/graphics/sprites/hairstyle*.xml, tools/Reorganize.java: Removed @@ -1248,7 +1372,7 @@ redefinition when gl.h also tries to define OpenGL extensions (patch accepted from Rogier Polak). -2006-09-23 Bjørn Lindeijer +2006-09-23 Bjørn Lindeijer * data/maps/new_5-1.tmx.gz: Accepted new version by Matt Howe, fixing several mapping issues. @@ -1288,7 +1412,7 @@ effect and minimap. * data/images/Makefile.am: Updated makefile. -2006-09-19 Bjørn Lindeijer +2006-09-19 Bjørn Lindeijer * data/graphics/sprites/Makefile.am: Added missing monster19 sprite. @@ -1307,7 +1431,7 @@ * data/maps/new_10-1.tmx.gz: Fixed transparent snow issue (Fix by Pajarico). -2006-09-17 Björn Steinbrink +2006-09-17 Björn Steinbrink * src/game.cpp: Stop using the sticky window attribute which is unneeded for the current implementation, instead adjust the set of @@ -1339,7 +1463,7 @@ data/graphics/images/ambient/clouds.png: Improved quality of the overlay graphics. -2006-09-14 Björn Steinbrink +2006-09-14 Björn Steinbrink * src/gui/char_select.cpp: Remove debug output. * src/gui/char_select.cpp, src/main.cpp: Fix the character name @@ -1349,7 +1473,7 @@ up the player selection stuff, it's a bit nicer now. * src/main.cpp: Fix up the player selection command line option. -2006-09-12 Bjørn Lindeijer +2006-09-12 Bjørn Lindeijer * src/game.cpp, src/game.h: Simplified fps limiting a bit and added some comments. Now based on ConfigListener so that the fpslimit option @@ -1360,13 +1484,13 @@ * src/game.cpp: Fixed more fps issues. -2006-09-09 Bjørn Lindeijer +2006-09-09 Bjørn Lindeijer * src/gui/gui.cpp: Removed easy targeting functionality since it interferes with walking around too much. Targeting can still be rather conveniently done with 'a' or the middle mouse button. -2006-09-07 Björn Steinbrink +2006-09-07 Björn Steinbrink * src/resources/image.cpp: Fixed a typo. * src/resources/image.cpp: Worked around a memory leak when using @@ -1403,7 +1527,7 @@ data/graphics/sprites/monster0.xml: Adjusted the animation speed of several monsters. -2006-09-03 Bjørn Lindeijer +2006-09-03 Bjørn Lindeijer * src/floor_item.cpp, src/gui/equipmentwindow.cpp, src/gui/sell.cpp, src/gui/trade.cpp, src/gui/inventorywindow.h, @@ -1430,7 +1554,7 @@ src/beingmanager.cpp, src/localplayer.h, README, data/help/commands.txt, NEWS: Added targeting nearest monster with either keyboard or mouse. Also made clicking beings in general a bit - easier (patch applied by Bjørn Lindeijer). + easier (patch applied by Bjørn Lindeijer). 2006-09-01 Eugenio Favalli @@ -1447,7 +1571,7 @@ data/graphics/sprites/item009.xml: Added sprites for miners helm and standard headband. -2006-08-29 Bjørn Lindeijer +2006-08-29 Bjørn Lindeijer * src/map.cpp, src/beingmanager.h, src/gui/minimap.cpp, src/engine.cpp, src/beingmanager.cpp: It's better to use a reference @@ -1457,7 +1581,7 @@ 2006-08-29 Andrew Harrison * src/main.cpp: Added command line option to specify which - configuration file to use (patch applied by Bjørn Lindeijer). + configuration file to use (patch applied by Bjørn Lindeijer). 2006-08-29 Matthias Hartmann @@ -1485,7 +1609,7 @@ data/graphics/sprites/item006.xml, data/graphics/sprites/Makefile.am: Added headband and fixed svn properties. -2006-08-27 Bjørn Lindeijer +2006-08-27 Bjørn Lindeijer * src/net/inventoryhandler.cpp: Applied patch by Andrew Harrison that adds item pickup messages to the chat window. @@ -1500,9 +1624,9 @@ the video section of the setup window to configure the laziness and radius of the scrolling behaviour. Added a checkbox to the joystick section to allow enabling/disabling the joystick (patch applied by - Bjørn Lindeijer). + Bjørn Lindeijer). -2006-08-26 Bjørn Lindeijer +2006-08-26 Bjørn Lindeijer * src/gui/ministatus.cpp, src/gui/ministatus.h: Applied patch by mrha (Herbi), adding experience bar to the ministatus in the top left. @@ -1518,7 +1642,7 @@ * src/gui/char_select.cpp, src/gui/char_select.h, src/main.cpp: Added --playername command line option for selecting the character you want - to play with (patch applied by Bjørn Lindeijer). + to play with (patch applied by Bjørn Lindeijer). 2006-08-25 Philipp Sehmisch @@ -1558,7 +1682,7 @@ * data/maps/new_9-1.tmx.gz: Fixed two minor mapping bugs (new walkmap required). -2006-08-22 Bjørn Lindeijer +2006-08-22 Bjørn Lindeijer * configure.ac, data/graphics/images/ambient, data/graphics/images/ambient/Makefile.am, @@ -1585,7 +1709,7 @@ data/graphics/images/ambient/clouds.png: Added cloudshadow effect to the woodland map (feedback, please). -2006-08-20 Bjørn Lindeijer +2006-08-20 Bjørn Lindeijer * configure.ac: Moved libpng check before SDL_image check, since the latter requires the former. @@ -1624,7 +1748,7 @@ * src/gui.cpp, tmw.cbp, The Mana World.dev: Fixed Guichan 0.5.0 compilation issues. -2006-08-13 Bjørn Lindeijer +2006-08-13 Bjørn Lindeijer * src/openglgraphics.cpp, src/game.cpp, src/main.cpp, src/gui/buddywindow.cpp, src/gui/connection.cpp, src/gui/sell.cpp, @@ -1688,12 +1812,12 @@ woodland. * data/graphics/woodland_ground.png: Added some new rocks. -2006-08-07 Björn Steinbrink +2006-08-07 Björn Steinbrink * src/game.cpp, src/gui/chat.h, src/gui/chat.cpp, src/main.cpp: A bunch of cleanups. -2006-08-05 Björn Steinbrink +2006-08-05 Björn Steinbrink * src/configuration.cpp, src/game.cpp, src/engine.cpp, src/player.cpp, src/being.cpp, src/resources/mapreader.cpp, @@ -1701,13 +1825,13 @@ indentation. * src/being.cpp: Small code cleanup. -2006-08-04 Björn Steinbrink +2006-08-04 Björn Steinbrink * src/animatedsprite.cpp: Fix enum being treated as string. * src/animation.cpp: Small code cleanups. Removed unused headers. * src/animatedsprite.cpp: Small code cleanup/lower indentation. -2006-08-04 Bjørn Lindeijer +2006-08-04 Bjørn Lindeijer * src/animatedsprite.cpp: Fixed presence of NULL actions. This is doener's version of the fix, because it was more efficient in the more @@ -1718,7 +1842,7 @@ * data/graphics/tiles/desert_x3.png: Replaced the old cactus with a nice new high-res one. -2006-08-03 Bjørn Lindeijer +2006-08-03 Bjørn Lindeijer * src/player.cpp, src/being.cpp, src/being.h: Removed three setDirection(mDirection) calls by instead specifically setting the @@ -1736,7 +1860,7 @@ src/animatedsprite.cpp, src/being.cpp: Animations and directions are now passed and stored as enums and no longer as strings. -2006-07-30 Björn Steinbrink +2006-07-30 Björn Steinbrink * src/animatedsprite.h, src/animatedsprite.cpp: Unified the play methods. @@ -1746,14 +1870,14 @@ * data/maps/new_5-1.tmx.gz: Fixed two minor mapping errors (no new walkmap required). -2006-07-29 Björn Steinbrink +2006-07-29 Björn Steinbrink * src/animatedsprite.h, src/animatedsprite.cpp, src/animation.cpp: A bunch of cleanups. * src/animation.h, src/animatedsprite.cpp: Moved included from header to source file. -2006-07-28 Björn Steinbrink +2006-07-28 Björn Steinbrink * src/npc.cpp, src/player.cpp, src/animatedsprite.h, src/animation.h, src/being.cpp, src/main.cpp, src/monster.cpp, src/animatedsprite.cpp, @@ -1772,7 +1896,7 @@ data/maps/new_9-1.tmx.gz: Added new woodland map by Crush and fixed connection with the old one. -2006-07-26 Bjørn Lindeijer +2006-07-26 Bjørn Lindeijer * data/maps/new_4-1.tmx.gz: Fixes to the collision layer. @@ -1787,16 +1911,16 @@ * data/graphics/sprites/item003.png, data/graphics/sprites/item003.xml: Added the leather shirt -2006-07-25 Bjørn Lindeijer +2006-07-25 Bjørn Lindeijer * src/gui/updatewindow.cpp: Fixed updating on Windows. -2006-07-24 Bjørn Lindeijer +2006-07-24 Bjørn Lindeijer * src/main.cpp: Fixed the loading of updates and made skipping the update process also skip the loading of updates. -2006-07-24 Björn Steinbrink +2006-07-24 Björn Steinbrink * src/localplayer.cpp, src/being.cpp: Fixed setDirection() semantics. Removed a printf-leftover. @@ -1825,7 +1949,7 @@ * src/net/equipmenthandler.cpp: Equipments now use real slot positions. -2006-07-24 Bjørn Lindeijer +2006-07-24 Bjørn Lindeijer * src/floor_item.cpp, src/animation.h, src/being.cpp, src/main.cpp, src/gui/equipmentwindow.cpp, src/gui/playerbox.cpp, @@ -1864,7 +1988,7 @@ src/animation.h, src/being.cpp: Fixed left bow attack animation, made the attack animation stay in sync with attack speed. -2006-07-19 Bjørn Lindeijer +2006-07-19 Bjørn Lindeijer * src/gui/minimap.cpp: Fixed dot size of local player. * src/engine.cpp: Fixed color of "[TARGET]". @@ -1893,11 +2017,11 @@ character selection dialog. * data/graphics/sprites/Makefile.am: Alphabetically correct. -2006-07-19 Bjørn Lindeijer +2006-07-19 Bjørn Lindeijer * tmw.cbp: Added Code::Blocks project file. -2006-07-18 Bjørn Lindeijer +2006-07-18 Bjørn Lindeijer * src/gui/updatewindow.cpp, src/gui/updatewindow.h, src/main.cpp, src/resources/resourcemanager.cpp, src/resources/resourcemanager.h: @@ -1910,7 +2034,7 @@ * data/graphics/sprites/items.png: Added shorts' icon to items.png -2006-07-12 Bjørn Lindeijer +2006-07-12 Bjørn Lindeijer * src/gui/newskill.cpp: Fixed up a string comparison that caused a warning with GCC 4.2. @@ -1927,14 +2051,14 @@ Fixed some minor bugs, cleaned up general code style and added more comments. -2006-07-05 Björn Steinbrink +2006-07-05 Björn Steinbrink * src/monster.cpp, src/npc.cpp, src/player.cpp: Fixed broken paths. * data/graphics/sprites/Makefile.am: Added new files. * src/animation.cpp: Added missing return value... * src/Makefile.am: Added new files. -2006-07-05 Bjørn Lindeijer +2006-07-05 Bjørn Lindeijer * data/graphics/sprites/monster0.xml: Fixed frame size of maggot. * src/being.h: drawName should be virtual, lest we want names to be @@ -1950,7 +2074,7 @@ * src/being.cpp: Fixed a compiler issue reported by Pajarico. -2006-07-03 Bjørn Lindeijer +2006-07-03 Bjørn Lindeijer * tools/Reorganize.java: Added tool used for reorganizing and auto-cropping the monster spritesets. @@ -1969,7 +2093,7 @@ src/monster.h: Moved all drawing code from the Being based classes into Being. * data/graphics/sprites/monster*.png: Resized and reorganized the - monster spritesets to fit the new animation system (thanks, Bjørn). + monster spritesets to fit the new animation system (thanks, Bjørn). * data/graphics/sprites/monster*.xml: Added animation files for all monsters. * src/animation.cpp: The offset values of the Frames of animated @@ -1988,7 +2112,7 @@ * src/being.cpp: Removed an unnecessary parameter. -2006-07-03 Bjørn Lindeijer +2006-07-03 Bjørn Lindeijer * data/graphics/sprites/Makefile.am: Updated to new xml files. @@ -2070,7 +2194,7 @@ * /tmw/trunk/data/graphics/sprites/player_male_base.png: Fixed transparency issue with the north punching frames -2006-06-26 Bjørn Lindeijer +2006-06-26 Bjørn Lindeijer * src/net/messagein.cpp: Fixed the readString method (synchronized with the server version by Guillaume Melquiond). @@ -2112,12 +2236,12 @@ data/maps/Makefile.am, data/maps/new_11-1.tmx.gz: New NPCs, new snow tiles and village. -2006-05-15 Björn Steinbrink +2006-05-15 Björn Steinbrink * src/gui/item_amount.cpp: Set slider range to the real values instead of mapping the amount between [0,1] and [1,max] all the time. -2006-05-13 Bjørn Lindeijer +2006-05-13 Bjørn Lindeijer * src/openglgraphics.cpp: Set color back to current color instead of setting it to white. Fixes white rectangles in equipment window. @@ -2125,7 +2249,7 @@ which speech and names are supposed to be drawn. Removed unused mSpeechColor member. -2006-05-12 Björn Steinbrink +2006-05-12 Björn Steinbrink * src/being.cpp: Fixed initialization order in Being ctor. @@ -2172,7 +2296,7 @@ monster (note that the version 0.0.19 live update overrides the changed file). -2006-04-04 Bjørn Lindeijer +2006-04-04 Bjørn Lindeijer * ChangeLog: Converted to UTF-8. * NEWS: Spelling correction. @@ -2187,7 +2311,7 @@ * The Mana World.dev: Updated project. -2006-03-20 Björn Steinbrink +2006-03-20 Björn Steinbrink * src/engine.cpp: Fixed a crash on map change. @@ -2195,7 +2319,7 @@ * src/gui/char_select.cpp: Fixed an include. -2006-03-19 Björn Steinbrink +2006-03-19 Björn Steinbrink * src/gui/register.h, src/gui/register.cpp: Fixed a memory leak and removed some whitespace noise. @@ -2213,7 +2337,7 @@ according to their tabs in the window. Fixed some memory leaks along the way. Also fixed two settings not being stored on "apply". -2006-03-18 Björn Steinbrink +2006-03-18 Björn Steinbrink * src/gui/chat.cpp, src/gui/menuwindow.cpp, src/gui/skill.cpp, src/gui/status.cpp: Use the window container instead of the graphics @@ -2230,7 +2354,7 @@ src/net/chathandler.cpp, src/engine.cpp, src/utils/tostring.h, src/Makefile.am: Added a toString conversion function. -2006-03-15 Björn Steinbrink +2006-03-15 Björn Steinbrink * src/engine.h, src/main.cpp, src/gui/equipmentwindow.cpp, src/gui/window.cpp, src/gui/login.cpp, src/gui/listbox.h, @@ -2261,7 +2385,7 @@ data/graphics/sprites/Makefile.am: Fixed some hair positions, added a new style, updated makefile. -2006-03-09 Björn Steinbrink +2006-03-09 Björn Steinbrink * src/utils/dtor.h: Added guards. * src/game.cpp, src/main.cpp, src/gui/connection.cpp, @@ -2325,7 +2449,7 @@ * src/gui/browserbox.cpp: Make the MouseOverLink functor dynamic and use a STL algorithm in one more place. -2006-03-08 Bjørn Lindeijer +2006-03-08 Bjørn Lindeijer * src/gui/browserbox.h, src/gui/menuwindow.cpp, src/gui/buysell.cpp: Some fixes for compiling with pedantic compiler settings and const @@ -2334,7 +2458,7 @@ direction in order to make the texture less wide so that it stays within the 1024 texture limit for OpenGL mode. -2006-03-08 Björn Steinbrink +2006-03-08 Björn Steinbrink * src/map.cpp, src/main.cpp, src/gui/button.cpp, src/gui/textfield.cpp, src/gui/playerbox.cpp, @@ -2367,7 +2491,7 @@ * data/graphics/tiles/Makefile.am, data/graphics/tiles/Woodland.png: Removed unused tileset. -2006-03-06 Björn Steinbrink +2006-03-06 Björn Steinbrink * configure.ac: Version changed to 0.0.19. @@ -2381,7 +2505,7 @@ data/help/team.txt: A bunch of updates to docs, ready for 0.0.19. * data/help/changes.txt, src/main.cpp: Small fixes before releasing. -2006-03-05 Björn Steinbrink +2006-03-05 Björn Steinbrink * data/graphics/sprites/Makefile.am: Remove trailing whitespace. * src/engine.cpp: Re-add main.h header, Windows build needs it. @@ -2416,12 +2540,12 @@ src/localplayer.cpp, src/main.cpp, beinghandler.cpp, player.cpp, src/resources/image.cpp: Hacked code to support the new playerset. -2006-02-25 Björn Steinbrink +2006-02-25 Björn Steinbrink * src/beingmanager.cpp, src/beingmanager.h, src/engine.cpp, src/main.h, src/sound.h: Added a logic method to the being manager. -2006-02-24 Björn Steinbrink +2006-02-24 Björn Steinbrink * src/being.cpp, src/being.h, src/configuration.cpp, src/configuration.h, src/engine.cpp, src/map.cpp, src/map.h, @@ -2433,7 +2557,7 @@ src/resources/itemmanager.h: Another bunch of cosmetic cleanups, i.e. mostly typedefs... -2006-02-23 Björn Steinbrink +2006-02-23 Björn Steinbrink * src/being.cpp, src/being.h, src/beingmanager.cpp, src/beingmanager.h, src/engine.cpp, src/inventory.cpp, @@ -2462,13 +2586,13 @@ * src/resources/itemmanager.cpp: Added warnings when parameters are missing in the items xml file. -2006-02-16 Björn Steinbrink +2006-02-16 Björn Steinbrink * src/gui/browserbox.cpp, src/gui/browserbox.h, src/gui/gui.cpp: Use Widget::mFont instead of browerFont for drawing, fixes the "gui needs to be valid real early" issue. -2006-02-07 Björn Steinbrink +2006-02-07 Björn Steinbrink * src/being.cpp, src/being.h, src/game.cpp, src/localplayer.cpp, src/localplayer.h, src/monster.cpp, src/player.cpp, @@ -2489,7 +2613,7 @@ * src/net/tradehandler.cpp: Undone last changes because Bertram already fixed the compiler issue. -2006-02-06 Björn Steinbrink +2006-02-06 Björn Steinbrink * src/Makefile.am, src/game.cpp, src/joystick.cpp, src/joystick.h, src/gui/setup.cpp, src/gui/setup.h: Added a Joystick class. @@ -2508,7 +2632,7 @@ * data/graphics/gui/rpgfont_wider.png, data/graphics/gui/fixedfont.png,data/graphics/gui/browserfont.png, - data/graphics/gui/sansserif8.png: Adding è accents mostly to the font + data/graphics/gui/sansserif8.png: Adding è accents mostly to the font images. * src/engine.cpp, src/being.h, src/being.cpp, src/player.cpp, src/gui/char_select.h, src/gui/char_select.cpp: Made the nickname and @@ -2519,11 +2643,11 @@ itemmanager so tmw doesn't crash anymore if an item lacks some parameters. -2006-02-05 Bjørn Lindeijer +2006-02-05 Bjørn Lindeijer * INSTALL: Updated dependencies in response to patch by Hanno Braun. -2006-02-05 Björn Steinbrink +2006-02-05 Björn Steinbrink * data/graphics/tiles/Makefile.am: Added the new tilesets. * src/localplayer.cpp, src/localplayer.h, src/gui/gui.cpp: Made the @@ -2541,7 +2665,7 @@ technology. made the forests less regular. made the unwalkable map borders more visual appealing -2006-02-04 Björn Steinbrink +2006-02-04 Björn Steinbrink * src/localplayer.h, src/logindata.h, src/main.cpp, src/main.h, src/gui/char_select.cpp, src/gui/char_server.cpp, @@ -2550,7 +2674,7 @@ src/net/loginhandler.h, src/net/network.cpp, src/net/network.h: Unify the gui code for the various logins to use LoginData. -2006-02-03 Björn Steinbrink +2006-02-03 Björn Steinbrink * src/logindata.h, src/main.cpp, src/gui/login.cpp, src/gui/login.h: Made the login dialog work on LoginData only, without playing with the @@ -2564,7 +2688,7 @@ Replaced the old sand tile with Irucards new one. Added new crates. Made some minor corrections. -2006-02-01 Björn Steinbrink +2006-02-01 Björn Steinbrink * src/game.cpp, src/game.h, src/main.cpp: Created a Game class. * src/gui/passwordfield.cpp: Removed duplicated code. @@ -2587,7 +2711,7 @@ message dialog from a npc that no longer exists. * src/properties.h: Reverted properties to private. -2006-01-31 Björn Steinbrink +2006-01-31 Björn Steinbrink * src/gui/setup.cpp: Cleanup. * src/gui/requesttrade.cpp, src/gui/requesttrade.h: Made @@ -2604,7 +2728,7 @@ ResourceManager a friend of Resource to avoid looping over decRef, which returns void now. -2006-01-30 Björn Steinbrink +2006-01-30 Björn Steinbrink * src/gui/char_select.cpp, src/gui/confirm_dialog.cpp, src/gui/confirm_dialog.h, src/gui/error.cpp, src/gui/error.h, @@ -2612,7 +2736,7 @@ src/gui/setup.cpp, src/net/charserverhandler.cpp: A few cleanups and simplifications. -2006-01-26 Björn Steinbrink +2006-01-26 Björn Steinbrink * src/game.cpp, src/game.h, src/main.cpp: Moved some setup code out of the game loop into the setup functions. Setup functions are now called @@ -2623,7 +2747,7 @@ * The Mana World.dev, src/main.cpp: Updated Dev-Cpp project file, fixed a GDI issue. -2006-01-22 Björn Steinbrink +2006-01-22 Björn Steinbrink * src/game.cpp, src/net/network.cpp: Make dispatchMessages actually handle more than one message per call. @@ -2635,7 +2759,7 @@ a bug in the network class that triggers when a handlers survives the network object. -2006-01-21 Bjørn Lindeijer +2006-01-21 Bjørn Lindeijer * src/gui/browserbox.cpp: Applied a patch by Ar2ro that works around the problems with line wrapping in the chatbox. Note though that this @@ -2645,7 +2769,7 @@ * The Mana World.dev: Updated Dev-Cpp project file. -2006-01-20 Björn Steinbrink +2006-01-20 Björn Steinbrink * src/equipment.h, src/game.cpp, src/game.h, src/main.h, src/gui/buddywindow.cpp, src/gui/buddywindow.h, @@ -2685,7 +2809,7 @@ docs/INSTALL/debian.txt, docs/INSTALL/win32.txt, docs/progression.txt: Updated infos on new irc channel. -2006-01-14 Björn Steinbrink +2006-01-14 Björn Steinbrink * src/main.cpp, src/main.h, src/gui/char_server.cpp, src/gui/char_server.h: Moved network code out of the @@ -2718,7 +2842,7 @@ src/net/playerhandler.cpp: Made changeMap() care about sending the map-loaded message. Removed network stuff from connection dialog. -2006-01-13 Björn Steinbrink +2006-01-13 Björn Steinbrink * src/Makefile.am, src/gui/login.cpp, src/gui/login.h, src/gui/register.cpp, src/net/loginhandler.cpp, @@ -2757,7 +2881,7 @@ * src/game.cpp, src/localplayer.cpp, src/localplayer.h: Made emote() a method of the LocalPlayer class. -2006-01-12 Björn Steinbrink +2006-01-12 Björn Steinbrink * src/game.cpp, src/main.cpp, src/net/beinghandler.cpp, src/net/beinghandler.h, src/net/buysellhandler.cpp, @@ -2821,7 +2945,7 @@ src/net/chathandler.h, src/net/tradehandler.cpp: Added a dedicated handler for chat messages. -2006-01-11 Björn Steinbrink +2006-01-11 Björn Steinbrink * src/Makefile.am, src/game.cpp, src/game.h, src/gui/popupmenu.cpp, src/gui/requesttrade.h, src/net/messagehandler.h, src/net/network.cpp, @@ -2862,7 +2986,7 @@ * src/game.cpp: Fixed canceled/cancelled inconsistency. -2006-01-08 Björn Steinbrink +2006-01-08 Björn Steinbrink * src/floor_item.cpp, src/floor_item.h, src/game.cpp, src/localplayer.cpp, src/localplayer.h, src/gui/gui.cpp, @@ -2876,7 +3000,7 @@ * src/game.cpp, src/game.h, src/gui/connection.cpp: Removed some globals. -2006-01-07 Björn Steinbrink +2006-01-07 Björn Steinbrink * src/game.cpp, src/localplayer.cpp, src/localplayer.h: Created a walk method for LocalPlayer. @@ -2889,7 +3013,7 @@ splitted the setup window into 3 tabs and added a joystick calibration tool. -2006-01-06 Björn Steinbrink +2006-01-06 Björn Steinbrink * src/game.cpp, src/localplayer.cpp: Changed semantics for auto target. The player now keeps attacking the select target till he @@ -2912,7 +3036,7 @@ specific code there. Added a BeingManager to remove use of globals. Moved PLAYERINFO stuff into the new LocalPlayer class. -2006-01-05 Björn Steinbrink +2006-01-05 Björn Steinbrink * engine.cpp, engine.h, game.cpp, game.h, gui/buysell.h, gui/chargedialog.h, gui/debugwindow.cpp, gui/debugwindow.h, gui/gui.h, @@ -2948,20 +3072,20 @@ Smoothed also character creation, buttons are now disabled during connection/data phase. -2006-01-01 Björn Steinbrink +2006-01-01 Björn Steinbrink * src/gui/login.cpp, src/gui/login.h: Remove tracking of OkDialog, the garbage collection stuff takes care of deletion and breaks manual tracking. -2006-01-01 Bjørn Lindeijer +2006-01-01 Bjørn Lindeijer * src/main.cpp: Applied patch by pclouds that allows for a faster login sequence by providing the username and password from the command line, and allowing the client to choose the default server and character. -2005-12-30 Bjørn Lindeijer +2005-12-30 Bjørn Lindeijer * src/gui/chat.cpp, src/gui/chat.h: Applied patch by pclouds to have the chat window temporarily become visible when chatting while it is @@ -2992,7 +3116,7 @@ crash by Doener. Fixed GCC 3.3.6 and 4.x paranthesis problem, patch by r0nny. Fixed popupMenu not showing on items. -2005-12-29 Björn Steinbrink +2005-12-29 Björn Steinbrink * src/game.cpp, src/gui/popupmenu.cpp, src/net/protocol.cpp: Remove duplicated code for picking up items as patched by pclouds. @@ -3009,12 +3133,12 @@ * src/main.h: Fixed define problems with The_Mana_World_private.h. -2005-12-25 Bjørn Lindeijer +2005-12-25 Bjørn Lindeijer * src/being.cpp: Small fix to prevent other stuff than the damage numbers from fading out. -2005-12-24 Bjørn Lindeijer +2005-12-24 Bjørn Lindeijer * src/map.cpp: Worked around fringe layer drawing bug at the bottom. * src/main.cpp: When compiling with OpenGL support, it'll default to @@ -3023,7 +3147,7 @@ * NEWS, configure.ac, The Mana World.dev: Updated in preparation of release 0.0.18.1. -2005-12-20 Bjørn Lindeijer +2005-12-20 Bjørn Lindeijer * configure.ac: Changed version to 0.0.18. @@ -3058,7 +3182,7 @@ data/graphics/sprites/items.png, data/graphics/sprites/npcs.png,: Added new monsters, items and npcs. -2005-12-05 Bjørn Lindeijer +2005-12-05 Bjørn Lindeijer * src/gui/char_server.cpp: Avoid crashing on trying to log the name of a non-existing character. * src/main.h, src/main.cpp: Display TMW version on Windows too. @@ -3067,7 +3191,7 @@ * The Mana World.dev: Updated Dev-Cpp project file. -2005-11-13 Bjørn Lindeijer +2005-11-13 Bjørn Lindeijer * data/maps/new_1-1.tmx.gz, data/maps/new_3-1.tmx.gz, data/maps/new_7-1.tmx.gz: Made the three desert maps use the fringe @@ -3079,7 +3203,7 @@ * src/main.cpp: Add version displaying at startup. * docs/INSTALL/debian.txt: Updated Debian Install Doc. -2005-10-20 Björn Steinbrink +2005-10-20 Björn Steinbrink * src/gui/item_amount.cpp: Fix scrollbar not being updated when the amount is changed using the buttons. @@ -3110,14 +3234,14 @@ debian/changelog, debian/control, debian/docs, debian/tmw.menu: Updated Debian files to get tmw ready for official ITP. -2005-10-19 Björn Steinbrink +2005-10-19 Björn Steinbrink * src/resources/resourcemanager.cpp: Fix empty lines not being read from text files. * src/gui/browserbox.cpp, src/gui/browserbox.h: Code cleanup. * src/gui/gccontainer.cpp: Remove debug output. -2005-10-18 Björn Steinbrink +2005-10-18 Björn Steinbrink * src/Makefile.am, src/gui/buddywindow.cpp, src/gui/buddywindow.h, src/gui/buy.cpp, src/gui/buy.h, src/gui/buysell.cpp, @@ -3151,7 +3275,7 @@ * src/gui/setup.cpp: made it so those who use and go to fullscreen requires a restart (texture/context baddies) -2005-10-16 Björn Steinbrink +2005-10-16 Björn Steinbrink * src/being.cpp, src/game.cpp, src/inventory.cpp, src/gui/buy.cpp, src/gui/buysell.cpp, src/gui/char_select.cpp, src/gui/char_server.cpp, @@ -3181,7 +3305,7 @@ non-blocking now and fixed the problem with sound not being played at startup. -2005-10-15 Björn Steinbrink +2005-10-15 Björn Steinbrink * src/engine.cpp: Moved some variables into the conditional block where they are used. @@ -3190,19 +3314,19 @@ src/resources/image.h: Some small cleanups. * src/engine.cpp: Removed some legacy debug code. -2005-10-13 Bjørn Lindeijer +2005-10-13 Bjørn Lindeijer * src/game.cpp: Prevent Alt+p/s/f from appearing in chatbox. * src/Makefile.am: Some updates for added/removed headers. * src/being.cpp: Changed char to signed char for GNU/Linux PPC. -2005-10-13 Björn Steinbrink +2005-10-13 Björn Steinbrink * src/engine.cpp, src/gui/browserbox.cpp, src/gui/gui.cpp, src/gui/gui.h: Use gcn::Font instead of gcn::ImageFont where the former is sufficient. -2005-10-10 Bjørn Lindeijer +2005-10-10 Bjørn Lindeijer * src/being.cpp, src/being.h, src/game.cpp: Always compile with debug window and hide it on startup. Also added fading out effect on damage @@ -3226,7 +3350,7 @@ src/engine.cpp, src/Makefile.am: Corrected the white browser font bug and the black hp/mp bug which were linked. Added a debug window -2005-10-09 Bjørn Lindeijer +2005-10-09 Bjørn Lindeijer * src/being.cpp, src/being.h, src/engine.cpp, src/engine.h, src/floor_item.cpp, src/floor_item.h, src/map.cpp, src/map.h, @@ -3262,7 +3386,7 @@ crashing the client, display of [TARGET], Alt keys for toggling windows and names to overlap other players. -2005-10-06 Bjørn Lindeijer +2005-10-06 Bjørn Lindeijer * src/being.cpp: Modified finding NPC as by timonator's suggestion in order to allow NPCs to be clicked on their heads too. @@ -3277,14 +3401,14 @@ to simplify Map class and to allow properties to be used by other classes. -2005-10-06 Björn Steinbrink +2005-10-06 Björn Steinbrink * src/being.cpp, src/being.h, src/game.cpp: Use integer types from SDL and along the way fixed some long vs. int issues. * src/inventory.cpp: Return NULL when no valid item index is given to getItem() to bail out early. -2005-10-05 Bjørn Lindeijer +2005-10-05 Bjørn Lindeijer * src/engine.cpp, src/main.cpp, src/gui/char_select.cpp, src/gui/skill.cpp, src/net/messagein.cpp: Fixed some resource cleanup @@ -3306,7 +3430,7 @@ * src/gui/setup.cpp: Enable the OpenGL Checkbox only if tmw has been compiled with its support. -2005-10-02 Bjørn Lindeijer +2005-10-02 Bjørn Lindeijer * configure.ac, src/Makefile.am: Added check for pthread library and removed manual -lpthread and -lguichan linker flags. @@ -3333,7 +3457,7 @@ a few the default win position. And moved the setposition from game to each win, to clarify the code. -2005-09-29 Bjørn Lindeijer +2005-09-29 Bjørn Lindeijer * src/map.cpp, src/map.h, src/tileset.h, src/resources/mapreader.cpp, src/resources/mapreader.h: Moved tileset management into the map class @@ -3354,7 +3478,7 @@ * src/gui/setup.cpp, src/gui/setup.h; src/gui/minimap.h: Added a 'Reset Windows to Default' Button in the Setup Window. -2005-09-28 Björn Steinbrink +2005-09-28 Björn Steinbrink * src/gui/browserbox.cpp: Fix deletion of the gui font because of a missing check. @@ -3380,13 +3504,13 @@ src/net/network.cpp: Now error message is displayed properly when the map server is offline. -2005-09-25 Bjørn Lindeijer +2005-09-25 Bjørn Lindeijer * src/openglgraphics.cpp: Fixed taking OpenGL screenshots and in addition made it flip the image using just a line buffer instead of a buffer for the complete image. Still needs testing on MacOS X. -2005-09-24 Bjørn Lindeijer +2005-09-24 Bjørn Lindeijer * src/being.cpp, src/engine.cpp, src/game.cpp, src/main.cpp, src/map.cpp, src/sound.cpp, src/gui/char_select.cpp, @@ -3424,7 +3548,7 @@ * The Mana World.dev: Removed reference to src/gui/stats.* since they are in the attic now. -2005-09-20 Bjørn Lindeijer +2005-09-20 Bjørn Lindeijer * src/game.cpp, src/gui/ok_dialog.cpp, src/gui/ok_dialog.h, src/gui/window.cpp: Enter is used to dismiss dialogs currently, @@ -3432,7 +3556,7 @@ made the game crash. * src/openglgraphics.cpp: Changed glColor4f to glColor4ub. -2005-09-19 Bjørn Lindeijer +2005-09-19 Bjørn Lindeijer * configure.ac: Replaced custom function FIND_PATH with AC_PATH_PROG, used for finding sdl-config. @@ -3497,7 +3621,7 @@ * src/gui/status.cpp: As m[a]tt noticed, made the status win a little more wide, and resizable. -2005-09-18 Björn Steinbrink +2005-09-18 Björn Steinbrink * src/game.cpp, src/graphics.cpp, src/graphics.h: Move the writing logic out of the Graphics class once again... Some cleanups in the @@ -3527,11 +3651,11 @@ * src/gui/popupmenu.cpp: Added "attack" option to the popupmenu * src/net/protocol.cpp: findPlayer -2005-09-17 Bjørn Lindeijer +2005-09-17 Bjørn Lindeijer * src/engine.cpp, src/game.cpp: Indent properly. -2005-09-17 Björn Steinbrink +2005-09-17 Björn Steinbrink * configure.ac: Fix typo. * src/Makefile.am: Remove useless (duplicate) -lpng. @@ -3573,12 +3697,12 @@ * src/gui/status.cpp, src/game.cpp: The derived stats are now updated correctly upon equipping/unequipping. -2005-09-16 Bjørn Lindeijer +2005-09-16 Bjørn Lindeijer * src/resources/image.cpp: Report which error occured when loading of an image fails. -2005-09-14 Björn Steinbrink +2005-09-14 Björn Steinbrink * src/game.cpp: Fix missing parentheses in a negated check. * src/engine.cpp, src/engine.h, src/game.cpp: Moved Map management @@ -3608,7 +3732,7 @@ src/net/network.cpp, src/net/network.h: Started to use MessageOut to send login data. -2005-09-13 Björn Steinbrink +2005-09-13 Björn Steinbrink * ChangeLog, The Mana World.dev, configure.ac, src/Makefile.am, src/being.cpp, src/being.h, src/engine.cpp, src/floor_item.cpp, @@ -3640,7 +3764,7 @@ * src/gui/login.cpp: Removed a close_session call i missed. * src/gui/login.cpp: Close the session only when it was opened. -2005-09-13 Bjørn Lindeijer +2005-09-13 Bjørn Lindeijer * src/floor_item.cpp, src/floor_item.h, src/engine.cpp, popupmenu.cpp: Made members private and provided more convenient @@ -3660,7 +3784,7 @@ * src/gui/updatewindow.cpp: Start displaying file progress at 0% and some small fixes. -2005-09-12 Björn Steinbrink +2005-09-12 Björn Steinbrink * src/Makefile.am, src/gui/browserbox.cpp, src/gui/gui.cpp, src/resources/resourcemanager.cpp, src/resources/resourcemanager.h, @@ -3668,7 +3792,7 @@ Added SDLImageLoader to make guichan support physfs. Removed ResourceManager::getRealPath() because it's no longer needed. -2005-09-12 Bjørn Lindeijer +2005-09-12 Bjørn Lindeijer * data/graphics/gui/hits_blue.png, data/graphics/gui/hits_red.png, data/graphics/gui/hits_yellow.png: Made shadow translucent. @@ -3676,7 +3800,7 @@ * data/help/changes.txt, data/help/commands.txt: Added 0.0.16 changes. * data/maps/new_7-1.tmx.gz: Fixed well being in the wrong layer. -2005-09-11 Bjørn Lindeijer +2005-09-11 Bjørn Lindeijer * src/net/network.cpp: Improved error reporting a bit and got rid of loop for sending data, which shouldn't be necessary according to @@ -3726,12 +3850,12 @@ flush() was still called in a loop for sending and added asserts to MessageIn methods. -2005-09-10 Bjørn Lindeijer +2005-09-10 Bjørn Lindeijer * src/log.cpp: Committed patch by Nayr for displaying a messagebox when an error occurs on MacOS. -2005-09-10 Björn Steinbrink +2005-09-10 Björn Steinbrink * configure.ac: Add check for SDL_net. @@ -3739,12 +3863,12 @@ * src/game.cpp: Fixes to dropped items network code -2005-09-09 Bjørn Lindeijer +2005-09-09 Bjørn Lindeijer * src/net/win2linux.h: Removed inclusion of malloc.h header as it doens't seem necessary and was problematic on FreeBSD. -2005-09-08 Björn Steinbrink +2005-09-08 Björn Steinbrink * src/game.cpp: Clean the floor items when the map changes. @@ -3756,7 +3880,7 @@ Updated docs for release, fixed Dev-Cpp project file, added more items and npcs, fixed the new map and added it to the makefile. -2005-08-31 Björn Steinbrink +2005-08-31 Björn Steinbrink * src/openglgraphics.cpp: Fix push/pop of clip area, we need to translate using the x/y offset, not the x/y coordinates of the clip @@ -3768,7 +3892,7 @@ * data/graphics/sprites/npcs.png, src/gui/sell.cpp: Added empty sprite and reorganized spriteset, fixed a typo. -2005-08-29 Björn Steinbrink +2005-08-29 Björn Steinbrink * src/Makefile.am, src/configlistener.cpp, src/configlistener.h: Made the destructor inline, as it is an interface, we don't need a .cpp @@ -3785,7 +3909,7 @@ * data/maps/new_8-1.tmx.gz: Some layer and walkability fixes. -2005-08-28 Björn Steinbrink +2005-08-28 Björn Steinbrink * src/openglgraphics.cpp, src/gui/browserbox.cpp, src/gui/buddywindow.cpp, src/gui/buddywindow.h, src/gui/buysell.h, @@ -3807,7 +3931,7 @@ for the Window class. (Fixes each Window listening to config changes, although they only affect a static class member.) -2005-08-27 Björn Steinbrink +2005-08-27 Björn Steinbrink * src/gui/npc.cpp: Fix a memory leak. * src/game.cpp, src/gui/npc.cpp, src/gui/npc.h: Fix the bug when @@ -3831,7 +3955,7 @@ bugfixes as I was on it. * data/maps/new_7-1.tmx.gz: Added eyecandy to the map 7-1. -2005-08-26 Björn Steinbrink +2005-08-26 Björn Steinbrink * ChangeLog: Fix indentation and line length. * docs/HACKING.txt: Fix the example (OOPS!). @@ -3852,7 +3976,7 @@ src/resources/iteminfo.cpp, data/items.xml, data/items.xsd: Added Effects description to items. -2005-08-25 Bjørn Lindeijer +2005-08-25 Bjørn Lindeijer * ChangeLog: Fixed line length using tab size of 8. * src/configuration.h, src/configuration.cpp: Removed some debug code @@ -3860,7 +3984,7 @@ * src/resources/resourcemanager.cpp: Removed unused (I think) headers for Windows. -2005-08-25 Björn Steinbrink +2005-08-25 Björn Steinbrink * src/openglgraphics.cpp: Use the translation capabilities of OpenGL instead of doing it ourselves all the time. @@ -3898,7 +4022,7 @@ * src/gui/login.h, src/gui/login.cpp: Code cleanups and improvements to the login sequence. -2005-08-23 Björn Steinbrink +2005-08-23 Björn Steinbrink * src/gui/shop.h: Fixed using a forward declaration for std::string, where it was a class member. @@ -3924,7 +4048,7 @@ * src/gui/skill.cpp: Disabled use button in skill dialog since is still not being used. -2005-08-20 Björn Steinbrink +2005-08-20 Björn Steinbrink * src/openglgraphics.cpp: Added some missing state changes and checks. * src/gui/inventorywindow.cpp, src/gui/item_amount.cpp, @@ -3932,7 +4056,7 @@ the item amount dialog work on a provided item, instead of having it ask the inventory window itself. -2005-08-19 Björn Steinbrink +2005-08-19 Björn Steinbrink * src/engine.cpp, src/game.cpp: The engine isn't connected to all the gui windows, so move creation from its constructor into the game.cpp @@ -3948,7 +4072,7 @@ Updated reference to latest libxml, fixed a bug in updating skills, updated skill names database. -2005-08-18 Björn Steinbrink +2005-08-18 Björn Steinbrink * src/Makefile.am, src/graphics.cpp, src/graphics.h, src/main.cpp, src/openglgraphics.cpp src/openglgraphics.h, src/gui/gui.cpp, @@ -3980,7 +4104,7 @@ data/graphics/gui/resize.png: Added a resize grip to resizable window, fixed some compiling errors. -2005-08-15 Björn Steinbrink +2005-08-15 Björn Steinbrink * src/engine.cpp, src/gui/gui.cpp, src/gui/gui.h: Removed guiTop global variable. @@ -4000,7 +4124,7 @@ dependencies on gui.h in some places. -2005-08-14 Björn Steinbrink +2005-08-14 Björn Steinbrink * src/graphics.cpp, src/graphics.h, src/resources/image.cpp, src/resources/image.h: Moved the image drawing code into the graphics @@ -4009,7 +4133,7 @@ the wrapper functions in the Graphics class conditional on whether we compile with OpenGL support. -2005-08-13 Björn Steinbrink +2005-08-13 Björn Steinbrink * src/Makefile.am, src/being.cpp, src/being.h, src/configlistener.cpp, src/configlistener.h, src/configuration.cpp, src/configuration.h, @@ -4085,7 +4209,7 @@ * src/resources/image.cpp: Little cleanup and simplification. -2005-08-10 Björn Steinbrink +2005-08-10 Björn Steinbrink * src/engine.cpp, src/graphics.cpp, src/graphics.h, src/gui/browserbox.cpp, src/gui/gui.cpp, src/gui/listbox.cpp, @@ -4095,12 +4219,12 @@ * src/game.cpp: Added helper function for being creation to reduce code duplication. Some code simplifications. -2005-08-09 Björn Steinbrink +2005-08-09 Björn Steinbrink * src/engine.cpp: Adjust drawing offset to have the player centered in higher resolutions as well. -2005-08-04 Björn Steinbrink +2005-08-04 Björn Steinbrink * src/main.cpp: Use "true" instead of "1" as bool argument. * src/resources/resourcemanager.cpp, src/resources/resourcemanager.h: @@ -4119,7 +4243,7 @@ * src/game.cpp, src/game.h, src/gui/requesttrade.cpp: Fix my previous fix because it broke my own code. -2005-08-03 Björn Steinbrink +2005-08-03 Björn Steinbrink * src/main.cpp: Use PhysFS to determine user's home directory on unix system. Removed an now unused header. @@ -4134,7 +4258,7 @@ * src/game.cpp: Fixed "Trade canceled" happening often. -2005-08-02 Björn Steinbrink +2005-08-02 Björn Steinbrink * src/engine.cpp: Cleanups in the drawing code. * src/engine.cpp, src/game.cpp: Made autoTarget checks being handled at @@ -4148,7 +4272,7 @@ * tmw/src/gui/status.cpp: making setup dialog quitting when clicking on setup button while dialog is opened -2005-08-01 Björn Steinbrink +2005-08-01 Björn Steinbrink * src/inventory.cpp, src/inventory.h, src/gui/itemcontainer.cpp, src/gui/itemcontainer.h: Added a logic function to dynamically adjust @@ -4160,7 +4284,7 @@ * src/game.cpp, src/game.h, src/gui/popupmenu.cpp: Show the name of the trade partner in the trade dialog. -2005-07-31 Björn Steinbrink +2005-07-31 Björn Steinbrink * src/gui/listbox.cpp: Small cleanup of the drawing code. * src/engine.cpp: Added a check to stop scrolling when we hit the map @@ -4176,7 +4300,7 @@ * src/main.cpp: Removed unnecessary value assignment to a variable. -2005-07-30 Björn Steinbrink +2005-07-30 Björn Steinbrink * src/main.cpp, src/resources/resourcemanager.h, src/resources/resourcemanager.cpp: Fixed buggy check for the existence @@ -4184,12 +4308,12 @@ physfs functions and moved the actual setup process from the resource manager constructor into the main initialization. -2005-07-29 Björn Steinbrink +2005-07-29 Björn Steinbrink * src/game.cpp: Fixed popup window not always being correctly hidden when the player clicks somewhere else. -2005-07-28 Björn Steinbrink +2005-07-28 Björn Steinbrink * src/main.cpp, src/gui/update.cpp, src/resources/resourcemanager.cpp, src/resources/resourcemanager.h: Added support for files downloaded @@ -4207,7 +4331,7 @@ * src/main.cpp: Fixed updates directory not being created on non-unix systems. Started using PhysFS write support. -2005-07-27 Bjørn Lindeijer +2005-07-27 Bjørn Lindeijer * src/engine.cpp, src/game.cpp, src/graphics.cpp, src/graphics.h, src/main.cpp, src/gui/browserbox.cpp, src/gui/button.cpp, @@ -4218,12 +4342,12 @@ src/resources/mapreader.h: Merged OpenGL/SDL merge patch by Andrej Sinicyn, and his followup patch for fixing SDL-only build. -2005-07-27 Björn Steinbrink +2005-07-27 Björn Steinbrink * src/gui/gui.cpp, src/gui/gui.h: Removed continous mouse movement, that implementation wasn't suitable for a release. -2005-07-26 Björn Steinbrink +2005-07-26 Björn Steinbrink * src/being.cpp, src/being.h, src/engine.cpp, src/game.cpp, src/gui/minimap.cpp, src/gui/popupmenu.cpp, src/net/protocol.cpp: @@ -4243,14 +4367,14 @@ * src/gui/skill.cpp: Added new skill names. * src/main.cpp: Moved sound playback to update screen and changed song. -2005-07-24 Björn Steinbrink +2005-07-24 Björn Steinbrink * src/game.cpp: Made the key-event handler use switches instead of if-else. * src/gui/gui.cpp, src/gui/gui.h: Allow continous movement when holding down the left mouse button. -2005-07-23 Björn Steinbrink +2005-07-23 Björn Steinbrink * src/being.h, src/being.cpp: Added a member to keep the current map, restored setDestination. @@ -4258,7 +4382,7 @@ Being::setDestination(). * src/map.h: Add a forward declaration for struct PATH_NODE. -2005-07-23 Bjørn Lindeijer +2005-07-23 Bjørn Lindeijer * NEWS: Moved project news here. * ChangeLog: Started standard ChangeLog file here. diff --git a/README b/README index 2d6f07b1..8a60ec8f 100644 --- a/README +++ b/README @@ -3,7 +3,6 @@ THE MANA WORLD Version: 0.0.22.2 Date: 17/02/2007 - Development team: - See AUTHORS file for a list diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed5623fc..b88921c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -260,6 +260,8 @@ SET(SRCS utils/xml.h animatedsprite.cpp animatedsprite.h + animationparticle.cpp + animationparticle.h being.cpp being.h beingmanager.cpp @@ -280,6 +282,8 @@ SET(SRCS graphics.cpp graphics.h guichanfwd.h + imageparticle.cpp + imageparticle.h inventory.cpp inventory.h item.cpp @@ -302,6 +306,10 @@ SET(SRCS npc.h openglgraphics.cpp openglgraphics.h + particle.cpp + particle.h + particleemitter.cpp + particleemitter.h player.cpp player.h properties.h @@ -311,6 +319,8 @@ SET(SRCS sound.cpp sound.h sprite.h + textparticle.cpp + textparticle.h tileset.h ) diff --git a/src/Makefile.am b/src/Makefile.am index d491ca4b..088c4b18 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -209,6 +209,8 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \ utils/xml.h \ animatedsprite.cpp \ animatedsprite.h \ + animationparticle.cpp \ + animationparticle.h \ being.cpp \ being.h \ beingmanager.cpp \ @@ -229,6 +231,8 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \ graphics.cpp \ graphics.h \ guichanfwd.h \ + imageparticle.cpp \ + imageparticle.h \ inventory.cpp \ inventory.h \ item.cpp \ @@ -251,15 +255,21 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \ npc.h \ openglgraphics.cpp\ openglgraphics.h \ + particle.cpp \ + particle.h \ + particleemitter.cpp \ + particleemitter.h \ player.cpp \ player.h \ properties.h \ serverinfo.h \ simpleanimation.cpp \ - simpleanimation.h \ + simpleanimation.h \ sound.cpp \ sound.h \ sprite.h \ + textparticle.cpp \ + textparticle.h \ tileset.h # set the include path found by configure diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp new file mode 100644 index 00000000..30c33da7 --- /dev/null +++ b/src/animationparticle.cpp @@ -0,0 +1,51 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#include "animationparticle.h" + +#include "graphics.h" +#include "simpleanimation.h" + +AnimationParticle::AnimationParticle(Map *map, Animation *animation): + ImageParticle(map, 0), + mAnimation(new SimpleAnimation(animation)) +{ +} + +AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode): + ImageParticle(map, 0), + mAnimation(new SimpleAnimation(animationNode)) +{ +} + +AnimationParticle::~AnimationParticle() +{ + delete mAnimation; +} + +bool AnimationParticle::update() +{ + mAnimation->update(10); // particle engine is updated every 10ms + mImage = mAnimation->getCurrentImage(); + + return Particle::update(); +} diff --git a/src/animationparticle.h b/src/animationparticle.h new file mode 100644 index 00000000..054b1b73 --- /dev/null +++ b/src/animationparticle.h @@ -0,0 +1,49 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#ifndef _ANIMATION_PARTICLE +#define _ANIMATION_PARTICLE + +#include + +#include "imageparticle.h" + +class Animation; +class Map; +class SimpleAnimation; + +class AnimationParticle : public ImageParticle +{ + public: + AnimationParticle(Map *map, Animation *animation); + + AnimationParticle(Map *map, xmlNodePtr animationNode); + + ~AnimationParticle(); + + virtual bool update(); + + private: + SimpleAnimation *mAnimation; /**< Used animation for this particle */ +}; + +#endif diff --git a/src/being.cpp b/src/being.cpp index 930c2d24..db7751bf 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -30,12 +30,16 @@ #include "graphics.h" #include "log.h" #include "map.h" +#include "particle.h" #include "resources/resourcemanager.h" #include "resources/imageset.h" #include "gui/gui.h" +#include "resources/resourcemanager.h" +#include "resources/imageset.h" + #include "utils/dtor.h" #include "utils/tostring.h" @@ -58,7 +62,6 @@ Being::Being(Uint32 id, Uint16 job, Map *map): mHairStyle(0), mHairColor(0), mSex(2), mSpeechTime(0), - mDamageTime(0), mPx(0), mPy(0), mSprites(VECTOREND_SPRITE, NULL), mEquipmentSpriteIDs(VECTOREND_SPRITE, 0) @@ -82,6 +85,13 @@ Being::~Being() clearPath(); setMap(NULL); + for ( std::list::iterator i = mChildParticleEffects.begin(); + i != mChildParticleEffects.end(); + i++) + { + (*i)->kill(); + } + instances--; if (instances == 0) @@ -154,8 +164,34 @@ Being::setSpeech(const std::string &text, Uint32 time) void Being::takeDamage(int amount) { - mDamage = amount ? toString(amount) : "miss"; - mDamageTime = 300; + gcn::Font* font; + std::string damage = amount ? toString(amount) : "miss"; + + // Selecting the right color + if (damage == "miss") + { + font = hitYellowFont; + } + else + { + // hit particle effect + controlParticle(particleEngine->addEffect("graphics/particles/hit.particle.xml", 0, 0)); + + if (getType() == MONSTER) + { + font = hitBlueFont; + } + else + { + font = hitRedFont; + } + } + + // show damage number + particleEngine->addTextSplashEffect(damage, + font, + gcn::Color(255, 255, 255), + mPx + 16, mPy + 16); } void @@ -182,6 +218,19 @@ Being::setMap(Map *map) { mSpriteIterator = mMap->addSprite(this); } + + //clear particle effect list because child particles became invalid + mChildParticleEffects.clear(); +} + +void +Being::controlParticle(Particle *particle) +{ + if (particle) + { + particle->disableAutoDelete(); //the effect may not die without the beings permission or we segvault + mChildParticleEffects.push_back(particle); + } } void @@ -321,10 +370,6 @@ Being::logic() if (mSpeechTime > 0) mSpeechTime--; - // Reduce the time that damage is still displayed - if (mDamageTime > 0) - mDamageTime--; - // Update pixel coordinates mPx = mX * 32 + getXOffset(); mPy = mY * 32 + getYOffset(); @@ -345,6 +390,14 @@ Being::logic() mSprites[i]->update(tick_time * 10); } } + + //Update particle effects + for ( std::list::iterator i = mChildParticleEffects.begin(); + i != mChildParticleEffects.end(); + i++) + { + (*i)->setPosition((float)mPx + 16.0f, (float)mPy + 32.0f); + } } void @@ -387,37 +440,6 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) graphics->setColor(gcn::Color(255, 255, 255)); graphics->drawText(mSpeech, px + 18, py - 60, gcn::Graphics::CENTER); } - - // Draw damage above this being - if (mDamageTime > 0 && mDamageTime < 275) - { - // Selecting the right color - if (mDamage == "miss") - { - graphics->setFont(hitYellowFont); - } - else if (getType() == MONSTER) - { - graphics->setFont(hitBlueFont); - } - else - { - graphics->setFont(hitRedFont); - } - - int textY = (getType() == MONSTER) ? 32 : 70; - 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 - (300 - mDamageTime) / 10, - gcn::Graphics::CENTER); - - // Reset alpha value - graphics->setColor(gcn::Color(255, 255, 255)); - } } Being::Type diff --git a/src/being.h b/src/being.h index 08b0e710..5dbd845b 100644 --- a/src/being.h +++ b/src/being.h @@ -42,6 +42,7 @@ class Item; class Map; class Graphics; class ImageSet; +class Particle; /** * A position along a being's path. @@ -351,6 +352,12 @@ class Being : public Sprite std::auto_ptr mEquipment; + /** + * Take control of a particle + */ + void + controlParticle(Particle *particle); + protected: /** * Sets the new path for this being. @@ -380,15 +387,14 @@ class Being : public Sprite Path mPath; std::string mSpeech; - std::string mDamage; Uint16 mHairStyle, mHairColor; Uint8 mSex; Uint32 mSpeechTime; - Uint32 mDamageTime; Sint32 mPx, mPy; /**< Pixel coordinates */ std::vector mSprites; std::vector mEquipmentSpriteIDs; + std::list mChildParticleEffects; private: static int instances; /**< Number of Being instances */ diff --git a/src/engine.cpp b/src/engine.cpp index 8546f150..fb6b6048 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -36,6 +36,7 @@ #include "log.h" #include "main.h" #include "map.h" +#include "particle.h" #include "sound.h" #include "gui/gui.h" @@ -68,6 +69,7 @@ void Engine::changeMap(const std::string &mapPath) floorItemManager->clear(); beingManager->clear(); + particleEngine->clear(); // Store full map path in global var map_path = "maps/" + mapPath.substr(0, mapPath.rfind(".")) + ".tmx.gz"; @@ -88,8 +90,12 @@ void Engine::changeMap(const std::string &mapPath) } minimap->setMapImage(mapImage); beingManager->setMap(newMap); + particleEngine->setMap(newMap); viewport->setMap(newMap); + // Initialize map-based particle effects + newMap->initializeParticleEffects(particleEngine); + // Start playing new music file when necessary std::string oldMusic = ""; @@ -115,5 +121,6 @@ void Engine::changeMap(const std::string &mapPath) void Engine::logic() { beingManager->logic(); + particleEngine->update(); gui->logic(); } diff --git a/src/game.cpp b/src/game.cpp index d8235384..a51343dd 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -40,6 +40,7 @@ #include "localplayer.h" #include "log.h" #include "npc.h" +#include "particle.h" #include "gui/buy.h" #include "gui/buysell.h" @@ -117,6 +118,7 @@ DebugWindow *debugWindow; BeingManager *beingManager = NULL; FloorItemManager *floorItemManager = NULL; +Particle* particleEngine = NULL; const int MAX_TIME = 10000; @@ -251,6 +253,8 @@ Game::Game(Network *network): beingManager = new BeingManager(network); floorItemManager = new FloorItemManager(); + particleEngine = new Particle(NULL); + particleEngine->setupEngine(); // Initialize timers tick_time = 0; @@ -295,6 +299,7 @@ Game::~Game() delete beingManager; delete floorItemManager; delete joystick; + delete particleEngine; beingManager = NULL; floorItemManager = NULL; diff --git a/src/graphics.cpp b/src/graphics.cpp index f007470a..4ea75a93 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -148,6 +148,17 @@ bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, return !(SDL_BlitSurface(image->mImage, &srcRect, mScreen, &dstRect) < 0); } +bool Graphics::drawImageTransparent(Image *image, int x, int y, float opacity) +{ + if (!image) return false; + + float oldalpha = image->getAlpha(); + image->setAlpha(opacity * oldalpha); + bool retval = drawImage(image, x, y); + image->setAlpha(oldalpha); + return retval; +} + void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h) { int iw = image->getWidth(); diff --git a/src/graphics.h b/src/graphics.h index b3d36653..abef794f 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -97,6 +97,14 @@ class Graphics : public gcn::SDLGraphics { int dstX, int dstY, int width, int height); + /** + * Blits an image onto the screen with an alpha factor + * + * @return true if the image was blitted properly + * false otherwise. + */ + bool drawImageTransparent(Image *image, int x, int y, float opacity); + virtual void drawImagePattern(Image *image, int x, int y, diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 563f380f..ebf7d974 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -33,6 +33,7 @@ #include "../game.h" #include "../engine.h" +#include "../particle.h" #include "../map.h" #include "../utils/tostring.h" @@ -58,6 +59,9 @@ DebugWindow::DebugWindow(): mTileMouseLabel = new gcn::Label("[Mouse: 0, 0]"); mTileMouseLabel->setPosition(100, 0); + mParticleCountLabel = new gcn::Label("[Particle count: 0]"); + mParticleCountLabel->setPosition(100, 60); + Button *closeButton = new Button("Close", "close", this); closeButton->setPosition(5, 60); @@ -65,6 +69,7 @@ DebugWindow::DebugWindow(): add(mMusicFileLabel); add(mMapFileLabel); add(mTileMouseLabel); + add(mParticleCountLabel); add(closeButton); } @@ -97,6 +102,11 @@ DebugWindow::logic() mMapFileLabel->setCaption(minimap); mMapFileLabel->adjustSize(); } + + mParticleCountLabel->setCaption("[Particle count: " + + toString(Particle::particleCount) + +"]"); + mParticleCountLabel->adjustSize(); } void diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 4fd33d83..d082b2ca 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -58,6 +58,7 @@ class DebugWindow : public Window, public gcn::ActionListener private: gcn::Label *mMusicFileLabel, *mMapFileLabel; gcn::Label *mTileMouseLabel, *mFPSLabel; + gcn::Label *mParticleCountLabel; }; #endif diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp new file mode 100644 index 00000000..86e7e50f --- /dev/null +++ b/src/imageparticle.cpp @@ -0,0 +1,67 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#include "imageparticle.h" + +#include "graphics.h" + +#include "resources/image.h" + +ImageParticle::ImageParticle(Map *map, Image *image): + Particle(map), + mImage(image) +{ +} + +void ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const +{ + if (!mAlive) + return; + + int screenX = (int)mPosX + offsetX - mImage->getWidth()/2; + int screenY = (int)mPosY - int(mPosZ) + offsetY - mImage->getHeight()/2; + + // check if on screen + if (screenX + mImage->getWidth() < 0 || + screenX > graphics->getWidth() || + screenY + mImage->getHeight() < 0 || + screenY > graphics->getHeight()) + return; + + float alphafactor = 1.0f; + + if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut) + alphafactor *= ((float)mLifetimeLeft / (float)mFadeOut); + + if (mLifetimePast < mFadeIn) + alphafactor *= ((float)mLifetimePast / (float)mFadeIn); + + if (alphafactor < 1.0f) { + graphics->drawImageTransparent(mImage, + screenX, + screenY, + alphafactor + ); + } else { + graphics->drawImage(mImage, screenX, screenY); + } +} diff --git a/src/imageparticle.h b/src/imageparticle.h new file mode 100644 index 00000000..4396fb7c --- /dev/null +++ b/src/imageparticle.h @@ -0,0 +1,46 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#ifndef _IMAGEPARTICLE_H +#define _IMAGEPARTICLE_H + +#include "particle.h" + +class Image; +class Map; + +class ImageParticle : public Particle +{ + public: + ImageParticle(Map *map, Image *image); + + /** + * Draws the particle image + */ + virtual void + draw(Graphics *graphics, int offsetX, int offsetY) const; + + protected: + Image *mImage; /**< The image used for this particle. */ +}; + +#endif diff --git a/src/map.cpp b/src/map.cpp index 575f80d3..1f0c22b9 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -29,6 +29,7 @@ #include "beingmanager.h" #include "game.h" #include "graphics.h" +#include "particle.h" #include "sprite.h" #include "tileset.h" @@ -508,3 +509,25 @@ Map::findPath(int startX, int startY, int destX, int destY) return path; } + +void +Map::addParticleEffect (std::string effectFile, int x, int y) +{ + ParticleEffectData newEffect; + newEffect.file = effectFile; + newEffect.x = x; + newEffect.y = y; + particleEffects.push_back(newEffect); +} + +void +Map::initializeParticleEffects(Particle* particleEngine) +{ + for (std::list::iterator i = particleEffects.begin(); + i != particleEffects.end(); + i++ + ) + { + particleEngine->addEffect(i->file, i->x, i->y); + } +} diff --git a/src/map.h b/src/map.h index 15b9b0dc..3ccbe7ae 100644 --- a/src/map.h +++ b/src/map.h @@ -32,8 +32,9 @@ class AmbientOverlay; class Graphics; class Image; -class Tileset; +class Particle; class Sprite; +class Tileset; struct PATH_NODE; @@ -185,6 +186,17 @@ class Map : public Properties void removeSprite(SpriteIterator iterator); + /** + * Adds a particle effect + */ + void addParticleEffect (std::string effectFile, int x, int y); + + /** + * Initializes all added particle effects + */ + void + initializeParticleEffects(Particle* particleEngine); + private: /** * Converts a global tile id to the Image* pointing to the associated @@ -220,10 +232,19 @@ class Map : public Properties // Pathfinding members int mOnClosedList, mOnOpenList; - //overlay Data + // Overlay Data std::list mOverlays; float mLastScrollX; float mLastScrollY; + + // Particle effect data + struct ParticleEffectData + { + std::string file; + int x; + int y; + }; + std::list particleEffects; }; #endif diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 4734a710..fc202b36 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -34,6 +34,7 @@ #include "../localplayer.h" #include "../log.h" #include "../main.h" +#include "../particle.h" #include "../sound.h" const int EMOTION_TIME = 150; /**< Duration of emotion icon */ @@ -212,13 +213,23 @@ void BeingHandler::handleMessage(MessageIn *msg) break; case SMSG_BEING_LEVELUP: - if ((Uint32) msg->readInt32() == player_node->getId()) { + id = (Uint32)msg->readInt32(); + + if (id == player_node->getId()) { logger->log("Level up"); sound.playSfx("sfx/levelup.ogg"); - } else { + } + else { logger->log("Someone else went level up"); } - msg->readInt32(); // type + Particle *levelupFX; + if (msg->readInt32() == 0) { // type + levelupFX = particleEngine->addEffect("graphics/particles/levelup.particle.xml", 0, 0); + } + else { + levelupFX = particleEngine->addEffect("graphics/particles/skillup.particle.xml", 0, 0); + } + beingManager->findBeing(id)->controlParticle(levelupFX); break; case SMSG_BEING_EMOTION: diff --git a/src/particle.cpp b/src/particle.cpp new file mode 100644 index 00000000..bb28c873 --- /dev/null +++ b/src/particle.cpp @@ -0,0 +1,366 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#include "particle.h" + +#include + +#include "animationparticle.h" +#include "configuration.h" +#include "imageparticle.h" +#include "log.h" +#include "map.h" +#include "particleemitter.h" +#include "textparticle.h" + +#include "resources/resourcemanager.h" + +#include "utils/dtor.h" +#include "utils/fastsqrt.h" +#include "utils/xml.h" + +class Graphics; +class Image; + +int Particle::particleCount = 0; +int Particle::maxCount = 0; +int Particle::fastPhysics = 0; +int Particle::emitterSkip = 1; +const float Particle::PARTICLE_SKY = 800.0f; + +Particle::Particle(Map *map) : + mAlive(true), + mPosX(0.0f), mPosY(0.0f), mPosZ(0.0f), + mLifetimeLeft(-1), + mLifetimePast(0), + mFadeOut(0), + mFadeIn(0), + mAutoDelete(true), + mMap(map), + mVectorX(0.0f), mVectorY(0.0f), mVectorZ(0.0f), + mGravity(0.0f), + mRandomnes(0), + mBounce(0.0f), + mTarget(NULL), + mAcceleration(0.0f), + mInvDieDistance(-1.0f), + mMomentum(1.0f) +{ + Particle::particleCount++; + if (mMap) setSpriteIterator(mMap->addSprite(this)); +} + + +void +Particle::setupEngine() +{ + Particle::maxCount = (int)config.getValue("particleMaxCount", 3000); + Particle::fastPhysics = (int)config.getValue("particleFastPhysics", 0); + Particle::emitterSkip = (int)config.getValue("particleEmitterSkip", 0) + 1; + disableAutoDelete(); + logger->log("Particle engine set up"); +} + +bool +Particle::update() +{ + if (!mMap) return false; + + if (mLifetimeLeft == 0) + { + mAlive = false; + } + + if (mAlive) + { + //update child emitters + if (mLifetimePast%Particle::emitterSkip == 0) + { + for ( EmitterIterator e = mChildEmitters.begin(); + e != mChildEmitters.end(); + e++ + ) + { + Particles newParticles = (*e)->createParticles(); + for ( ParticleIterator p = newParticles.begin(); + p != newParticles.end(); + p++ + ) + { + (*p)->moveBy(mPosX, mPosY, mPosZ); + mChildParticles.push_back (*p); + } + } + } + + if (mMomentum != 1.0f) + { + mVectorX *= mMomentum; + mVectorY *= mMomentum; + mVectorZ *= mMomentum; + } + + if (mTarget && mAcceleration != 0.0f) + { + float distX = mPosX - mTarget->getPosX(); + float distY = mPosY - mTarget->getPosY(); + float distZ = mPosZ - mTarget->getPosZ(); + float invHypotenuse; + + switch(Particle::fastPhysics) + { + case 1: + invHypotenuse = fastInvSqrt( + distX * distX + distY * distY + distZ * distZ); + break; + case 2: + invHypotenuse = 2.0f / + fabs(distX) + fabs(distY) + fabs(distZ); + break; + default: + invHypotenuse = 1.0f / sqrt( + distX * distX + distY * distY + distZ * distZ); + break; + } + + if (invHypotenuse) + { + if (mInvDieDistance > 0.0f && invHypotenuse > mInvDieDistance) + { + logger->log("killed"); + mAlive = false; + } + float accFactor = invHypotenuse * mAcceleration; + mVectorX -= distX * accFactor; + mVectorY -= distY * accFactor; + mVectorZ -= distZ * accFactor; + } + } + + if (mRandomnes > 0) + { + mVectorX += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVectorY += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVectorZ += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + } + + mVectorZ -= mGravity; + + // update position + mPosX += mVectorX; + mPosY += mVectorY; + mPosZ += mVectorZ; + + //update other stuff + if (mLifetimeLeft > 0) + { + mLifetimeLeft--; + } + mLifetimePast++; + + if (mPosZ > PARTICLE_SKY || mPosZ < 0.0f) + { + if (mBounce && fabs(mVectorZ) > mGravity * 2) { + mPosZ *= -mBounce; + mVectorX *= mBounce; + mVectorY *= mBounce; + mVectorZ *= -mBounce; + } + else { + mAlive = false; + } + } + } + + //update child particles + for ( ParticleIterator p = mChildParticles.begin(); + p != mChildParticles.end(); + + ) + { + if ((*p)->update()) + { + p++; + }else { + delete (*p); + p = mChildParticles.erase(p); + } + } + + if (!mAlive && mChildParticles.empty() && mAutoDelete) + { + return false; + }; + + return true; +} + + +void Particle::draw(Graphics *graphics, int offsetX, int offsetY) const +{ +} + + +Particle* +Particle::addEffect (std::string particleEffectFile, int pixelX, int pixelY) +{ + Particle *newParticle = NULL; + + // XML parser initialisation stuff + int size; + ResourceManager *resman = ResourceManager::getInstance(); + char *data = (char*) resman->loadFile(particleEffectFile.c_str(), size); + + if (!data) { + logger->log("Warning: Particle engine could not find %s !", + particleEffectFile.c_str()); + return NULL; + } + + xmlDocPtr doc = xmlParseMemory(data, size); + free(data); + + if (!doc) { + logger->log("Warning: Particle engine found syntax error in %s!", + particleEffectFile.c_str()); + return NULL; + } + + xmlNodePtr rootNode = xmlDocGetRootElement(doc); + if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect")) { + logger->log("Warning: %s is not a valid particle effect definition file!", + particleEffectFile.c_str()); + return NULL; + } + + // parse particles + for_each_xml_child_node(effectChildNode, rootNode) + { + // We're only interested in particles + if (!xmlStrEqual(effectChildNode->name, BAD_CAST "particle")) + continue; + + // Determine the exact particle type + xmlNodePtr node; + + // Animation + if ((node = XML::findFirstChildByName( + effectChildNode, "animation"))) { + newParticle = new AnimationParticle(mMap, node); + } + // Image + else if ((node = XML::findFirstChildByName( + effectChildNode, "image"))) { + Image *img= resman->getImage((const char*) + node->xmlChildrenNode->content); + + newParticle = new ImageParticle(mMap, img); + } + // Other + else { + newParticle = new Particle(mMap); + } + + // Read and set the basic properties of the particle + int offsetX = XML::getProperty(effectChildNode, "position-x", 0); + int offsetY = XML::getProperty(effectChildNode, "position-y", 0); + int offsetZ = XML::getProperty(effectChildNode, "position-z", 0); + + int particleX = (int)mPosX + pixelX + offsetX; + int particleY = (int)mPosY + pixelY + offsetY; + int particleZ = (int)mPosZ + offsetZ; + + int lifetime = XML::getProperty(effectChildNode, "lifetime", -1); + + newParticle->setPosition(particleX, particleY, particleZ); + newParticle->setLifetime(lifetime); + + // Look for additional emitters for this particle + for_each_xml_child_node(emitterNode, effectChildNode) + { + if (!xmlStrEqual(emitterNode->name, BAD_CAST "emitter")) + continue; + + ParticleEmitter *newEmitter; + newEmitter = new ParticleEmitter(emitterNode, newParticle, mMap); + newParticle->addEmitter(newEmitter); + } + + mChildParticles.push_back(newParticle); + } + + return newParticle; +} + + +Particle* +Particle::addTextSplashEffect(std::string text, gcn::Font *font, gcn::Color color, int x, int y) +{ + Particle *newParticle = new TextParticle(mMap, text, font, color); + newParticle->setPosition( x, + y, + 0 + ); + newParticle->setVector ( ((rand()%100) - 50) / 200.0f, //X Vector + ((rand()%100) - 50) / 200.0f, //Y Vector + ((rand()%100) / 200.0f) + 4.0f //Z Vector + ); + newParticle->setGravity(0.1f); + newParticle->setBounce(0.5f); + + mChildParticles.push_back(newParticle); + + return newParticle; +} + + +void +Particle::setMap(Map *map) +{ + mMap = map; + if (mMap) setSpriteIterator(mMap->addSprite(this)); + + // TODO: Create map emitters based on emitter data in map data +} + + +Particle::~Particle() +{ + //remove from map sprite list + if (mMap) mMap->removeSprite(mSpriteIterator); + //delete child emitters and child particles + clear(); + Particle::particleCount--; +} + + +void +Particle::clear() +{ + std::for_each(mChildEmitters.begin(), mChildEmitters.end(), + make_dtor(mChildEmitters)); + mChildEmitters.clear(); + + std::for_each(mChildParticles.begin(), mChildParticles.end(), + make_dtor(mChildParticles)); + mChildParticles.clear(); +} diff --git a/src/particle.h b/src/particle.h new file mode 100644 index 00000000..f208225a --- /dev/null +++ b/src/particle.h @@ -0,0 +1,278 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#ifndef _PARTICLE_H +#define _PARTICLE_H + +#include +#include + +#include + +#include "guichanfwd.h" +#include "sprite.h" + + +class Map; +class Particle; +class ParticleEmitter; + +typedef std::list Particles; +typedef Particles::iterator ParticleIterator; +typedef std::list Emitters; +typedef Emitters::iterator EmitterIterator; + +/** + * a particle spawned by a ParticleEmitter + */ +class Particle : public Sprite +{ + public: + static const float PARTICLE_SKY; /**< maximum Z position of particles */ + static int fastPhysics; /**< mode of squareroot calculation */ + static int particleCount; /**< current number of particles*/ + static int maxCount; /**< maximum number of particles*/ + static int emitterSkip; /**< duration of pause between two emitter updates in ticks */ + + Particle(Map *map); + + ~Particle(); + + /** + * Deletes all child particles and emitters + */ + void + clear(); + + /** + * Gives a particle the properties of an engine root particle and loads + * the particle-related config settings + */ + void + setupEngine(); + + /** + * Updates particle position, returns false when the particle should + * be deleted + */ + virtual bool + update(); + + /** + * Draws the particle image + */ + virtual void + draw(Graphics *graphics, int offsetX, int offsetY) const; + + /** + * Necessary for sorting with the other sprites + */ + virtual int + getPixelY() const + { + return (int)(mPosY + mPosZ) - 64; + }; + + /* + Basic Particle properites: + */ + + /** + * Sets the map the particle is on + */ + void setMap(Map *map); + + /** + * Creates a child particle that hosts some emitters described in the + * particleEffectFile + */ + Particle* + addEffect (std::string particleEffectFile, int pixelX, int pixelY); + + /** + * Creates a standalone text particle + */ + Particle* + addTextSplashEffect(std::string text, gcn::Font *font, gcn::Color color, int x, int y); + + /** + * Adds an emitter to the particle + */ + void + addEmitter (ParticleEmitter* emitter) + { mChildEmitters.push_back(emitter);}; + + /** + * Sets the position in 3 dimensional space in pixels relative to map + */ + void + setPosition(float x, float y, float z) + { mPosX = x; mPosY = y; mPosZ = z; }; + + /** + * Sets the position in 2 dimensional space in pixels relative to map + */ + void + setPosition(float x, float y) + { mPosX = x; mPosY = y; }; + + float getPosX() const + { return mPosX; }; + + float getPosY() const + { return mPosY; }; + + float getPosZ() const + { return mPosZ; }; + + /** + * Changes the particle position relative + */ + void + moveBy(float x, float y, float z) + { mPosX += x; mPosY += y; mPosZ += z; }; + + /** + * Sets the time in game ticks until the particle is destroyed. + */ + void + setLifetime(int lifetime) + { mLifetimeLeft = lifetime; mLifetimePast = 0; }; + + /** + * Sets the age of the pixel in game ticks where the particle has + * faded in completely + */ + void + setFadeOut (int fadeOut) + { mFadeOut = fadeOut; }; + + /** + * Sets the remaining particle lifetime where the particle starts to + * fade out + */ + void + setFadeIn (int fadeIn) + { mFadeIn = fadeIn; }; + + /** + * Sets the sprite iterator of the particle on the current map to make + * it easier to remove the particle from the map when it is destroyed + */ + void + setSpriteIterator(std::list::iterator spriteIterator) + { mSpriteIterator = spriteIterator; }; + + /** + * Gets the sprite iterator of the particle on the current map + */ + std::list::iterator + getSpriteIterator() const + { return mSpriteIterator; }; + + /** + * Sets the current velocity in 3 dimensional space + */ + void + setVector(float x, float y, float z) + { mVectorX = x; mVectorY = y; mVectorZ = z; }; + + /** + * Sets the downward acceleration + */ + void + setGravity(float g) + { mGravity = g; }; + + /** + * Sets the ammount of random vector changes + */ + void + setRandomnes(int r) + { mRandomnes = r; }; + + /** + * Sets the ammount of velocity particles retain after + * hitting the ground. + */ + void + setBounce(float bouncieness) + { mBounce = bouncieness; }; + + /** + * Makes the particle move toward another particle with a + * given acceleration and momentum + */ + void setDestination(Particle *target, float accel, float moment) + { mTarget = target; mAcceleration = accel; mMomentum = moment; }; + + /** + * Sets the distance in pixel the particle can come near the target + * particle before it is destroyed. Does only make sense after a + * target particle has been set using setDestination. + */ + void setDieDistance(float dist) + { mInvDieDistance = 1.0f / dist; }; + + /** + * Manually marks the particle for deletion + */ + void kill() + { mAlive = false; mAutoDelete = true; }; + + /** + * After calling this function the particle will only request + * deletion when kill() is called + */ + void disableAutoDelete() + { mAutoDelete = false; }; + + protected: + bool mAlive; /**< Is the particle supposed to be drawn and updated?*/ + float mPosX, mPosY, mPosZ; /**< Position in 3 dimensonal space - pixel based relative to map */ + int mLifetimeLeft; /**< Lifetime left in game ticks*/ + int mLifetimePast; /**< Age of the particle in game ticks*/ + int mFadeOut; /**< Lifetime in game ticks left where fading out begins*/ + int mFadeIn; /**< Age in game ticks where fading in is finished*/ + + private: + // generic properties + bool mAutoDelete; /**< May the particle request its deletion by the parent particle?*/ + Map *mMap; /**< Map the particle is on*/ + std::list::iterator mSpriteIterator; /**< iterator of the particle on the current map */ + Emitters mChildEmitters; /**< List of child emitters*/ + Particles mChildParticles; /**< List of particles controlled by this particle*/ + //dynamic particle + float mVectorX, mVectorY, mVectorZ; /**< Speed in 3 dimensional space in pixels per game-tick */ + float mGravity; /**< Downward acceleration in pixels per game-tick²*/ + int mRandomnes; /**< Ammount of random vector change*/ + float mBounce; /**< How much the particle bounces off when hitting the ground*/ + //follow-point particles + Particle *mTarget; /**< The particle that attracts this particle*/ + float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick²*/ + float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/ + float mMomentum; /**< How much speed the particle retains after each game tick*/ +}; + +extern Particle *particleEngine; + +#endif diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp new file mode 100644 index 00000000..62ac6bd8 --- /dev/null +++ b/src/particleemitter.cpp @@ -0,0 +1,313 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#include "particleemitter.h" + +#include "animationparticle.h" +#include "imageparticle.h" +#include "log.h" +#include "particle.h" + +#include "resources/animation.h" +#include "resources/image.h" +#include "resources/resourcemanager.h" +#include "resources/imageset.h" + +#include + +#define SIN45 0.707106781f +#define DEG_RAD_FACTOR 0.017453293f + +ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map) +{ + mMap = map; + mParticleTarget = target; + + //initializing default values + mParticlePosX.set (0.0f); + mParticlePosY.set (0.0f); + mParticlePosZ.set (0.0f); + mParticleAngleHorizontal.set (0.0f); + mParticleAngleVertical.set (0.0f); + mParticlePower.set (0.0f); + mParticleGravity.set (0.0f); + mParticleRandomnes.set (0); + mParticleBounce.set(0.0f); + mParticleAcceleration.set (0.0f); + mParticleDieDistance.set(-1.0f); + mParticleMomentum.set (1.0f); + mParticleLifetime.set (-1); + mParticleFadeOut.set (0); + mParticleFadeIn.set (0); + mOutput.set (1); + mParticleImage = ""; + + for_each_xml_child_node(propertyNode, emitterNode) + { + if (xmlStrEqual(propertyNode->name, BAD_CAST "property")) + { + std::string name = XML::getProperty(propertyNode, "name", ""); + + if (name == "position-x") + { + mParticlePosX = readMinMax(propertyNode, 0.0f); + } + else if (name == "position-y") + { + + mParticlePosY = readMinMax(propertyNode, 0.0f); + } + else if (name == "position-z") + { + mParticlePosZ = readMinMax(propertyNode, 0.0f); + } + else if (name == "image") + { + mParticleImage = XML::getProperty(propertyNode, "value", ""); + } + else if (name == "horizontal-angle") + { + mParticleAngleHorizontal = readMinMax(propertyNode, 0.0f); + mParticleAngleHorizontal.minVal *= DEG_RAD_FACTOR; + mParticleAngleHorizontal.maxVal *= DEG_RAD_FACTOR; + } + else if (name == "vertical-angle") + { + mParticleAngleVertical = readMinMax(propertyNode, 0.0f); + mParticleAngleVertical.minVal *= DEG_RAD_FACTOR; + mParticleAngleVertical.maxVal *= DEG_RAD_FACTOR; + } + else if (name == "power") + { + mParticlePower = readMinMax(propertyNode, 0.0f); + } + else if (name == "gravity") + { + mParticleGravity = readMinMax(propertyNode, 0.0f); + } + else if (name == "randomnes") + { + mParticleRandomnes = readMinMax(propertyNode, 0); + } + else if (name == "bounce") + { + mParticleBounce = readMinMax(propertyNode, 0.0f); + } + else if (name == "lifetime") + { + mParticleLifetime = readMinMax(propertyNode, 0); + mParticleLifetime.minVal += 1; + } + else if (name == "output") + { + mOutput = readMinMax(propertyNode, 0); + mOutput.maxVal +=1; + } + else if (name == "acceleration") + { + mParticleAcceleration = readMinMax(propertyNode, 0.0f); + } + else if (name == "die-distance") + { + mParticleDieDistance = readMinMax(propertyNode, 0.0f); + } + else if (name == "momentum") + { + mParticleMomentum = readMinMax(propertyNode, 1.0f); + } + else if (name == "fade-out") + { + mParticleFadeOut = readMinMax(propertyNode, 0); + } + else if (name == "fade-in") + { + mParticleFadeIn = readMinMax(propertyNode, 0); + } + else + { + logger->log("Particle Engine: Warning, unknown emitter property \"%s\"", + name.c_str() + ); + } + } + else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter")) + { + ParticleEmitter newEmitter(propertyNode, mParticleTarget, map); + mParticleChildEmitters.push_back(newEmitter); + } + else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation")) + { + ImageSet *imageset = ResourceManager::getInstance()->getImageSet( + XML::getProperty(propertyNode, "imageset", ""), + XML::getProperty(propertyNode, "width", 0), + XML::getProperty(propertyNode, "height", 0) + ); + + // Get animation frames + for_each_xml_child_node(frameNode, propertyNode) + { + int delay = XML::getProperty(frameNode, "delay", 0); + int offsetX = XML::getProperty(frameNode, "offsetX", 0); + int offsetY = XML::getProperty(frameNode, "offsetY", 0); + offsetY -= imageset->getHeight() - 32; + offsetX -= imageset->getWidth() / 2 - 16; + + if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + { + int index = XML::getProperty(frameNode, "index", -1); + + if (index < 0) + { + logger->log("No valid value for 'index'"); + continue; + } + + Image *img = imageset->get(index); + + if (!img) + { + logger->log("No image at index " + (index)); + continue; + } + + mParticleAnimation.addFrame(img, delay, offsetX, offsetY); + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + { + int start = XML::getProperty(frameNode, "start", -1); + int end = XML::getProperty(frameNode, "end", -1); + + if (start < 0 || end < 0) + { + logger->log("No valid value for 'start' or 'end'"); + continue; + } + + while (end >= start) + { + Image *img = imageset->get(start); + + if (!img) + { + logger->log("No image at index " + + (start)); + continue; + } + + mParticleAnimation.addFrame(img, delay, offsetX, offsetY); + start++; + } + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + { + mParticleAnimation.addTerminator(); + } + } // for frameNode + } + } +} + + +template MinMax +ParticleEmitter::readMinMax(xmlNodePtr propertyNode, T def) +{ + MinMax retval; + + def = (T)XML::getFloatProperty(propertyNode, "value", (double)def); + retval.set ( (T)XML::getFloatProperty(propertyNode, "min", (double)def), + (T)XML::getFloatProperty(propertyNode, "max", (double)def) + ); + + return retval; +} + + +std::list +ParticleEmitter::createParticles() +{ + std::list newParticles; + ResourceManager *resman = ResourceManager::getInstance(); + + for (int i = mOutput.value(); i > 0; i--) + { + //limit maximum particles + if (Particle::particleCount > Particle::maxCount) break; + + Particle *newParticle; + if (mParticleImage != "") + { + newParticle = new ImageParticle(mMap, + resman->getImage(mParticleImage)); + } + else if (mParticleAnimation.getLength() > 0) + { + Animation *newAnimation = new Animation(mParticleAnimation); + newParticle = new AnimationParticle(mMap, newAnimation); + } + else + { + newParticle = new Particle(mMap); + } + + + newParticle->setPosition( + mParticlePosX.value(), + mParticlePosY.value(), + mParticlePosZ.value() + ); + + float angleH = mParticleAngleHorizontal.value(); + float angleV = mParticleAngleVertical.value(); + float power = mParticlePower.value(); + newParticle->setVector( + cos(angleH) * cos(angleV) * power, + sin(angleH) * cos(angleV) * SIN45 * power, + sin(angleV) * SIN45 * power + ); + + newParticle->setRandomnes(mParticleRandomnes.value()); + newParticle->setGravity(mParticleGravity.value()); + newParticle->setBounce(mParticleBounce.value()); + + newParticle->setDestination(mParticleTarget, + mParticleAcceleration.value(), + mParticleMomentum.value() + ); + newParticle->setDieDistance(mParticleDieDistance.value()); + + newParticle->setLifetime(mParticleLifetime.value()); + newParticle->setFadeOut(mParticleFadeOut.value()); + newParticle->setFadeIn(mParticleFadeIn.value()); + + for ( std::list::iterator i = mParticleChildEmitters.begin(); + i != mParticleChildEmitters.end(); + i++ + ) + { + newParticle->addEmitter(new ParticleEmitter(*i)); + } + + newParticles.push_back(newParticle); + } + + return newParticles; +} diff --git a/src/particleemitter.h b/src/particleemitter.h new file mode 100644 index 00000000..dcc7069b --- /dev/null +++ b/src/particleemitter.h @@ -0,0 +1,108 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +#ifndef _PARTICLEEMITTER_H +#define _PARTICLEEMITTER_H + +#include + +#include "utils/xml.h" +#include "utils/minmax.h" + +#include "resources/animation.h" + +class Map; +class Particle; + +/** + * Every Particle can have one or more particle emitters that create new + * particles when they are updated + */ +class ParticleEmitter +{ + public: + + ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map); + + /** + * Spawns new particles + * @return: a list of created particles + */ + std::list createParticles(); + + /** + * Sets the target of the particles that are created + */ + void + setTarget(Particle *target) + { mParticleTarget = target; }; + + private: + template MinMax readMinMax(xmlNodePtr propertyNode, T def); + + /** + * initial position of particles: + */ + MinMax mParticlePosX, mParticlePosY, mParticlePosZ; + + /** + * initial vector of particles: + */ + MinMax mParticleAngleHorizontal, mParticleAngleVertical; + + /** + * Initial velocity of particles + */ + MinMax mParticlePower; + + /** + * vector changing of particles: + */ + MinMax mParticleGravity; + MinMax mParticleRandomnes; + MinMax mParticleBounce; + + /** + * Properties of targeting particles: + */ + Particle *mParticleTarget; + MinMax mParticleAcceleration; + MinMax mParticleDieDistance; + MinMax mParticleMomentum; + + /** + * Behavior over time of the particles: + */ + MinMax mParticleLifetime; + MinMax mParticleFadeOut; + MinMax mParticleFadeIn; + + Map *mMap; /**< Map the particles are supposed to spawn on */ + + MinMax mOutput; /**< Number of particles spawned per update */ + + std::string mParticleImage; /**< Filename of particle image */ + Animation mParticleAnimation; /**< Filename of particle animation file */ + + std::list mParticleChildEmitters; /** List of emitters the spawned particles are equipped with */ +}; +#endif diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index fda8916d..2230cb6a 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -231,6 +231,30 @@ MapReader::readMap(xmlNodePtr node, const std::string &path) { readProperties(childNode, map); } + else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup")) + { + for_each_xml_child_node(objectNode, childNode) + { + if (xmlStrEqual(objectNode->name, BAD_CAST "object")) + { + std::string objName = XML::getProperty(objectNode, "name", ""); + std::string objType = XML::getProperty(objectNode, "type", ""); + int objX = XML::getProperty(objectNode, "x", 0); + int objY = XML::getProperty(objectNode, "y", 0); + + logger->log("- Loading object name: %s type: %s at %d:%d", + objName.c_str(), objType.c_str(), objX, objY); + if (objType == "PARTICLE_EFFECT") + { + map->addParticleEffect(objName, objX, objY); + } + else + { + logger->log(" Warning: Unknown object type"); + } + } + } + } } map->initializeOverlays(); diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 5fc35bcd..f52fd172 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -23,10 +23,95 @@ #include "simpleanimation.h" +#include "graphics.h" +#include "log.h" + +#include "resources/image.h" +#include "resources/resourcemanager.h" +#include "resources/imageset.h" + + +SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode): + mAnimationTime(0), + mAnimationPhase(0) +{ + mAnimation = new Animation(); + + ImageSet *imageset = ResourceManager::getInstance()->getImageSet( + XML::getProperty(animationNode, "imageset", ""), + XML::getProperty(animationNode, "width", 0), + XML::getProperty(animationNode, "height", 0) + ); + + // Get animation frames + for ( xmlNodePtr frameNode = animationNode->xmlChildrenNode; + frameNode != NULL; + frameNode = frameNode->next) + { + int delay = XML::getProperty(frameNode, "delay", 0); + int offsetX = XML::getProperty(frameNode, "offsetX", 0); + int offsetY = XML::getProperty(frameNode, "offsetY", 0); + offsetY -= imageset->getHeight() - 32; + offsetX -= imageset->getWidth() / 2 - 16; + + if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + { + int index = XML::getProperty(frameNode, "index", -1); + + if (index < 0) + { + logger->log("No valid value for 'index'"); + continue; + } + + Image *img = imageset->get(index); + + if (!img) + { + logger->log("No image at index " + (index)); + continue; + } + + mAnimation->addFrame(img, delay, offsetX, offsetY); + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + { + int start = XML::getProperty(frameNode, "start", -1); + int end = XML::getProperty(frameNode, "end", -1); + + if (start < 0 || end < 0) + { + logger->log("No valid value for 'start' or 'end'"); + continue; + } + + while (end >= start) + { + Image *img = imageset->get(start); + + if (!img) + { + logger->log("No image at index " + + (start)); + continue; + } + + mAnimation->addFrame(img, delay, offsetX, offsetY); + start++; + } + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + { + mAnimation->addTerminator(); + } + } + + mCurrentFrame = mAnimation->getFrame(0); +} void SimpleAnimation::update(unsigned int timePassed) { - mAnimationTime += timePassed; + mAnimationTime+=timePassed; while (mAnimationTime > mCurrentFrame->delay) { mAnimationTime -= mCurrentFrame->delay; diff --git a/src/simpleanimation.h b/src/simpleanimation.h index a56c31da..14793c2f 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -26,7 +26,10 @@ #include "resources/animation.h" +#include "utils/xml.h" + class Frame; +class Graphics; /** * This class is a leightweight alternative to the AnimatedSprite class. @@ -35,6 +38,10 @@ class Frame; class SimpleAnimation { public: + + /** + * Creates a simple animation with an already created animation + */ SimpleAnimation(Animation *animation): mAnimation(animation), mAnimationTime(0), @@ -42,6 +49,11 @@ class SimpleAnimation mCurrentFrame(mAnimation->getFrame(0)) {}; + /** + * Creates a simple animation that creates its animation from XML Data + */ + SimpleAnimation(xmlNodePtr animationNode); + ~SimpleAnimation(); void update(unsigned int timePassed); @@ -49,17 +61,10 @@ class SimpleAnimation Image *getCurrentImage() const; private: - /** The hosted animation. */ - Animation *mAnimation; - - /** Time in game ticks the current frame is shown. */ - unsigned int mAnimationTime; - - /** Index of current animation frame. */ - unsigned int mAnimationPhase; - - /** Current animation frame. */ - Frame *mCurrentFrame; + Animation *mAnimation; /**< The hosted animation */ + unsigned int mAnimationTime; /**< Time in game ticks the current frame is shown*/ + unsigned int mAnimationPhase; /**< Index of current animation phase*/ + Frame *mCurrentFrame; /**< Current animation phase */ }; #endif diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h new file mode 100644 index 00000000..8ba6f8ce --- /dev/null +++ b/src/utils/fastsqrt.h @@ -0,0 +1,23 @@ +/* A very fast function to calculate the approximate inverse square root of a + * floating point value and a helper function that uses it for getting the + * normal squareroot. For an explanation of the inverse squareroot function + * read: + * http://www.math.purdue.edu/~clomont/Math/Papers/2003/InvSqrt.pdf + * + * Unfortunately the original creator of this function seems to be unknown. + */ + +float fastInvSqrt(float x) +{ + float xhalf = 0.5f*x; + int i = *(int*)&x; + i = 0x5f375a86- (i>>1); + x = *(float*)&i; + x = x*(1.5f-xhalf*x*x); + return x; +} + +float fastSqrt(float x) +{ + return 1.0f/fastInvSqrt(x); +} diff --git a/src/utils/minmax.h b/src/utils/minmax.h new file mode 100644 index 00000000..1add2b7e --- /dev/null +++ b/src/utils/minmax.h @@ -0,0 +1,47 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + * + */ + +/** + * Returns a random numeric value that is larger than or equal min and smaller + * than max + */ + +template struct MinMax +{ + void set(T min, T max) + { + minVal=min; maxVal=max; + } + + void set(T val) + { + set(val, val); + } + + T value() + { + return (T)(minVal + (maxVal - minVal) * (rand() / ((double) RAND_MAX + 1))); + } + + T minVal; + T maxVal; +}; diff --git a/src/utils/wingettimeofday.h b/src/utils/wingettimeofday.h index a5537f39..28afb7e5 100644 --- a/src/utils/wingettimeofday.h +++ b/src/utils/wingettimeofday.h @@ -1,113 +1,113 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 _TMW_WINGETTIMEOFDAY_H_ -#define _TMW_WINGETTIMEOFDAY_H_ - -#ifdef WIN32 - -#include - -/* - * the function gettimeofday() is available on UNIX but not on windows. - * this header defines a windows implementation as a - * GetSystemTimeAsFileTime() wrapper. - */ - -int gettimeofday(struct timeval* tv, void *tz) -/*--------------------------------------------------------------- - * Copyright (c) 1999,2000,2001,2002,2003 - * The Board of Trustees of the University of Illinois - * All Rights Reserved. - *--------------------------------------------------------------- - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software (Iperf) and associated - * documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit - * persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * - * Redistributions of source code must retain the above - * copyright notice, this list of conditions and - * the following disclaimers. - * - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimers in the documentation and/or other materials - * provided with the distribution. - * - * - * Neither the names of the University of Illinois, NCSA, - * nor the names of its contributors may be used to endorse - * or promote products derived from this Software without - * specific prior written permission. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ________________________________________________________________ - * National Laboratory for Applied Network Research - * National Center for Supercomputing Applications - * University of Illinois at Urbana-Champaign - * http://www.ncsa.uiuc.edu - * ________________________________________________________________ - * - * gettimeofday.c - * by Mark Gates - * ------------------------------------------------------------------- - * A (hack) implementation of gettimeofday for Windows. - * Since I send sec/usec in UDP packets, this made the most sense. - * ------------------------------------------------------------------- */ -{ - FILETIME time; - double timed; - - GetSystemTimeAsFileTime( &time ); - - // Apparently Win32 has units of 1e-7 sec (tenths of microsecs) - // 4294967296 is 2^32, to shift high word over - // 11644473600 is the number of seconds between - // the Win32 epoch 1601-Jan-01 and the Unix epoch 1970-Jan-01 - // Tests found floating point to be 10x faster than 64bit int math. - - timed = ((time.dwHighDateTime * 4294967296e-7) - 11644473600.0) + - (time.dwLowDateTime * 1e-7); - - tv->tv_sec = (long) timed; - tv->tv_usec = (long) ((timed - tv->tv_sec) * 1e6); - - return 0; -} - - -#endif // WIN32 -#endif +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 _TMW_WINGETTIMEOFDAY_H_ +#define _TMW_WINGETTIMEOFDAY_H_ + +#ifdef WIN32 + +#include + +/* + * the function gettimeofday() is available on UNIX but not on windows. + * this header defines a windows implementation as a + * GetSystemTimeAsFileTime() wrapper. + */ + +int gettimeofday(struct timeval* tv, void *tz) +/*--------------------------------------------------------------- + * Copyright (c) 1999,2000,2001,2002,2003 + * The Board of Trustees of the University of Illinois + * All Rights Reserved. + *--------------------------------------------------------------- + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software (Iperf) and associated + * documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * + * Redistributions of source code must retain the above + * copyright notice, this list of conditions and + * the following disclaimers. + * + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimers in the documentation and/or other materials + * provided with the distribution. + * + * + * Neither the names of the University of Illinois, NCSA, + * nor the names of its contributors may be used to endorse + * or promote products derived from this Software without + * specific prior written permission. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * ________________________________________________________________ + * National Laboratory for Applied Network Research + * National Center for Supercomputing Applications + * University of Illinois at Urbana-Champaign + * http://www.ncsa.uiuc.edu + * ________________________________________________________________ + * + * gettimeofday.c + * by Mark Gates + * ------------------------------------------------------------------- + * A (hack) implementation of gettimeofday for Windows. + * Since I send sec/usec in UDP packets, this made the most sense. + * ------------------------------------------------------------------- */ +{ + FILETIME time; + double timed; + + GetSystemTimeAsFileTime( &time ); + + // Apparently Win32 has units of 1e-7 sec (tenths of microsecs) + // 4294967296 is 2^32, to shift high word over + // 11644473600 is the number of seconds between + // the Win32 epoch 1601-Jan-01 and the Unix epoch 1970-Jan-01 + // Tests found floating point to be 10x faster than 64bit int math. + + timed = ((time.dwHighDateTime * 4294967296e-7) - 11644473600.0) + + (time.dwLowDateTime * 1e-7); + + tv->tv_sec = (long) timed; + tv->tv_usec = (long) ((timed - tv->tv_sec) * 1e6); + + return 0; +} + + +#endif // WIN32 +#endif diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 7c917dc0..e30450f0 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -39,6 +39,20 @@ namespace XML return ret; } + double + getFloatProperty(xmlNodePtr node, const char* name, double def) + { + double &ret = def; + + xmlChar *prop = xmlGetProp(node, BAD_CAST name); + if (prop) { + ret = atof((char*)prop); + xmlFree(prop); + } + + return ret; + } + std::string getProperty(xmlNodePtr node, const char *name, const std::string &def) { @@ -51,4 +65,13 @@ namespace XML return def; } + + xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name) + { + for_each_xml_child_node(child, parent) + if (xmlStrEqual(child->name, BAD_CAST name)) + return child; + + return NULL; + } } diff --git a/src/utils/xml.h b/src/utils/xml.h index db4c264a..ef3bad3d 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -39,11 +39,22 @@ namespace XML int getProperty(xmlNodePtr node, const char *name, int def); + /** + * Gets an floating point property from an xmlNodePtr. + */ + double + getFloatProperty(xmlNodePtr node, const char *name, double def); + /** * Gets a string property from an xmlNodePtr. */ std::string getProperty(xmlNodePtr node, const char *name, const std::string &def); + + /** + * Finds the first child node with the given name + */ + xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name); } #define for_each_xml_child_node(var, parent) \ diff --git a/tmw.cbp b/tmw.cbp index f03cce59..8ab132eb 100644 --- a/tmw.cbp +++ b/tmw.cbp @@ -1027,6 +1027,26 @@