summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-03-18 22:16:51 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-03-18 22:16:51 +0000
commit1db1974435a6c9dff4908fefb6fe4fd093fc431f (patch)
treeeffef986bbdfcf800c829647b19c81e6798c6763
parent1f1a5efaef0a10187592d29ea7b19e140e7a0196 (diff)
downloadmana-1db1974435a6c9dff4908fefb6fe4fd093fc431f.tar.gz
mana-1db1974435a6c9dff4908fefb6fe4fd093fc431f.tar.bz2
mana-1db1974435a6c9dff4908fefb6fe4fd093fc431f.tar.xz
mana-1db1974435a6c9dff4908fefb6fe4fd093fc431f.zip
Added man page by Patrick Matthäi and restored alpha layer check.
-rw-r--r--ChangeLog9
-rw-r--r--docs/Makefile.am2
-rw-r--r--docs/tmw.674
-rw-r--r--src/resources/image.cpp33
4 files changed, 114 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b0a1390..b5cf0e81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2007-03-18 Rogier Polak <rogier.l.a.polak@gmail.com>
+2007-03-18 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * 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.
+
+2007-03-18 Rogier Polak <rogier.l.a.polak@gmail.com>
* src/main.cpp: Added (-v) version to the arguments. (Applied a patch
by Patrick Matthäi).
diff --git a/docs/Makefile.am b/docs/Makefile.am
index e106768b..8b57d5bb 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1,3 +1,5 @@
+man6_MANS = tmw.6
+
EXTRA_DIST = packages.txt \
FAQ.txt \
HACKING.txt \
diff --git a/docs/tmw.6 b/docs/tmw.6
new file mode 100644
index 00000000..0dee82c7
--- /dev/null
+++ b/docs/tmw.6
@@ -0,0 +1,74 @@
+.TH "TMW" "6"
+.SH "NAME"
+tmw \- tmw is The Mana World: A fantasy online game
+.SH "SYNOPSIS"
+\fBtmw\fR
+.SH "DESCRIPTION"
+This manual page documents briefly the
+\fBtmw\fR ingame
+commands.
+\fBtmw\fR is a great online game based upon the Seiken Densetsu Serie.
+It has its own universe, and and its own character management system, which will
+give you the opportunity to play in a 2D heroic-fantasy world forever.
+.SH "BINARY PARAMETERS"
+This program follows the usual GNU command line syntax, with long
+options starting with two dashes (`-').
+A summary of options is included below.
+.TP
+.B \-h, \-\-help
+Show summary of options.
+.TP
+.B \-v, \-\-version
+Show version of the program.
+.TP
+.B \-u, \-\-skipupdate
+Skip the update process.
+.TP
+.B \-U, \-\-username
+Login with this username.
+.TP
+.B \-P, \-\-password
+Login with this password.
+.TP
+.B \-D, \-\-default
+Bypass the login process with default settings.
+.TP
+.B \-p, \-\-playername
+Login with this player.
+.TP
+.B \-C, \-\-configfile
+Configuration file to use
+.SH "COMMON KEYS"
+.TP
+.B Arrow Keys:
+Move your character around.
+.TP
+.B Left Ctrl:
+Make your character attack.
+.TP
+.B Key A:
+Target nearest monster.
+.TP
+.B Key G:
+Get items on the ground or in a chest.
+.TP
+.B Alt + 1...9:
+Shows an emoticon above your character.
+.TP
+.B Alt + I:
+Shows / Hide inventory window.
+.TP
+.B Alt + K:
+Shows / Hide skills window.
+.TP
+.B Alt + E:
+Shows / Hide equipment window.
+.TP
+.B Alt + C:
+Shows configuration window.
+.SH "AUTHOR"
+This manual page was written by Patrick Matth\[:a]i <patrick.matthaei@web.de>
+for The Mana World project.
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU General Public License, Version 2 any
+later version published by the Free Software Foundation.
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index fed26851..a7c81574 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -99,6 +99,28 @@ Image* Image::load(void *buffer, unsigned int bufferSize,
amask = 0xff000000;
#endif
+ bool hasAlpha = false;
+
+ // Figure out whether the image uses its alpha layer
+ for (int i = 0; i < tmpImage->w * tmpImage->h; ++i)
+ {
+ Uint8 r, g, b, a;
+ SDL_GetRGBA(
+ ((Uint32*) tmpImage->pixels)[i],
+ tmpImage->format,
+ &r, &g, &b, &a);
+
+ if (a != 255)
+ {
+ hasAlpha = true;
+ break;
+ }
+ }
+
+ if (hasAlpha) {
+ SDL_SetAlpha(tmpImage, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
+ }
+
#ifdef USE_OPENGL
if (mUseOpenGL)
{
@@ -186,10 +208,15 @@ Image* Image::load(void *buffer, unsigned int bufferSize,
}
#endif
- SDL_SetAlpha(tmpImage, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
-
- SDL_Surface *image = SDL_DisplayFormatAlpha(tmpImage);
+ SDL_Surface *image;
+ // Convert the surface to the current display format
+ if (hasAlpha) {
+ image = SDL_DisplayFormatAlpha(tmpImage);
+ }
+ else {
+ image = SDL_DisplayFormat(tmpImage);
+ }
SDL_FreeSurface(tmpImage);
if (image == NULL) {