summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-04 02:20:38 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-04 02:20:38 +0000
commit4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac (patch)
tree0b18ed6970f8fdd6750459e6f9032e444d253580
parente160ba567bf3d2ae915e67c12c13e213c1a32a62 (diff)
downloadmana-client-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.tar.gz
mana-client-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.tar.bz2
mana-client-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.tar.xz
mana-client-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.zip
Merged 0.0 changes from revision 2898 to 2988 to trunk.
-rw-r--r--ChangeLog181
-rw-r--r--INSTALL2
-rw-r--r--NEWS8
-rw-r--r--README2
-rwxr-xr-xconfigure.ac3
-rw-r--r--data/CMakeLists.txt9
-rw-r--r--data/Makefile.am9
-rw-r--r--data/graphics/CMakeLists.txt1
-rw-r--r--data/graphics/Makefile.am2
-rw-r--r--data/graphics/images/CMakeLists.txt14
-rw-r--r--data/graphics/images/Makefile.am14
-rw-r--r--data/help/header.txt2
-rw-r--r--docs/INSTALL/ubuntu.txt43
-rw-r--r--docs/INSTALL/win32.txt5
-rw-r--r--src/CMakeLists.txt12
-rw-r--r--src/Makefile.am12
-rw-r--r--src/animatedsprite.cpp6
-rw-r--r--src/animatedsprite.h9
-rw-r--r--src/being.cpp33
-rw-r--r--src/being.h1
-rw-r--r--src/engine.cpp32
-rw-r--r--src/engine.h9
-rw-r--r--src/game.cpp4
-rw-r--r--src/gui/buy.cpp57
-rw-r--r--src/gui/chargedialog.cpp1
-rw-r--r--src/gui/listbox.cpp7
-rw-r--r--src/gui/listbox.h4
-rw-r--r--src/gui/sell.cpp3
-rw-r--r--src/gui/shop.cpp2
-rw-r--r--src/gui/shoplistbox.cpp142
-rw-r--r--src/gui/shoplistbox.h20
-rw-r--r--src/gui/updatewindow.cpp175
-rw-r--r--src/gui/updatewindow.h9
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/guichanfwd.h5
-rw-r--r--src/inventory.h7
-rw-r--r--src/localplayer.cpp19
-rw-r--r--src/localplayer.h17
-rw-r--r--src/main.cpp20
-rw-r--r--src/main.h3
-rw-r--r--src/net/playerhandler.cpp16
-rw-r--r--src/npc.cpp1
-rw-r--r--src/resources/action.cpp (renamed from src/action.cpp)3
-rw-r--r--src/resources/action.h (renamed from src/action.h)0
-rw-r--r--src/resources/animation.cpp (renamed from src/animation.cpp)14
-rw-r--r--src/resources/animation.h (renamed from src/animation.h)16
-rw-r--r--src/resources/equipmentdb.cpp3
-rw-r--r--src/resources/image.cpp6
-rw-r--r--src/resources/itemdb.cpp8
-rw-r--r--src/resources/itemdb.h6
-rw-r--r--src/resources/mapreader.cpp2
-rw-r--r--src/resources/monsterdb.cpp8
-rw-r--r--src/resources/openglsdlimageloader.cpp3
-rw-r--r--src/resources/openglsdlimageloader.h3
-rw-r--r--src/resources/spritedef.cpp37
-rw-r--r--src/resources/spritedef.h3
-rw-r--r--src/resources/spriteset.cpp2
-rw-r--r--src/tmw.rc41
-rw-r--r--src/utils/base64.cpp (renamed from src/base64.cpp)0
-rw-r--r--src/utils/base64.h (renamed from src/base64.h)0
-rw-r--r--src/utils/wingettimeofday.h8
-rw-r--r--src/winver.h6
-rw-r--r--tmw.cbp72
63 files changed, 688 insertions, 478 deletions
diff --git a/ChangeLog b/ChangeLog
index d2cc233c..d75d457a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,187 @@
performs an attack and attack messages from the server are received
and displayed.
+2006-12-25 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * data/graphics/tiles/christmastree.png, data/maps/new_11-1.tmx.gz:
+ Added Christmas tree by Pauan.
+ * data/graphics/sprites/head-christmastree.xml: Fixed name of image.
+ * src/resources/spriteset.cpp: Fixed index check to prevent crashing.
+ * data/graphics/sprites/head-christmastreehat.png,
+ data/graphics/sprites/head-rangerhat.png,
+ data/graphics/sprites/head-christmastree.xml,
+ data/graphics/sprites/head-antlerhat.xml,
+ data/graphics/sprites/head-santabeardhat.xml,
+ data/graphics/sprites/head-santabeardhat.png,
+ data/graphics/sprites/head-rangerhat.xml: Updates to Pauan's recent
+ sprites by Pauan.
+ * data/items.xml: Fixes to descriptions and weights by Pauan.
+
+2006-12-24 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/shoplistbox.cpp: Don't try to draw an icon when it is not
+ defined or failed to load properly.
+ * src/resources/image.cpp: Major rendering performance increase in
+ software mode, by not using RLE compression on loaded images while
+ 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 <bjorn@lindeijer.nl>
+
+ * configure.ac, data/graphics/items/Makefile.am,
+ data/graphics/items/CMakeLists.txt, data/graphics/images/Makefile.am,
+ data/graphics/images/CMakeLists.txt,
+ data/graphics/sprites/Makefile.am,
+ data/graphics/sprites/CMakeLists.txt, data/graphics/Makefile.am,
+ data/graphics/CMakeLists.txt, data/maps/Makefile.am,
+ data/maps/CMakeLists.txt, data/sfx/Makefile.am,
+ data/sfx/CMakeLists.txt, data/Makefile.am, data/CMakeLists.txt:
+ Removed database files, minimaps, items, monster sprites, maps and
+ sounds from the release. They will be released dynamically only.
+ * data/graphics/tiles/snow_x3.png: Added bottom of Christmas tree by
+ pauan.
+ * src/main.cpp, src/resources/itemdb.h, src/resources/monsterdb.cpp,
+ src/resources/itemdb.cpp, src/resources/equipmentdb.cpp: Load the
+ databases at the start of the LOGIN state, after the updates are
+ loaded.
+
+2006-12-22 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * data/graphics/items/armor-head-rangerhat.png,
+ data/graphics/items/generic-redstocking.png,
+ data/graphics/items/armor-head-christmastree.png,
+ data/graphics/items/armor-head-antlerhat.png,
+ data/graphics/items/armor-head-santabeardhat.png,
+ data/graphics/sprites/head-christmastreehat.png,
+ data/graphics/sprites/head-rangerhat.png,
+ data/graphics/sprites/head-christmastree.xml,
+ data/graphics/sprites/head-antlerhat.xml,
+ data/graphics/sprites/head-santabeardhat.xml,
+ data/graphics/sprites/head-antlerhat.png,
+ data/graphics/sprites/head-santabeardhat.png,
+ data/graphics/sprites/head-rangerhat.xml, data/items.xml,
+ data/equipment.xml, data/monsters.xml: Added new Christmas themed
+ headwear by Pauan.
+ * data/graphics/items/Makefile.am, data/graphics/items/CMakeLists.txt,
+ data/graphics/sprites/Makefile.am,
+ data/graphics/sprites/CMakeLists.txt, data/Makefile.am,
+ data/CMakeLists.txt: Updated Makefiles.
+
+2006-12-21 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * configure.ac, CMakeLists.txt, README, data/help/header.txt: Updated
+ version to 0.0.22.
+
+2006-12-18 Philipp Sehmisch <tmw@crushnet.org>
+
+ * 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 <bjorn@lindeijer.nl>
+
+ * src/gui/sell.cpp, src/gui/shoplistbox.h, src/gui/listbox.h,
+ src/gui/shop.cpp, src/gui/buy.cpp, src/gui/shoplistbox.cpp,
+ src/gui/listbox.cpp: Subclassed ShopListBox from ListBox to get rid of
+ some duplicated code, and fixed a problem with scrolling to the
+ current selection. Also aligned the text a bit better and put the
+ price in parenthesis.
+
+2006-12-16 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/connection.cpp, src/gui/chargedialog.cpp: Fixed dialog
+ visibility.
+ * src/localplayer.cpp, src/game.cpp, src/localplayer.h: Fixed issues
+ with walking one tile too many and changing direction towards an
+ obstacle.
+
+2006-12-15 Philipp Sehmisch <tmw@crushnet.org>
+
+ * data/graphics/tiles/desert1.png: Removed some unused legacy tiles and
+ added variant tiles for the cliffs.
+
+2006-12-14 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/game.cpp, src/engine.h, src/engine.cpp: Removed the rather
+ useless remaining draw function from the engine class.
+ * src/being.cpp, src/being.h: Fixed an issue with fading out damage
+ texts (they were sometimes fully opaque at the end of fading out).
+
+2006-12-12 Eugenio Favalli <elvenprogrammer@gmail.com>
+
+ * The Mana World.dev, tmw.cbp: Updated project files.
+ * src/gui/updatewindow.cpp, src/gui/updatewindow.h, src/main.cpp:
+ Added Adler32 checksum for updates.
+ * src/net/playerhandler.cpp: Fixed crash when selecting an item after
+ death.
+ * data/items.xml: Fixed defense values for sweaters.
+ * src/net/playerhandler.cpp: Hide all NPC dialogs after death.
+
+2006-12-12 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/animatedsprite.h, src/CMakeLists.txt, src/animatedsprite.cpp,
+ src/resources/action.h, src/resources/animation.h,
+ src/resources/spritedef.cpp, src/resources/action.cpp,
+ src/resources/animation.cpp, src/resources/spritedef.h: Moved
+ Action, Animation and Frame (renamed from AnimationPhase) classes into
+ the resources directory, since they are part of the SpriteDef class.
+ * src/CMakeLists.txt, src/utils/base64.cpp, src/utils/base64.h,
+ src/Makefile.am, src/resources/mapreader.cpp: Moved base64 module into
+ utils directory.
+ * src/engine.cpp, src/npc.cpp: Cleaned up some unused stuff.
+
+2006-12-12 Philipp Sehmisch <tmw@crushnet.org>
+
+ * data/sfx/bat-dying1.ogg, data/sfx/bat-hit1.ogg,
+ data/sfx/bow_shoot_1.ogg, data/sfx/fire-goblin-hit1.ogg
+ data/sfx/fire-goblin-hit2.ogg, data/sfx/fire-goblin-miss1.ogg,
+ data/sfx/fist-swish.ogg, data/sfx/flower-hit1.ogg,
+ data/sfx/flower-hit2.ogg, data/sfx/flower-miss1.ogg,
+ data/sfx/fluffy-hit1.ogg, data/sfx/fluffy-hit2.ogg,
+ data/sfx/fluffy-hit3.ogg, data/sfx/fluffy-hurt1.ogg,
+ data/sfx/fluffy-miss1.ogg, data/sfx/knife-hit1.ogg,
+ data/sfx/knife-miss1.ogg, data/sfx/levelup.ogg
+ data/sfx/scorpion-hit1.ogg, data/sfx/scorpion-hit2.ogg
+ data/sfx/scorpion-hit3.ogg, data/sfx/scorpion-hit4.ogg
+ data/sfx/scorpion-miss1.ogg, data/sfx/short-sword-hit1.ogg
+ data/sfx/short-sword-miss1.ogg, data/sfx/shroom-hit1.ogg
+ data/sfx/slime-hit1.ogg:
+ Normalized versions of sound effects by Cosmostrator.
+
+2006-12-11 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/updatewindow.cpp: Fixed visibility of the update window.
+
+2006-12-11 Philipp Sehmisch <tmw@crushnet.org>
+
+ * data/equipment.xml, data/items.xml,
+ data/graphics/sprites/chest-tnecksweater-male.png,
+ data/graphics/sprites/chest-tnecksweater-female.png,
+ data/graphics/sprites/chest-vnecksweater-male.png,
+ data/graphics/sprites/chest-vnecksweater-female.png,
+ data/graphics/sprites/chest-tnecksweater-male.xml,
+ data/graphics/sprites/chest-tnecksweater-female.xml,
+ data/graphics/sprites/chest-vnecksweater-male.xml,
+ data/graphics/sprites/chest-vnecksweater-female.xml,
+ data/graphics/sprites/Makefile.AM,
+ data/graphics/sprites/CMakeLists.txt,
+ data/graphics/items/armor-chest-vnecksweater.png,
+ data/graphics/items/armor-chest-tnecksweater.png,
+ data/graphics/items/armor-chest-woolsweater.png,
+ data/graphics/items/Makefile.AM, data/graphics/items/CMakeLists.txt:
+ Added new sweaters by Saphy. Info for server admins: Item IDs are 564
+ for turtleneck (should already be in there) and 624 for v-neck. The
+ visible sprite IDs are 19 for turtleneck and 20 for v-neck.
+
+2006-12-11 Eugenio Favalli <elvenprogrammer@gmail.com>
+
+ * src/main.h, src/tmw.rc, src/winver.h, The Mana World.dev, tmw.cbp:
+ Fixed windows binary version.
+
+2006-12-10 Eugenio Favalli <elvenprogrammer@gmail.com>
+
+ * docs/INSTALL/win32.txt: Added more detailed instructions for Dev-C++
+ users.
+
2006-12-09 Eugenio Favalli <elvenprogrammer@gmail.com>
* data/graphics/sprites/npcs.png: Added pirate NPC.
diff --git a/INSTALL b/INSTALL
index a4f269e1..5b3eb3f2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -39,7 +39,7 @@ you to figure this out.
==========================================
1) Go to the directory you have extracted the source to.
-2) If you checked out from CVS, run "./autogen.sh" to generate configure.
+2) If you checked out from SVN, run "./autogen.sh" to generate configure.
3) Run "./configure"
4) Run "make"
5) Run "make install" as root
diff --git a/NEWS b/NEWS
index f3b586f8..9edd05b6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,13 +1,17 @@
-0.0.22 (...)
+0.0.22 (24 December 2006)
- Added support for female-specific equipment graphics
- Added support for monster sounds
+- Added item icons to buy/sell dialogs
+- Enhanced character select dialog to show equipment
- Changed to new update host (http://updates.themanaworld.org)
- Worked around a Guichan exception thrown for mice with many buttons
- Changed mouse walk to keep following mouse while button is held down
-- Extended font support for å and Å.
+- Extended font support for å and Å
+- Disabled RLE compression on all surfaces in software mode
- Fixed joystick setting not to show disabled when it's actually enabled
- Fixed money field to no longer hide below the bottom of the window
- Fixed pathfinding to allow walking through beings when they block your path
+- Fixed an issue with NPC dialogs staying open after player respawn
0.0.21.1 (30 October 2006)
- Reload wallpaper after loading updates
diff --git a/README b/README
index 54a6dcaf..342524ec 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
THE MANA WORLD
==============
- Version: 0.0.21.1 Date: 30/10/2006
+ Version: 0.0.22 Date: 24/12/2006
Development team:
diff --git a/configure.ac b/configure.ac
index d32aee08..ca31930e 100755
--- a/configure.ac
+++ b/configure.ac
@@ -113,13 +113,10 @@ data/graphics/Makefile
data/graphics/gui/Makefile
data/graphics/images/Makefile
data/graphics/images/ambient/Makefile
-data/graphics/items/Makefile
data/graphics/sprites/Makefile
data/graphics/tiles/Makefile
data/help/Makefile
data/icons/Makefile
-data/maps/Makefile
-data/sfx/Makefile
docs/Makefile
])
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index e60bfe30..3c482b49 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -3,12 +3,3 @@ SET(DATA_DIR ${PKG_DATADIR}/data)
ADD_SUBDIRECTORY(graphics)
ADD_SUBDIRECTORY(help)
ADD_SUBDIRECTORY(icons)
-ADD_SUBDIRECTORY(maps)
-ADD_SUBDIRECTORY(sfx)
-
-SET(FILES
- equipment.xml
- items.xml
- )
-
-INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}) \ No newline at end of file
diff --git a/data/Makefile.am b/data/Makefile.am
index ed080d08..5a28f7c1 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,11 +1,4 @@
-SUBDIRS = graphics help icons maps sfx
+SUBDIRS = graphics help icons
tmwdatadir = $(pkgdatadir)/data
-
-tmwdata_DATA = \
- equipment.xml \
- items.xml
-
-EXTRA_DIST = \
- $(tmwdata_DATA) \ No newline at end of file
diff --git a/data/graphics/CMakeLists.txt b/data/graphics/CMakeLists.txt
index c569e04f..0fa9a7be 100644
--- a/data/graphics/CMakeLists.txt
+++ b/data/graphics/CMakeLists.txt
@@ -1,5 +1,4 @@
ADD_SUBDIRECTORY(gui)
ADD_SUBDIRECTORY(images)
-ADD_SUBDIRECTORY(items)
ADD_SUBDIRECTORY(sprites)
ADD_SUBDIRECTORY(tiles)
diff --git a/data/graphics/Makefile.am b/data/graphics/Makefile.am
index 19e95869..43354894 100644
--- a/data/graphics/Makefile.am
+++ b/data/graphics/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = gui images items sprites tiles
+SUBDIRS = gui images sprites tiles
diff --git a/data/graphics/images/CMakeLists.txt b/data/graphics/images/CMakeLists.txt
index f02cd2ea..a8b6ddbd 100644
--- a/data/graphics/images/CMakeLists.txt
+++ b/data/graphics/images/CMakeLists.txt
@@ -1,18 +1,8 @@
ADD_SUBDIRECTORY(ambient)
SET(FILES
- error.png
+ error.png
login_wallpaper.png
- minimap_new_1-1.png
- minimap_new_14-1.png
- minimap_new_15-1.png
- minimap_new_16-1.png
- minimap_new_2-1.png
- minimap_new_3-1.png
- minimap_new_5-1.png
- minimap_new_7-1.png
- minimap_new_9-1.png
- minimap_new_17-1.png
)
-INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/graphics/images) \ No newline at end of file
+INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/graphics/images)
diff --git a/data/graphics/images/Makefile.am b/data/graphics/images/Makefile.am
index 00d9ed7e..be8593f6 100644
--- a/data/graphics/images/Makefile.am
+++ b/data/graphics/images/Makefile.am
@@ -4,17 +4,7 @@ imagesdir = $(pkgdatadir)/data/graphics/images
images_DATA = \
error.png \
- login_wallpaper.png \
- minimap_new_1-1.png \
- minimap_new_2-1.png \
- minimap_new_3-1.png \
- minimap_new_5-1.png \
- minimap_new_7-1.png \
- minimap_new_9-1.png \
- minimap_new_14-1.png \
- minimap_new_15-1.png \
- minimap_new_16-1.png \
- minimap_new_17-1.png
+ login_wallpaper.png
EXTRA_DIST = \
- $(images_DATA) \ No newline at end of file
+ $(images_DATA)
diff --git a/data/help/header.txt b/data/help/header.txt
index b292388a..4f4c9615 100644
--- a/data/help/header.txt
+++ b/data/help/header.txt
@@ -2,7 +2,7 @@
##1 T H E M A N A W O R L D
##1 ==========================================
- ##2Version:##6 0.0.21.1 ##2Date:##30 October 2006
+ ##2Version:##6 0.0.22 ##2Date:##324 December 2006
##2 Website: http://themanaworld.org
diff --git a/docs/INSTALL/ubuntu.txt b/docs/INSTALL/ubuntu.txt
new file mode 100644
index 00000000..cf830ccc
--- /dev/null
+++ b/docs/INSTALL/ubuntu.txt
@@ -0,0 +1,43 @@
+How to build a .deb for TMW on Ubuntu
+=====================================
+
+This documentation is for those who are interested in building the .deb files
+of The Mana World. Most people do not need to do this, but can instead use the
+repository. You can find information about how to use the repository on our
+downloads page.
+
+
+1. Installing the dependencies
+==============================
+
+First of all you need a working compiler and package building environment. If
+you don't have this yet, install the following packages:
+
+ apt-get install gcc g++ dh-make fakeroot dpkg-dev build-essentials
+
+In order to compile The Mana World, you'll need the developer packages for
+SDL, SDL_mixer, SDL_image, SDL_net, libxml2, libphysfs and libguichan0.
+
+ apt-get install libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev ...
+
+(todo: add missing entries)
+(todo: include information about installing Guichan development package)
+
+
+2. Creating the .debs using DebHelper Tools
+===========================================
+
+Either download the source release of TMW that you want to build a package for,
+or check out the appropriate version from Subversion, for example by using the
+tag.
+
+Make sure the files in the debian directory are up to date. You can do this by
+checking out the appropriate directory from Subversion (will be either
+tmw/branches/0.0/debian or tmw/trunk/debian for the latest release).
+
+Now we can build the packages using the following command.
+
+ fakeroot dpkg-buildpackage
+
+The packages will be created in the parent folder.
+
diff --git a/docs/INSTALL/win32.txt b/docs/INSTALL/win32.txt
index ab2a429f..f438a7e7 100644
--- a/docs/INSTALL/win32.txt
+++ b/docs/INSTALL/win32.txt
@@ -45,7 +45,7 @@ the old stable version, so don't do that. Get Dev-C++ here:
http://www.bloodshed.net/
-After you fetched it simply run and install.
+After you have fetched it, simply run and install as prompted.
3. Installing the required libraries
@@ -63,6 +63,9 @@ to remove anything the devpak might overlap before installing, for example the
previous devpak.) Remember to copy the required dlls from your dll folder in
the Dev-Cpp root directory, to the folder where you have your copy of The Mana
World. You also have to add the SDL include folder in your C++ include paths.
+If you're using Dev-C++, this means: Tools -> Compiler options ->
+-> Directories -> C++ includes -> Browse... (browse to MinGW/include/SDL) ->
+-> Add -> Ok.
If you can't get the package or you are experiencing problems with it, just
send me an email at elvenprogrammer@gmail.com or continue reading. (Coming to
bug us on the IRC channel is a valid alternative too.)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e0b93382..55109ec4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -214,10 +214,14 @@ SET(SRCS
net/gameserver/internal.h
net/gameserver/player.cpp
net/gameserver/player.h
+ resources/action.cpp
+ resources/action.h
resources/ambientoverlay.cpp
resources/ambientoverlay.h
resources/buddylist.cpp
resources/buddylist.h
+ resources/animation.cpp
+ resources/animation.h
resources/equipmentdb.cpp
resources/equipmentdb.h
resources/equipmentinfo.h
@@ -251,18 +255,14 @@ SET(SRCS
resources/spritedef.h
resources/spritedef.cpp
resources/spriteset.h
+ utils/base64.cpp
+ utils/base64.h
utils/dtor.h
utils/tostring.h
utils/xml.cpp
utils/xml.h
- action.cpp
- action.h
animatedsprite.cpp
animatedsprite.h
- animation.cpp
- animation.h
- base64.cpp
- base64.h
being.cpp
being.h
beingmanager.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 1628df18..777cc30e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -179,8 +179,12 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \
net/gameserver/internal.h \
net/gameserver/player.cpp \
net/gameserver/player.h \
+ resources/action.cpp \
+ resources/action.h \
resources/ambientoverlay.cpp \
resources/ambientoverlay.h \
+ resources/animation.cpp \
+ resources/animation.h \
resources/equipmentdb.cpp \
resources/equipmentdb.h \
resources/equipmentinfo.h \
@@ -216,18 +220,14 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \
resources/spriteset.cpp \
resources/buddylist.h \
resources/buddylist.cpp \
+ utils/base64.cpp \
+ utils/base64.h \
utils/dtor.h \
utils/tostring.h \
utils/xml.cpp \
utils/xml.h \
- action.cpp \
- action.h \
animatedsprite.cpp \
animatedsprite.h \
- animation.cpp \
- animation.h \
- base64.cpp \
- base64.h \
being.cpp \
being.h \
beingmanager.cpp \
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 46369c80..3d1979a9 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -23,14 +23,14 @@
#include "animatedsprite.h"
-#include "animation.h"
-#include "action.h"
#include "graphics.h"
#include "log.h"
+#include "resources/action.h"
+#include "resources/animation.h"
+#include "resources/image.h"
#include "resources/resourcemanager.h"
#include "resources/spriteset.h"
-#include "resources/image.h"
#include "utils/xml.h"
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 4e485f14..2257c0f0 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -29,8 +29,9 @@
#include <map>
#include <string>
+class Animation;
class Graphics;
-struct AnimationPhase;
+struct Frame;
/**
* Animates a sprite by adding playback state.
@@ -72,13 +73,13 @@ class AnimatedSprite
/**
* Inform the animation of the passed time so that it can output the
- * correct animation phase.
+ * correct animation frame.
*/
void
update(int time);
/**
- * Draw the current animation phase at the coordinates given in screen
+ * Draw the current animation frame at the coordinates given in screen
* pixels.
*/
bool
@@ -103,7 +104,7 @@ class AnimatedSprite
SpriteDef *mSprite; /**< The sprite definition. */
Action *mAction; /**< The currently active action. */
Animation *mAnimation; /**< The currently active animation. */
- AnimationPhase *mFrame; /**< The currently active frame. */
+ Frame *mFrame; /**< The currently active frame. */
std::string mAnimationFile;
};
diff --git a/src/being.cpp b/src/being.cpp
index 68c670fd..ac003d1c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -65,7 +65,6 @@ Being::Being(Uint16 id, Uint16 job, Map *map):
mHairStyle(0), mHairColor(0),
mSpeechTime(0),
mDamageTime(0),
- mShowSpeech(false), mShowDamage(false),
mPx(0), mPy(0),
mSprites(VECTOREND_SPRITE, NULL),
mEquipmentSpriteIDs(VECTOREND_SPRITE, 0)
@@ -272,16 +271,14 @@ void
Being::setSpeech(const std::string &text, Uint32 time)
{
mSpeech = text;
- mSpeechTime = tick_time;
- mShowSpeech = true;
+ mSpeechTime = 500;
}
void
Being::setDamage(Sint16 amount, Uint32 time)
{
mDamage = amount ? toString(amount) : "miss";
- mDamageTime = tick_time;
- mShowDamage = true;
+ mDamageTime = 300;
}
void
@@ -443,17 +440,13 @@ Being::logic()
nextStep();
}
- // Determine whether speech should still be displayed
- if (get_elapsed_time(mSpeechTime) > 5000)
- {
- mShowSpeech = false;
- }
+ // Reduce the time that speech is still displayed
+ if (mSpeechTime > 0)
+ mSpeechTime--;
- // Determine whether damage should still be displayed
- if (get_elapsed_time(mDamageTime) > 3000)
- {
- mShowDamage = false;
- }
+ // Reduce the time that damage is still displayed
+ if (mDamageTime > 0)
+ mDamageTime--;
// Update pixel coordinates
mPx = mX - 16 + getXOffset();
@@ -511,7 +504,7 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
int py = mPy + offsetY;
// Draw speech above this being
- if (mShowSpeech)
+ if (mSpeechTime > 0)
{
graphics->setFont(speechFont);
graphics->setColor(gcn::Color(255, 255, 255));
@@ -519,7 +512,7 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
}
// Draw damage above this being
- if (mShowDamage && get_elapsed_time(mDamageTime) > 250)
+ if (mDamageTime > 0 && mDamageTime < 275)
{
// Selecting the right color
if (mDamage == "miss")
@@ -536,13 +529,13 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
}
int textY = (getType() == MONSTER) ? 32 : 70;
- int ft = get_elapsed_time(mDamageTime) - 1500;
- float a = (ft > 0) ? 1.0 - ft / 1500.0 : 1.0;
+ int ft = 150 - mDamageTime;
+ float a = (ft > 0) ? 1.0 - ft / 150.0 : 1.0;
graphics->setColor(gcn::Color(255, 255, 255, (int)(255 * a)));
graphics->drawText(mDamage,
px + 16,
- py - textY - get_elapsed_time(mDamageTime) / 100,
+ py - textY - (300 - mDamageTime) / 10,
gcn::Graphics::CENTER);
// Reset alpha value
diff --git a/src/being.h b/src/being.h
index f9287b65..bfd01568 100644
--- a/src/being.h
+++ b/src/being.h
@@ -368,7 +368,6 @@ class Being : public Sprite
Uint16 mHairStyle, mHairColor;
Uint32 mSpeechTime;
Uint32 mDamageTime;
- bool mShowSpeech, mShowDamage;
Sint32 mPx, mPy; /**< Pixel coordinates */
std::vector<AnimatedSprite*> mSprites;
diff --git a/src/engine.cpp b/src/engine.cpp
index 30f0097e..d2ce6d6f 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -54,42 +54,19 @@ extern Minimap *minimap;
char itemCurrenyQ[10] = "0";
Spriteset *emotionset;
-Spriteset *npcset;
-std::vector<Spriteset *> weaponset;
Engine::Engine():
mCurrentMap(NULL)
{
- // Load the sprite sets
+ // Load the emotion set
ResourceManager *resman = ResourceManager::getInstance();
-
- npcset = resman->getSpriteset("graphics/sprites/npcs.png", 50, 80);
- emotionset = resman->getSpriteset("graphics/sprites/emotions.png",
- 30, 32);
- for (int i = 0; i < 2; i++)
- {
- Spriteset *tmp = ResourceManager::getInstance()->getSpriteset(
- "graphics/sprites/weapon" + toString(i) + ".png", 64, 64);
- if (!tmp) {
- logger->error("Unable to load weaponset");
- } else {
- weaponset.push_back(tmp);
- }
- }
-
- if (!npcset) logger->error("Unable to load NPC spriteset!");
+ emotionset = resman->getSpriteset("graphics/sprites/emotions.png", 30, 32);
if (!emotionset) logger->error("Unable to load emotions spriteset!");
}
Engine::~Engine()
{
- // Delete sprite sets
- npcset->decRef();
emotionset->decRef();
-
- std::for_each(weaponset.begin(), weaponset.end(),
- std::mem_fun(&Spriteset::decRef));
- weaponset.clear();
}
void Engine::changeMap(const std::string &mapPath)
@@ -142,8 +119,3 @@ void Engine::logic()
beingManager->logic();
gui->logic();
}
-
-void Engine::draw(Graphics *graphics)
-{
- gui->draw();
-}
diff --git a/src/engine.h b/src/engine.h
index 62e82a49..b16b7c13 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -26,11 +26,11 @@
#include <iosfwd>
-class Graphics;
class Map;
/**
- * Game engine that does the main drawing.
+ * Game engine. Actually hardly does anything anymore except keeping track of
+ * the current map and loading the emotes.
*/
class Engine
{
@@ -60,11 +60,6 @@ class Engine
*/
void logic();
- /**
- * Draws everything on the screen.
- */
- void draw(Graphics *graphics);
-
private:
Map *mCurrentMap;
};
diff --git a/src/game.cpp b/src/game.cpp
index f708fabf..2af13146 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -360,7 +360,7 @@ void Game::logic()
get_elapsed_time(mDrawTime / 10) > mMinFrameTime)
{
frame++;
- engine->draw(graphics);
+ gui->draw();
graphics->updateScreen();
mDrawTime += mMinFrameTime;
@@ -662,7 +662,7 @@ void Game::handleInput()
direction |= Being::RIGHT;
}
- player_node->walk(direction);
+ player_node->setWalkingDir(direction);
// Target the nearest monster if 'a' pressed
if (keys[SDLK_a])
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 9fcf752b..102dd49e 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -85,7 +85,6 @@ BuyDialog::BuyDialog():
mShopItemList->setEventId("item");
mSlider->setEventId("slider");
- mShopItemList->addActionListener(this);
mShopItemList->addSelectionListener(this);
mSlider->addActionListener(this);
@@ -112,7 +111,7 @@ void BuyDialog::setMoney(int amount)
{
mMoney = amount;
mShopItemList->setPlayersMoney(amount);
- mMoneyLabel->setCaption("Price : 0 GP / " + toString(mMoney) + " GP");
+ mMoneyLabel->setCaption("Price: 0 GP / " + toString(mMoney) + " GP");
mMoneyLabel->adjustSize();
}
@@ -129,7 +128,7 @@ void BuyDialog::reset()
mDecreaseButton->setEnabled(false);
mQuantityLabel->setCaption("0");
mQuantityLabel->adjustSize();
- mMoneyLabel->setCaption("Price : 0 GP / " + toString(mMoney) + " GP");
+ mMoneyLabel->setCaption("Price: 0 GP / " + toString(mMoney) + " GP");
mMoneyLabel->adjustSize();
mItemDescLabel->setCaption("");
mItemEffectLabel->setCaption("");
@@ -145,31 +144,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
{
int selectedItem = mShopItemList->getSelected();
- if (eventId == "item")
- {
- // Reset amount of items and update labels
- mAmountItems = 0;
- mSlider->setValue(0);
- mQuantityLabel->setCaption("0");
- mQuantityLabel->adjustSize();
- mMoneyLabel->setCaption("Price : 0 GP / " + toString(mMoney) + " GP");
- mMoneyLabel->adjustSize();
-
- // Disable buttons for buying and decreasing
- mBuyButton->setEnabled(false);
- mDecreaseButton->setEnabled(false);
-
- // If no item was selected, none can be bought, otherwise
- // calculate how many the player can afford
- mMaxItems = (mShopItemList->getSelected() == -1) ? 0 :
- mMoney / mShopItems->at(selectedItem).price;
-
- // When at least one item can be bought, enable the slider and the
- // increase button
- mIncreaseButton->setEnabled(mMaxItems > 0);
- mSlider->setEnabled(mMaxItems > 0);
- }
- else if (eventId == "quit")
+ if (eventId == "quit")
{
setVisible(false);
current_npc = 0;
@@ -253,7 +228,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
mQuantityLabel->adjustSize();
int price = mAmountItems * mShopItems->at(selectedItem).price;
- mMoneyLabel->setCaption("Price : " + toString(price) + " GP / "
+ mMoneyLabel->setCaption("Price: " + toString(price) + " GP / "
+ toString(mMoney) + " GP" );
mMoneyLabel->adjustSize();
}
@@ -261,19 +236,39 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
void BuyDialog::selectionChanged(const SelectionEvent &event)
{
+ // Reset amount of items and update labels
+ mAmountItems = 0;
+ mSlider->setValue(0);
+ mQuantityLabel->setCaption("0");
+ mQuantityLabel->adjustSize();
+ mMoneyLabel->setCaption("Price: 0 GP / " + toString(mMoney) + " GP");
+ mMoneyLabel->adjustSize();
+
+ // Disable buttons for buying and decreasing
+ mBuyButton->setEnabled(false);
+ mDecreaseButton->setEnabled(false);
+
int selectedItem = mShopItemList->getSelected();
if (selectedItem > -1)
{
- const ItemInfo &info =
- ItemDB::get(mShopItems->at(selectedItem).id);
+ const ItemInfo &info = ItemDB::get(mShopItems->at(selectedItem).id);
mItemDescLabel->setCaption("Description: " + info.getDescription());
mItemEffectLabel->setCaption("Effect: " + info.getEffect());
+
+ // Calculate how many the player can afford
+ mMaxItems = mMoney / mShopItems->at(selectedItem).price;
}
else
{
mItemDescLabel->setCaption("Description:");
mItemEffectLabel->setCaption("Effect:");
+ mMaxItems = 0;
}
+
+ // When at least one item can be bought, enable the slider and the
+ // increase button
+ mIncreaseButton->setEnabled(mMaxItems > 0);
+ mSlider->setEnabled(mMaxItems > 0);
}
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp
index 349ca223..862378ae 100644
--- a/src/gui/chargedialog.cpp
+++ b/src/gui/chargedialog.cpp
@@ -37,6 +37,7 @@ ChargeDialog::ChargeDialog():
mProgBar = new ProgressBar(0.0f, 140, 25, 128, 128, 128);
mProgBar->setPosition(20, 40);
add(mProgBar);
+ setVisible(true);
}
// update the dialog
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 14626d06..d4a2c6cb 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -38,9 +38,8 @@ ListBox::ListBox(gcn::ListModel *listModel):
void ListBox::draw(gcn::Graphics *graphics)
{
- if (mListModel == NULL) {
+ if (!mListModel)
return;
- }
graphics->setColor(gcn::Color(110, 160, 255));
graphics->setFont(getFont());
@@ -54,7 +53,9 @@ void ListBox::draw(gcn::Graphics *graphics)
}
// Draw the list elements
- for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += fontHeight)
+ for (int i = 0, y = 0;
+ i < mListModel->getNumberOfElements();
+ ++i, y += fontHeight)
{
graphics->drawText(mListModel->getElementAt(i), 1, y);
}
diff --git a/src/gui/listbox.h b/src/gui/listbox.h
index c1932f54..deca07cf 100644
--- a/src/gui/listbox.h
+++ b/src/gui/listbox.h
@@ -73,9 +73,9 @@ class ListBox : public gcn::ListBox
/**
* Sets the index of the selected element.
*/
- void setSelected(int selected);
+ virtual void setSelected(int selected);
- private:
+ protected:
/**
* Sends out selection events to the list of selection listeners.
*/
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 499bbd05..b0957f9e 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -142,7 +142,8 @@ void SellDialog::addItem(Item *item, int price)
ITEM_SHOP item_shop;
- item_shop.name = item->getInfo().getName() + " " + toString(price) + " GP";
+ item_shop.name = item->getInfo().getName()
+ + " (" + toString(price) + " GP)";
item_shop.price = price;
item_shop.index = item->getInvIndex();
item_shop.id = item->getId();
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 2d33e8a8..3d972bc2 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -45,7 +45,7 @@ void ShopItems::addItem(short id, int price)
ITEM_SHOP item_shop;
item_shop.name = ItemDB::get(id).getName()
- + " " + toString(price) + " GP";
+ + " (" + toString(price) + " GP)";
item_shop.price = price;
item_shop.id = id;
item_shop.image = ItemDB::get(id).getImage();
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 61abff35..4821067c 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -34,11 +34,10 @@
#include "../graphics.h"
-const int ITEM_SPRITE_HEIGHT = 32;
+const int ITEM_ICON_SIZE = 32;
ShopListBox::ShopListBox(gcn::ListModel *listModel):
- gcn::ListBox(listModel),
- mMousePressed(false),
+ ListBox(listModel),
mPlayerMoney(0)
{
mRowHeight = getFont()->getHeight();
@@ -46,105 +45,101 @@ ShopListBox::ShopListBox(gcn::ListModel *listModel):
}
ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel):
- gcn::ListBox(listModel),
- mMousePressed(false),
+ ListBox(listModel),
mPlayerMoney(0),
mShopItems(shopListModel)
{
- mRowHeight = (getFont()->getHeight() > ITEM_SPRITE_HEIGHT ?
- getFont()->getHeight() : ITEM_SPRITE_HEIGHT);
+ mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE);
mPriceCheck = true;
}
-
void ShopListBox::setPlayersMoney(int money)
{
mPlayerMoney = money;
}
-void ShopListBox::draw(gcn::Graphics *graphics)
+void ShopListBox::draw(gcn::Graphics *gcnGraphics)
{
- if (mListModel == NULL) {
+ if (!mListModel)
return;
- }
+
+ Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
graphics->setFont(getFont());
// Draw the list elements
- for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += mRowHeight)
+ for (int i = 0, y = 0;
+ i < mListModel->getNumberOfElements();
+ ++i, y += mRowHeight)
{
- graphics->setColor(gcn::Color(0xffffff));
- if (mShopItems != NULL)
+ gcn::Color backgroundColor = gcn::Color(0xffffff);
+
+ if (i == mSelected)
{
- if(mPlayerMoney < mShopItems->at(i).price && mPriceCheck)
- {
- graphics->setColor(gcn::Color(0x919191));
- }
+ backgroundColor = gcn::Color(110, 160, 255);
}
+ else if (mShopItems &&
+ mPlayerMoney < mShopItems->at(i).price && mPriceCheck)
+ {
+ backgroundColor = gcn::Color(0x919191);
+ }
+
+ graphics->setColor(backgroundColor);
graphics->fillRectangle(gcn::Rectangle(0, y, getWidth(), mRowHeight));
- if (mShopItems)
- dynamic_cast<Graphics*>(graphics)->drawImage(mShopItems->at(i).image, 1, y);
- graphics->drawText(mListModel->getElementAt(i), ITEM_SPRITE_HEIGHT, y);
- }
- // Draw rectangle below the selected list element and the list element
- // not shown.
- if (mSelected >= 0) {
- graphics->setColor(gcn::Color(110, 160, 255));
- graphics->fillRectangle(gcn::Rectangle(0, mRowHeight * mSelected,
- getWidth(), mRowHeight));
if (mShopItems)
- dynamic_cast<Graphics*>(graphics)->drawImage(
- mShopItems->at(mSelected).image, 1, mRowHeight * mSelected);
- graphics->drawText(mListModel->getElementAt(mSelected),
- ITEM_SPRITE_HEIGHT, mRowHeight * mSelected);
+ {
+ Image *icon = mShopItems->at(i).image;
+ if (icon)
+ {
+ graphics->drawImage(icon, 1, y);
+ }
+ }
+ graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5,
+ y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2);
}
}
void ShopListBox::setSelected(int selected)
{
- gcn::ListBox::setSelected(selected);
- if (mListModel != NULL)
+ if (!mListModel)
{
- gcn::BasicContainer *par = getParent();
- if (par == NULL)
- {
- return;
- }
-
- gcn::Rectangle scroll;
+ mSelected = -1;
+ }
+ else
+ {
+ // Update mSelected with bounds checking
+ mSelected = std::min(mListModel->getNumberOfElements() - 1,
+ std::max(-1, selected));
- if (mSelected < 0)
+ gcn::BasicContainer *parent = getParent();
+ if (parent)
{
- scroll.y = 0;
+ gcn::Rectangle scroll;
+ scroll.y = (mSelected < 0) ? 0 : mRowHeight * mSelected;
+ scroll.height = mRowHeight;
+ parent->showWidgetPart(this, scroll);
}
- else
- {
- scroll.y = mRowHeight * mSelected;
- }
-
- scroll.height = mRowHeight;
- par->showWidgetPart(this, scroll);
}
+
fireSelectionChangedEvent();
}
void ShopListBox::mousePress(int x, int y, int button)
{
-
- bool enoughMoney = false;
if (button == gcn::MouseInput::LEFT && hasMouse())
{
- if (mShopItems)
+ bool enoughMoney = false;
+
+ if (mShopItems && mPriceCheck)
{
- if(mPlayerMoney >= mShopItems->at(y / mRowHeight).price)
+ if (mPlayerMoney >= mShopItems->at(y / mRowHeight).price)
enoughMoney = true;
}
else // Old Behaviour
+ {
enoughMoney = true;
-
- if (!mPriceCheck)
- enoughMoney = true;
+ }
if (enoughMoney)
{
@@ -155,40 +150,9 @@ void ShopListBox::mousePress(int x, int y, int button)
}
}
-void ShopListBox::mouseRelease(int x, int y, int button)
-{
- gcn::ListBox::mouseRelease(x, y, button);
-
- mMousePressed = false;
-}
-
-void ShopListBox::mouseMotion(int x, int y)
-{
- gcn::ListBox::mouseMotion(x, y);
-
- // Pretend mouse is pressed continuously while dragged. Causes list
- // selection to be updated as is default in many GUIs.
- if (mMousePressed)
- {
- mousePress(x, y, gcn::MouseInput::LEFT);
- }
-}
-
-void ShopListBox::fireSelectionChangedEvent()
-{
- SelectionEvent event(this);
- SelectionListeners::iterator i_end = mListeners.end();
- SelectionListeners::iterator i;
-
- for (i = mListeners.begin(); i != i_end; ++i)
- {
- (*i)->selectionChanged(event);
- }
-}
-
void ShopListBox::adjustSize()
{
- if (mListModel != NULL)
+ if (mListModel)
{
setHeight(mRowHeight * mListModel->getNumberOfElements());
}
diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h
index 2dff8977..476564b2 100644
--- a/src/gui/shoplistbox.h
+++ b/src/gui/shoplistbox.h
@@ -21,10 +21,10 @@
* $Id: listbox.h 2655 2006-09-03 21:25:02Z b_lindeijer $
*/
-#ifndef _TMW_LISTBOX_H
-#define _TMW_LISTBOX_H
+#ifndef _TMW_SHOPLISTBOX_H
+#define _TMW_SHOPLISTBOX_H
-#include <guichan/widgets/listbox.hpp>
+#include "listbox.h"
#include "shop.h"
class SelectionListener;
@@ -36,7 +36,7 @@ class SelectionListener;
*
* \ingroup GUI
*/
-class ShopListBox : public gcn::ListBox
+class ShopListBox : public ListBox
{
public:
/**
@@ -55,8 +55,6 @@ class ShopListBox : public gcn::ListBox
void draw(gcn::Graphics *graphics);
void mousePress(int x, int y, int button);
- void mouseRelease(int x, int y, int button);
- void mouseMotion(int x, int y);
/**
* Adds a listener to the list that's notified each time a change to
@@ -98,15 +96,6 @@ class ShopListBox : public gcn::ListBox
void setPriceCheck(bool check);
private:
- /**
- * Sends out selection events to the list of selection listeners.
- */
- void fireSelectionChangedEvent();
-
- bool mMousePressed; /**< Keeps track of mouse pressed status. */
-
- std::list<SelectionListener*> mListeners;
-
int mPlayerMoney;
/**
@@ -118,7 +107,6 @@ class ShopListBox : public gcn::ListBox
int mRowHeight; /**< Row Height */
bool mPriceCheck;
-
};
#endif
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 73343483..73e4489e 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -26,6 +26,7 @@
#include <iostream>
#include <SDL.h>
#include <SDL_thread.h>
+#include <zlib.h>
#include <curl/curl.h>
@@ -48,9 +49,9 @@ UpdaterWindow::UpdaterWindow():
Window("Updating..."),
mThread(NULL), mMutex(NULL), mDownloadStatus(UPDATE_NEWS),
mUpdateHost(""), mCurrentFile("news.txt"), mBasePath(""),
- mStoreInMemory(true), mDownloadComplete(true), mUserCancel(false),
- mDownloadedBytes(0), mMemoryBuffer(NULL),
- mCurlError(new char[CURL_ERROR_SIZE]), mFileIndex(0)
+ mStoreInMemory(true), mDownloadComplete(true), mUserCancel(false),
+ mDownloadedBytes(0), mMemoryBuffer(NULL),
+ mCurlError(new char[CURL_ERROR_SIZE]), mLineIndex(0)
{
mCurlError[0] = 0;
@@ -83,8 +84,9 @@ UpdaterWindow::UpdaterWindow():
add(mCancelButton);
add(mPlayButton);
- mCancelButton->requestFocus();
setLocationRelativeTo(getParent());
+ setVisible(true);
+ mCancelButton->requestFocus();
mUpdateHost =
config.getValue("updatehost", "http://updates.themanaworld.org");
@@ -179,7 +181,6 @@ void UpdaterWindow::loadNews()
mMemoryBuffer = NULL;
mScrollArea->setVerticalScrollAmount(0);
- setVisible(true);
}
int UpdaterWindow::updateProgress(void *ptr,
@@ -227,78 +228,116 @@ size_t UpdaterWindow::memoryWrite(void *ptr,
int UpdaterWindow::downloadThread(void *ptr)
{
+ int attempts = 0;
+ UpdaterWindow *uw = reinterpret_cast<UpdaterWindow *>(ptr);
CURL *curl;
CURLcode res;
- FILE *outfile = NULL;
- UpdaterWindow *uw = reinterpret_cast<UpdaterWindow *>(ptr);
std::string outFilename;
std::string url(uw->mUpdateHost + "/" + uw->mCurrentFile);
- uw->setLabel(uw->mCurrentFile + " (0%)");
- curl = curl_easy_init();
+ while (attempts < 3 && !uw->mDownloadComplete) {
+ FILE *outfile = NULL;
+ uw->setLabel(uw->mCurrentFile + " (0%)");
- if (curl)
- {
- logger->log("Downloading: %s", url.c_str());
+ curl = curl_easy_init();
- if (uw->mStoreInMemory)
+ if (curl)
{
- uw->mDownloadedBytes = 0;
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
- UpdaterWindow::memoryWrite);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, ptr);
- }
- else
- {
- // Download in the proper folder : ./updates under win,
- // /home/user/.tmw/updates for unices
- outFilename = uw->mBasePath + "/updates/download.temp";
- outfile = fopen(outFilename.c_str(), "wb");
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
- }
+ logger->log("Downloading: %s", url.c_str());
- curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, uw->mCurlError);
- curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
- curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
- UpdaterWindow::updateProgress);
- curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, ptr);
- curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
- curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15);
+ if (uw->mStoreInMemory)
+ {
+ uw->mDownloadedBytes = 0;
+ curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
+ UpdaterWindow::memoryWrite);
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, ptr);
+ }
+ else
+ {
+ // Download in the proper folder : ./updates under win,
+ // /home/user/.tmw/updates for unices
+ outFilename = uw->mBasePath + "/updates/download.temp";
+ outfile = fopen(outFilename.c_str(), "w+b");
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
+ }
- if ((res = curl_easy_perform(curl)) != 0)
- {
- uw->mDownloadStatus = UPDATE_ERROR;
- switch (res)
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, uw->mCurlError);
+ curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
+ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+ curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
+ UpdaterWindow::updateProgress);
+ curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, ptr);
+ curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15);
+
+ if ((res = curl_easy_perform(curl)) != 0)
{
- case CURLE_COULDNT_CONNECT: // give more debug info on that error
- std::cerr << "curl error " << res << " : " << uw->mCurlError << " " << url.c_str()
- << std::endl;
- break;
-
- default:
- std::cerr << "curl error " << res << " : " << uw->mCurlError << " host: " << url.c_str()
- << std::endl;
+ uw->mDownloadStatus = UPDATE_ERROR;
+ switch (res)
+ {
+ case CURLE_COULDNT_CONNECT: // give more debug info on that error
+ std::cerr << "curl error " << res << " : " << uw->mCurlError << " " << url.c_str()
+ << std::endl;
+ break;
+
+ default:
+ std::cerr << "curl error " << res << " : " << uw->mCurlError << " host: " << url.c_str()
+ << std::endl;
+ }
}
- }
- curl_easy_cleanup(curl);
- uw->mDownloadComplete = true;
+ curl_easy_cleanup(curl);
- if (!uw->mStoreInMemory)
- {
- fclose(outfile);
+ uw->mDownloadComplete = true;
- // Give the file the proper name
- std::string newName(uw->mBasePath + "/updates/" +
- uw->mCurrentFile.c_str());
+ if (!uw->mStoreInMemory)
+ {
+ long fileSize;
+ char *buffer;
+ // Obtain file size.
+ fseek(outfile, 0, SEEK_END);
+ fileSize = ftell(outfile);
+ rewind(outfile);
+ buffer = (char*)malloc(fileSize);
+ fread(buffer, 1, fileSize, outfile);
+ fclose(outfile);
+
+ // Give the file the proper name
+ std::string newName(uw->mBasePath + "/updates/" +
+ uw->mCurrentFile.c_str());
+
+ // Any existing file with this name is deleted first, otherwise the
+ // rename will fail on Windows.
+ ::remove(newName.c_str());
+ ::rename(outFilename.c_str(), newName.c_str());
+
+ // Don't check resources2.txt checksum
+ if (uw->mDownloadStatus == UPDATE_RESOURCES)
+ {
+ // Calculate Adler-32 checksum
+ unsigned long adler = adler32(0L, Z_NULL, 0);
+ adler = adler32(adler, (Bytef *)buffer, fileSize);
+ free(buffer);
+
+ if (uw->mCurrentChecksum != adler) {
+ uw->mDownloadComplete = false;
+ // Remove the corrupted file
+ ::remove(newName.c_str());
+ logger->log(
+ "Checksum for file %s failed: (%lx/%lx)",
+ uw->mCurrentFile.c_str(),
+ adler, uw->mCurrentChecksum);
+ }
+ }
- // Any existing file with this name is deleted first, otherwise the
- // rename will fail on Windows.
- ::remove(newName.c_str());
- ::rename(outFilename.c_str(), newName.c_str());
+ }
}
+ attempts++;
+ }
+
+ if (!uw->mDownloadComplete) {
+ uw->mDownloadStatus = UPDATE_ERROR;
}
return 0;
@@ -351,7 +390,7 @@ void UpdaterWindow::logic()
// Parse current memory buffer as news and dispose of the data
loadNews();
- mCurrentFile = "resources.txt";
+ mCurrentFile = "resources2.txt";
mStoreInMemory = false;
download();
mDownloadStatus = UPDATE_LIST;
@@ -361,7 +400,7 @@ void UpdaterWindow::logic()
if (mDownloadComplete)
{
ResourceManager *resman = ResourceManager::getInstance();
- mFiles = resman->loadTextFile("updates/resources.txt");
+ mLines = resman->loadTextFile("updates/resources2.txt");
mStoreInMemory = false;
mDownloadStatus = UPDATE_RESOURCES;
}
@@ -375,9 +414,15 @@ void UpdaterWindow::logic()
mThread = NULL;
}
- if (mFileIndex < mFiles.size())
+ if (mLineIndex < mLines.size())
{
- mCurrentFile = mFiles[mFileIndex];
+ std::stringstream line(mLines[mLineIndex]);
+ line >> mCurrentFile;
+ std::string checksum;
+ line >> checksum;
+ std::stringstream ss(checksum);
+ ss >> std::hex >> mCurrentChecksum;
+
std::ifstream temp(
(mBasePath + "/updates/" + mCurrentFile).c_str());
if (!temp.is_open())
@@ -389,7 +434,7 @@ void UpdaterWindow::logic()
{
logger->log("%s already here", mCurrentFile.c_str());
}
- mFileIndex++;
+ mLineIndex++;
}
else
{
diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h
index 16442656..0d1493ee 100644
--- a/src/gui/updatewindow.h
+++ b/src/gui/updatewindow.h
@@ -141,6 +141,11 @@ class UpdaterWindow : public Window, public gcn::ActionListener
std::string mCurrentFile;
/**
+ * The Adler32 checksum of the file currently downloading.
+ */
+ unsigned long mCurrentChecksum;
+
+ /**
* Absolute path to locally save downloaded files.
*/
std::string mBasePath;
@@ -179,12 +184,12 @@ class UpdaterWindow : public Window, public gcn::ActionListener
/**
* List of files to download
*/
- std::vector<std::string> mFiles;
+ std::vector<std::string> mLines;
/**
* Index of the file to be downloaded
*/
- unsigned int mFileIndex;
+ unsigned int mLineIndex;
gcn::Label *mLabel; /**< Progress bar caption. */
Button *mCancelButton; /**< Button to stop the update process. */
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 3346c07a..75a16865 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -197,8 +197,8 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
}
// Draw target marker if needed
- Being *target;
- if ((target = player_node->getTarget()))
+ Being *target = player_node->getTarget();
+ if (target)
{
graphics->setFont(speechFont);
graphics->setColor(gcn::Color(255, 32, 32));
diff --git a/src/guichanfwd.h b/src/guichanfwd.h
index 5eabc783..812f3f7a 100644
--- a/src/guichanfwd.h
+++ b/src/guichanfwd.h
@@ -27,6 +27,7 @@
namespace gcn {
class ActionListener;
class AllegroGraphics;
+ class AllegroImage;
class AllegroImageLoader;
class AllegroInput;
class BasicContainer;
@@ -56,11 +57,13 @@ namespace gcn {
class MouseInput;
class MouseListener;
class OpenGLGraphics;
- class OpenGLImageLoader;
+ class OpenGLImage;
+ class OpenGLSDLImageLoader;
class RadioButton;
class Rectangle;
class ScrollArea;
class SDLGraphics;
+ class SDLImage;
class SDLImageLoader;
class SDLInput;
class Slider;
diff --git a/src/inventory.h b/src/inventory.h
index 40bcafbb..32ae393e 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -31,7 +31,14 @@ class Item;
class Inventory
{
public:
+ /**
+ * Constructor.
+ */
Inventory();
+
+ /**
+ * Destructor.
+ */
~Inventory();
/**
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index ba7b6117..8076c538 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -166,11 +166,6 @@ void LocalPlayer::pickUp(FloorItem *item)
void LocalPlayer::walk(unsigned char dir)
{
- if (mWalkingDir != dir)
- {
- mWalkingDir = dir;
- }
-
if (!mMap || !dir)
return;
@@ -237,6 +232,20 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y)
Being::setDestination(x, y);
}
+void LocalPlayer::setWalkingDir(int dir)
+{
+ if (mWalkingDir != dir)
+ {
+ mWalkingDir = dir;
+ }
+
+ // If we're not already walking, start walking.
+ if (mAction != WALK && dir)
+ {
+ walk(dir);
+ }
+}
+
void LocalPlayer::raiseAttribute(Attribute attr)
{
// XXX Convert for new server
diff --git a/src/localplayer.h b/src/localplayer.h
index 59b59812..765b7cca 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -42,9 +42,15 @@ class LocalPlayer : public Player
STR = 0, AGI, VIT, INT, DEX, LUK
};
+ /**
+ * Constructor.
+ */
LocalPlayer();
- virtual ~LocalPlayer();
+ /**
+ * Destructor.
+ */
+ ~LocalPlayer();
virtual void logic();
@@ -111,13 +117,16 @@ class LocalPlayer : public Player
*/
void setTarget(Being* target) { mTarget = target; }
- void walk(unsigned char dir);
-
/**
* Sets a new destination for this being to walk to.
*/
void setDestination(Uint16 x, Uint16 y);
+ /**
+ * Sets a new direction to keep walking in.
+ */
+ void setWalkingDir(int dir);
+
void raiseAttribute(Attribute attr);
void raiseSkill(Uint16 skillId);
@@ -151,6 +160,8 @@ class LocalPlayer : public Player
std::auto_ptr<Inventory> mInventory;
protected:
+ void walk(unsigned char dir);
+
Being *mTarget;
FloorItem *mPickUpTarget;
diff --git a/src/main.cpp b/src/main.cpp
index 90368b7d..8163cde3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -309,11 +309,6 @@ void init_engine()
errorMessage = err;
logger->log("Warning: %s", err);
}
-
- // Load XML databases
- EquipmentDB::load();
- ItemDB::load();
- MonsterDB::load();
}
/** Clear the engine */
@@ -411,19 +406,22 @@ void parseOptions(int argc, char *argv[], Options &options)
}
/**
- * Reads the file "updates/resources.txt" and attempts to load each update
+ * Reads the file "updates/resources2.txt" and attempts to load each update
* mentioned in it.
*/
void loadUpdates()
{
- const std::string updatesFile = "updates/resources.txt";
+ const std::string updatesFile = "updates/resources2.txt";
ResourceManager *resman = ResourceManager::getInstance();
std::vector<std::string> lines = resman->loadTextFile(updatesFile);
std::string homeDir = config.getValue("homeDir", "");
for (unsigned int i = 0; i < lines.size(); ++i)
{
- resman->addToSearchPath(homeDir + "/updates/" + lines[i], false);
+ std::stringstream line(lines[i]);
+ std::string filename;
+ line >> filename;
+ resman->addToSearchPath(homeDir + "/updates/" + filename, false);
}
}
@@ -687,6 +685,12 @@ int main(int argc, char *argv[])
case STATE_LOGIN:
logger->log("State: LOGIN");
+
+ // Load XML databases
+ EquipmentDB::load();
+ ItemDB::load();
+ MonsterDB::load();
+
currentDialog = new LoginDialog(&loginData);
// TODO: Restore autologin
//if (!loginData.password.empty()) {
diff --git a/src/main.h b/src/main.h
index b68a4e4d..14f52e4d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -29,8 +29,7 @@
#ifdef HAVE_CONFIG_H
#include "../config.h"
#elif defined WIN32
-#include "../The_Mana_World_private.h"
-#define PACKAGE_VERSION PRODUCT_VERSION
+#include "winver.h"
#endif
#ifndef TMW_DATADIR
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 988a9a68..f16037cf 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -31,14 +31,24 @@
#include "../log.h"
#include "../npc.h"
+#include "../gui/buy.h"
#include "../gui/chat.h"
+#include "../gui/npclistdialog.h"
+#include "../gui/npc_text.h"
#include "../gui/ok_dialog.h"
+#include "../gui/sell.h"
#include "../gui/skill.h"
// TODO Move somewhere else
OkDialog *weightNotice = NULL;
OkDialog *deathNotice = NULL;
+extern NpcListDialog *npcListDialog;
+extern NpcTextDialog *npcTextDialog;
+extern BuyDialog *buyDialog;
+extern SellDialog *sellDialog;
+extern Window *buySellDialog;
+
/**
* Listener used for handling the overweigth message.
*/
@@ -64,6 +74,12 @@ namespace {
{
player_node->revive();
deathNotice = NULL;
+ npcListDialog->setVisible(false);
+ npcTextDialog->setVisible(false);
+ buyDialog->setVisible(false);
+ sellDialog->setVisible(false);
+ buySellDialog->setVisible(false);
+ current_npc = 0;
}
} deathListener;
}
diff --git a/src/npc.cpp b/src/npc.cpp
index 3c142889..ccd085b6 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -29,7 +29,6 @@
#include "gui/gui.h"
class Spriteset;
-extern Spriteset *npcset;
NPC *current_npc = 0;
diff --git a/src/action.cpp b/src/resources/action.cpp
index 148ea105..247455db 100644
--- a/src/action.cpp
+++ b/src/resources/action.cpp
@@ -26,7 +26,8 @@
#include <algorithm>
#include "animation.h"
-#include "utils/dtor.h"
+
+#include "../utils/dtor.h"
Action::Action()
diff --git a/src/action.h b/src/resources/action.h
index 8d5e8d11..8d5e8d11 100644
--- a/src/action.h
+++ b/src/resources/action.h
diff --git a/src/animation.cpp b/src/resources/animation.cpp
index 67fdae11..de96525c 100644
--- a/src/animation.cpp
+++ b/src/resources/animation.cpp
@@ -25,7 +25,7 @@
#include <algorithm>
-#include "utils/dtor.h"
+#include "../utils/dtor.h"
Animation::Animation():
mDuration(0)
@@ -33,23 +33,21 @@ Animation::Animation():
}
void
-Animation::addPhase(Image *image, unsigned int delay, int offsetX, int offsetY)
+Animation::addFrame(Image *image, unsigned int delay, int offsetX, int offsetY)
{
- // Add new phase to animation list
- AnimationPhase newPhase = { image, delay, offsetX, offsetY };
-
- mAnimationPhases.push_back(newPhase);
+ Frame frame = { image, delay, offsetX, offsetY };
+ mFrames.push_back(frame);
mDuration += delay;
}
void
Animation::addTerminator()
{
- addPhase(NULL, 0, 0, 0);
+ addFrame(NULL, 0, 0, 0);
}
bool
-Animation::isTerminator(const AnimationPhase candidate)
+Animation::isTerminator(const Frame &candidate)
{
return (candidate.image == NULL);
}
diff --git a/src/animation.h b/src/resources/animation.h
index 85e950d7..54142bcb 100644
--- a/src/animation.h
+++ b/src/resources/animation.h
@@ -33,10 +33,8 @@ class Spriteset;
/**
* A single frame in an animation, with a delay and an offset.
- *
- * TODO: Rename this struct to Frame
*/
-struct AnimationPhase
+struct Frame
{
Image *image;
unsigned int delay;
@@ -60,7 +58,7 @@ class Animation
* Appends a new animation at the end of the sequence
*/
void
- addPhase(Image *image, unsigned int delay, int offsetX, int offsetY);
+ addFrame(Image *image, unsigned int delay, int offsetX, int offsetY);
/**
* Appends an animation terminator that states that the animation
@@ -72,14 +70,14 @@ class Animation
/**
* Returns the frame at the specified index.
*/
- AnimationPhase*
- getFrame(int index) { return &(mAnimationPhases[index]); }
+ Frame*
+ getFrame(int index) { return &(mFrames[index]); }
/**
* Returns the length of this animation in frames.
*/
unsigned int
- getLength() const { return mAnimationPhases.size(); }
+ getLength() const { return mFrames.size(); }
/**
* Returns the duration of this animation.
@@ -91,10 +89,10 @@ class Animation
* Determines whether the given animation frame is a terminator.
*/
static bool
- isTerminator(const AnimationPhase phase);
+ isTerminator(const Frame &phase);
protected:
- std::vector<AnimationPhase> mAnimationPhases;
+ std::vector<Frame> mFrames;
int mDuration;
};
diff --git a/src/resources/equipmentdb.cpp b/src/resources/equipmentdb.cpp
index 78ae3b6a..52a9fbd3 100644
--- a/src/resources/equipmentdb.cpp
+++ b/src/resources/equipmentdb.cpp
@@ -40,6 +40,9 @@ namespace
void
EquipmentDB::load()
{
+ if (mLoaded)
+ return;
+
logger->log("Initializing equipment database...");
mUnknown.setSprite("error.xml", 0);
mUnknown.setSprite("error.xml", 1);
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 48818f6f..9398e06b 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -153,10 +153,10 @@ Image* Image::load(void *buffer, unsigned int bufferSize,
SDL_FreeSurface(image);
if (hasPink && !hasAlpha) {
- SDL_SetColorKey(tmpImage, SDL_SRCCOLORKEY | SDL_RLEACCEL,
+ SDL_SetColorKey(tmpImage, SDL_SRCCOLORKEY,
SDL_MapRGB(tmpImage->format, 255, 0, 255));
} else if (hasAlpha) {
- SDL_SetAlpha(tmpImage, SDL_SRCALPHA | SDL_RLEACCEL, SDL_ALPHA_OPAQUE);
+ SDL_SetAlpha(tmpImage, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
}
#ifdef USE_OPENGL
@@ -305,7 +305,7 @@ void Image::setAlpha(float a)
if (mImage) {
// Set the alpha value this image is drawn at
- SDL_SetAlpha(mImage, SDL_SRCALPHA | SDL_RLEACCEL, (int)(255 * mAlpha));
+ SDL_SetAlpha(mImage, SDL_SRCALPHA, (int) (255 * mAlpha));
}
}
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index b91e34cc..f914af47 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -37,11 +37,15 @@ namespace
{
ItemDB::ItemInfos mItemInfos;
ItemInfo mUnknown;
+ bool mLoaded = false;
}
void ItemDB::load()
{
+ if (mLoaded)
+ return;
+
logger->log("Initializing item database...");
mUnknown.setName("Unknown item");
@@ -150,6 +154,8 @@ void ItemDB::load()
}
xmlFreeDoc(doc);
+
+ mLoaded = true;
}
void ItemDB::unload()
@@ -159,6 +165,8 @@ void ItemDB::unload()
delete i->second;
}
mItemInfos.clear();
+
+ mLoaded = false;
}
const ItemInfo&
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index 5922984a..c080194b 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -29,17 +29,17 @@
#include <map>
/**
- * The namespace that holds the item information
+ * The namespace that holds the item information.
*/
namespace ItemDB
{
/**
- * Loads the item data from Items.xml
+ * Loads the item data from <code>items.xml</code>.
*/
void load();
/**
- * Frees item data
+ * Frees item data.
*/
void unload();
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 4569ced7..15a88b4d 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -30,11 +30,11 @@
#include "resourcemanager.h"
#include "image.h"
-#include "../base64.h"
#include "../log.h"
#include "../map.h"
#include "../tileset.h"
+#include "../utils/base64.h"
#include "../utils/tostring.h"
#include "../utils/xml.h"
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index fb03f6c1..e4406f9c 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -34,11 +34,15 @@ namespace
{
MonsterDB::MonsterInfos mMonsterInfos;
MonsterInfo mUnknown;
+ bool mLoaded = false;
}
void
MonsterDB::load()
{
+ if (mLoaded)
+ return;
+
mUnknown.setSprite("error.xml");
mUnknown.setName("unnamed");
@@ -123,6 +127,8 @@ MonsterDB::load()
}
mMonsterInfos[XML::getProperty(monsterNode, "id", 0)] = currentInfo;
}
+
+ mLoaded = true;
}
void
@@ -131,6 +137,8 @@ MonsterDB::unload()
for_each ( mMonsterInfos.begin(), mMonsterInfos.end(),
make_dtor(mMonsterInfos));
mMonsterInfos.clear();
+
+ mLoaded = false;
}
diff --git a/src/resources/openglsdlimageloader.cpp b/src/resources/openglsdlimageloader.cpp
index b3e1601e..68de1e19 100644
--- a/src/resources/openglsdlimageloader.cpp
+++ b/src/resources/openglsdlimageloader.cpp
@@ -31,7 +31,8 @@
#ifdef USE_OPENGL
-SDL_Surface* OpenGLSDLImageLoader::loadSDLSurface(const std::string& filename)
+SDL_Surface*
+OpenGLSDLImageLoader::loadSDLSurface(const std::string &filename)
{
ResourceManager *resman = ResourceManager::getInstance();
return resman->loadSDLSurface(filename);
diff --git a/src/resources/openglsdlimageloader.h b/src/resources/openglsdlimageloader.h
index 29be294c..b79dde15 100644
--- a/src/resources/openglsdlimageloader.h
+++ b/src/resources/openglsdlimageloader.h
@@ -31,7 +31,8 @@
class OpenGLSDLImageLoader : public gcn::OpenGLSDLImageLoader
{
protected:
- SDL_Surface* loadSDLSurface(const std::string& filename);
+ SDL_Surface*
+ loadSDLSurface(const std::string &filename);
};
#endif
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index bd273b3b..feb6f8f8 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -23,11 +23,10 @@
#include "spritedef.h"
-#include "../animation.h"
-#include "../action.h"
-#include "../graphics.h"
#include "../log.h"
+#include "animation.h"
+#include "action.h"
#include "resourcemanager.h"
#include "spriteset.h"
#include "image.h"
@@ -208,20 +207,20 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
Animation *animation = new Animation();
action->setAnimation(directionType, animation);
- // Get animation phases
- for (xmlNodePtr phaseNode = animationNode->xmlChildrenNode;
- phaseNode != NULL;
- phaseNode = phaseNode->next)
+ // Get animation frames
+ for (xmlNodePtr frameNode = animationNode->xmlChildrenNode;
+ frameNode != NULL;
+ frameNode = frameNode->next)
{
- int delay = XML::getProperty(phaseNode, "delay", 0);
- int offsetX = XML::getProperty(phaseNode, "offsetX", 0);
- int offsetY = XML::getProperty(phaseNode, "offsetY", 0);
+ 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(phaseNode->name, BAD_CAST "frame"))
+ if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{
- int index = XML::getProperty(phaseNode, "index", -1);
+ int index = XML::getProperty(frameNode, "index", -1);
if (index < 0)
{
@@ -237,12 +236,12 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
continue;
}
- animation->addPhase(img, delay, offsetX, offsetY);
+ animation->addFrame(img, delay, offsetX, offsetY);
}
- else if (xmlStrEqual(phaseNode->name, BAD_CAST "sequence"))
+ else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
{
- int start = XML::getProperty(phaseNode, "start", -1);
- int end = XML::getProperty(phaseNode, "end", -1);
+ int start = XML::getProperty(frameNode, "start", -1);
+ int end = XML::getProperty(frameNode, "end", -1);
if (start < 0 || end < 0)
{
@@ -261,15 +260,15 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
continue;
}
- animation->addPhase(img, delay, offsetX, offsetY);
+ animation->addFrame(img, delay, offsetX, offsetY);
start++;
}
}
- else if (xmlStrEqual(phaseNode->name, BAD_CAST "end"))
+ else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
{
animation->addTerminator();
}
- } // for phaseNode
+ } // for frameNode
}
void
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 64414259..057129ad 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -32,10 +32,7 @@
#include <libxml/tree.h>
class Action;
-class Graphics;
class Spriteset;
-struct AnimationPhase;
-class Animation;
enum SpriteAction
{
diff --git a/src/resources/spriteset.cpp b/src/resources/spriteset.cpp
index 9b09f1e5..96bcef0c 100644
--- a/src/resources/spriteset.cpp
+++ b/src/resources/spriteset.cpp
@@ -53,7 +53,7 @@ Spriteset::~Spriteset()
Image*
Spriteset::get(size_type i)
{
- if (i > mSpriteset.size())
+ if (i >= mSpriteset.size())
{
logger->log("Warning: Sprite #%i does not exist in this spriteset", i);
return NULL;
diff --git a/src/tmw.rc b/src/tmw.rc
index 5a3b1649..ee5f99cd 100644
--- a/src/tmw.rc
+++ b/src/tmw.rc
@@ -1,34 +1,23 @@
#include <windows.h> // include for version info constants
+#include "winver.h"
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "data/icons/tmw-icon.ico"
-//
-// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS...
-//
1 VERSIONINFO
-FILEVERSION 0,1,0,0
-PRODUCTVERSION 0,1,0,0
-FILETYPE VFT_APP
-{
- BLOCK "StringFileInfo"
- {
- BLOCK "040904E4"
- {
- VALUE "CompanyName", "The Mana World Development Team"
- VALUE "FileVersion", "0.1.0"
- VALUE "FileDescription", "The Mana World"
- VALUE "InternalName", "tmw.exe"
- VALUE "LegalCopyright", "2004-2006 (C)"
- VALUE "LegalTrademarks", ""
- VALUE "OriginalFilename", "tmw.exe"
- VALUE "ProductName", "The Mana World MMORPG"
- VALUE "ProductVersion", "0.1.0"
- }
- }
- BLOCK "VarFileInfo"
- {
- VALUE "Translation", 0x0409, 1252
- }
+FILEVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
+PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
+FILETYPE VFT_APP {
+ BLOCK "StringFileInfo" {
+ BLOCK "040904E4" {
+ VALUE "CompanyName", "The Mana World Development Team"
+ VALUE "FileVersion", PACKAGE_VERSION
+ VALUE "FileDescription", "The Mana World"
+ VALUE "LegalCopyright", "2004-2006 (C)"
+ VALUE "OriginalFilename", "tmw.exe"
+ VALUE "ProductName", "The Mana World MMORPG"
+ VALUE "ProductVersion", PACKAGE_VERSION
+ }
+ }
}
diff --git a/src/base64.cpp b/src/utils/base64.cpp
index 9a8f6356..9a8f6356 100644
--- a/src/base64.cpp
+++ b/src/utils/base64.cpp
diff --git a/src/base64.h b/src/utils/base64.h
index ff20ac53..ff20ac53 100644
--- a/src/base64.h
+++ b/src/utils/base64.h
diff --git a/src/utils/wingettimeofday.h b/src/utils/wingettimeofday.h
index 0f8b767a..a5537f39 100644
--- a/src/utils/wingettimeofday.h
+++ b/src/utils/wingettimeofday.h
@@ -1,5 +1,5 @@
/*
- * The Mana World Server
+ * The Mana World
* Copyright 2004 The Mana World Development Team
*
* This file is part of The Mana World.
@@ -17,10 +17,12 @@
* You should have received a copy of the GNU General Public License
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
*/
-#ifndef _TMWSERV_WINGETTIMEOFDAY_H_
-#define _TMWSERV_WINGETTIMEOFDAY_H_
+#ifndef _TMW_WINGETTIMEOFDAY_H_
+#define _TMW_WINGETTIMEOFDAY_H_
#ifdef WIN32
diff --git a/src/winver.h b/src/winver.h
new file mode 100644
index 00000000..58f11bea
--- /dev/null
+++ b/src/winver.h
@@ -0,0 +1,6 @@
+/* VERSION DEFINITIONS */
+#define VER_MAJOR 0
+#define VER_MINOR 1
+#define VER_RELEASE 0
+#define VER_BUILD 0
+#define PACKAGE_VERSION "0.1.0"
diff --git a/tmw.cbp b/tmw.cbp
index d36a8bd0..c81ffb3e 100644
--- a/tmw.cbp
+++ b/tmw.cbp
@@ -40,16 +40,6 @@
</Linker>
</Target>
</Build>
- <Unit filename="src\action.cpp">
- <Option compilerVar="CPP"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\action.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
- </Unit>
<Unit filename="src\animatedsprite.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
@@ -60,26 +50,6 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
- <Unit filename="src\animation.cpp">
- <Option compilerVar="CPP"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\animation.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\base64.cpp">
- <Option compilerVar="CPP"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\base64.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
- </Unit>
<Unit filename="src\being.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
@@ -172,12 +142,6 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
- <Unit filename="src\graphic\imagerect.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
- </Unit>
<Unit filename="src\graphics.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
@@ -1210,6 +1174,16 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
+ <Unit filename="src\resources\action.cpp">
+ <Option compilerVar="CPP"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="src\resources\action.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
<Unit filename="src\resources\ambientoverlay.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
@@ -1220,6 +1194,16 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
+ <Unit filename="src\resources\animation.cpp">
+ <Option compilerVar="CPP"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="src\resources\animation.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
<Unit filename="src\resources\buddylist.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
@@ -1429,6 +1413,16 @@
<Option objectName="src\tmw.res"/>
<Option target="default"/>
</Unit>
+ <Unit filename="src\utils\base64.cpp">
+ <Option compilerVar="CPP"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="src\utils\base64.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
<Unit filename="src\utils\dtor.h">
<Option compilerVar=""/>
<Option compile="0"/>
@@ -1451,5 +1445,11 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
+ <Unit filename="src\winver.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
</Project>
</CodeBlocks_project_file>