summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-27 22:17:21 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-27 22:17:21 +0300
commitcd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc (patch)
tree6e09b953731887801b35f61056c2c87991e05590 /src
parentc905067448700c63f7645b08d80bffbde57a45fa (diff)
downloadManaVerse-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.tar.gz
ManaVerse-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.tar.bz2
ManaVerse-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.tar.xz
ManaVerse-cd0b35a6c1a86e4432d9dc9ec75b4da0ae9a7bdc.zip
Add command to dump to chat main graphics settings.
Command: /dumpg
Diffstat (limited to 'src')
-rw-r--r--src/commandhandler.cpp57
-rw-r--r--src/commandhandler.h5
-rw-r--r--src/graphics.cpp4
-rw-r--r--src/graphics.h16
-rw-r--r--src/gui/chatwindow.cpp1
-rw-r--r--src/opengl1graphics.cpp1
-rw-r--r--src/openglgraphics.cpp1
-rw-r--r--src/resources/image.h3
8 files changed, 85 insertions, 3 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 7a4773d81..cac12b8ec 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -26,6 +26,7 @@
#include "actorspritemanager.h"
#include "channelmanager.h"
#include "channel.h"
+#include "configuration.h"
#include "game.h"
#include "guildmanager.h"
#include "localplayer.h"
@@ -194,6 +195,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
handleServerIgnoreAll(args, tab);
else if (type == "serverunignoreall")
handleServerUnIgnoreAll(args, tab);
+ else if (type == "dumpg")
+ handleDumpGraphics(args, tab);
else if (tab->handleCommand(type, args))
;
else if (type == "hack")
@@ -377,13 +380,19 @@ void CommandHandler::handleParty(const std::string &args, ChatTab *tab)
void CommandHandler::handleMe(const std::string &args, ChatTab *tab)
{
+ const std::string str = strprintf("*%s*", args.c_str());
+ outString(tab, strprintf("*%s*", args.c_str()), args);
+}
+
+void CommandHandler::outString(ChatTab *tab, const std::string &str,
+ const std::string &def)
+{
if (!tab)
{
- Net::getChatHandler()->me(args);
+ Net::getChatHandler()->me(def);
return;
}
- const std::string str = strprintf("*%s*", args.c_str());
switch (tab->getType())
{
case ChatTab::TAB_PARTY:
@@ -406,7 +415,7 @@ void CommandHandler::handleMe(const std::string &args, ChatTab *tab)
break;
}
default:
- Net::getChatHandler()->me(args);
+ Net::getChatHandler()->me(def);
break;
}
}
@@ -1036,6 +1045,48 @@ void CommandHandler::handleServerUnIgnoreAll(const std::string &args,
Net::getChatHandler()->unIgnoreAll();
}
+void CommandHandler::handleDumpGraphics(const std::string &args, ChatTab *tab)
+{
+ std::string str;
+ str = strprintf ("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION,
+ mainGraphics->getWidth(), mainGraphics->getHeight(),
+ mainGraphics->getBpp());
+
+ if (mainGraphics->getFullScreen())
+ str += "F";
+ else
+ str += "W";
+ if (mainGraphics->getHWAccel())
+ str += "H";
+ else
+ str += "S";
+
+ if (mainGraphics->getDoubleBuffer())
+ str += "D";
+ else
+ str += "_";
+
+#if defined USE_OPENGL
+ str += strprintf(",%d", mainGraphics->getOpenGL());
+#else
+ str += ",0";
+#endif
+
+ str += strprintf(",%f,", Client::getGuiAlpha());
+ str += config.getBoolValue("adjustPerfomance") ? "1" : "0";
+ str += config.getBoolValue("alphaCache") ? "1" : "0";
+ str += config.getBoolValue("enableMapReduce") ? "1" : "0";
+ str += config.getBoolValue("beingopacity") ? "1" : "0";
+ str += ",";
+ str += config.getBoolValue("enableAlphaFix") ? "1" : "0";
+ str += config.getBoolValue("disableAdvBeingCaching") ? "1" : "0";
+ str += config.getBoolValue("disableBeingCaching") ? "1" : "0";
+ str += config.getBoolValue("particleeffects") ? "1" : "0";
+
+ str += strprintf(",%d-%d", fps, config.getIntValue("fpslimit"));
+ outString(tab, str, str);
+}
+
#ifdef DEBUG_DUMP_LEAKS
void showRes(std::string str, ResourceManager::Resources *res);
diff --git a/src/commandhandler.h b/src/commandhandler.h
index a082f950e..0b3146af8 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -298,6 +298,11 @@ class CommandHandler
void handleDump(const std::string &args, ChatTab *tab);
+ void handleDumpGraphics(const std::string &args, ChatTab *tab);
+
+ void outString(ChatTab *tab, const std::string &str,
+ const std::string &def);
+
void handleCacheInfo(const std::string &args, ChatTab *tab A_UNUSED);
bool parse2Int(const std::string &args, int *x, int *y);
diff --git a/src/graphics.cpp b/src/graphics.cpp
index efa1058a6..d914b0b00 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -53,6 +53,7 @@ Graphics::Graphics():
mRect.y = 0;
mRect.w = 0;
mRect.h = 0;
+ mOpenGL = 0;
}
Graphics::~Graphics()
@@ -100,7 +101,10 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no");
if (mTarget->format)
+ {
logger->log("Bits per pixel: %d", mTarget->format->BytesPerPixel);
+ bpp = mTarget->format->BytesPerPixel;
+ }
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
if (!vi)
diff --git a/src/graphics.h b/src/graphics.h
index f3e0bd05d..4a4676b26 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -275,6 +275,21 @@ class Graphics : public gcn::SDLGraphics
bool getSecure()
{ return mSecure; }
+ int getBpp()
+ { return mBpp; }
+
+ bool getFullScreen()
+ { return mFullscreen; }
+
+ bool getHWAccel()
+ { return mHWAccel; }
+
+ bool getDoubleBuffer()
+ { return mDoubleBuffer; }
+
+ int getOpenGL()
+ { return mOpenGL; }
+
int mWidth;
int mHeight;
@@ -290,6 +305,7 @@ class Graphics : public gcn::SDLGraphics
bool mDoubleBuffer;
SDL_Rect mRect;
bool mSecure;
+ int mOpenGL;
};
extern Graphics *mainGraphics;
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index d8bc7f3c4..7969f55f8 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -296,6 +296,7 @@ void ChatWindow::fillCommands()
mCommands.push_back("/blacklist ");
mCommands.push_back("/serverignoreall");
mCommands.push_back("/serverunignoreall");
+ mCommands.push_back("/dumpg");
}
void ChatWindow::resetToDefaultSize()
diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp
index 46e482df6..1f1a0231d 100644
--- a/src/opengl1graphics.cpp
+++ b/src/opengl1graphics.cpp
@@ -49,6 +49,7 @@ OpenGL1Graphics::OpenGL1Graphics():
mAlpha(false), mTexture(false), mColorAlpha(false),
mSync(false)
{
+ mOpenGL = 2;
}
OpenGL1Graphics::~OpenGL1Graphics()
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 2ec5db490..049556c76 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -53,6 +53,7 @@ OpenGLGraphics::OpenGLGraphics():
mAlpha(false), mTexture(false), mColorAlpha(false),
mSync(false)
{
+ mOpenGL = 1;
mFloatTexArray = new GLfloat[vertexBufSize * 4 + 30];
mIntTexArray = new GLint[vertexBufSize * 4 + 30];
mIntVertArray = new GLint[vertexBufSize * 4 + 30];
diff --git a/src/resources/image.h b/src/resources/image.h
index 9ac2b163e..941b34465 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -188,6 +188,9 @@ class Image : public Resource
static void SDLSetEnableAlphaCache(bool n)
{ mEnableAlphaCache = n; }
+ static bool SDLGetEnableAlphaCache()
+ { return mEnableAlphaCache; }
+
static void setEnableAlpha(bool n)
{ mEnableAlpha = n; }