summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--The Mana World.dev8
-rwxr-xr-xconfigure.ac2
-rw-r--r--src/game.cpp21
-rw-r--r--src/graphics.cpp11
-rw-r--r--src/main.cpp25
-rw-r--r--src/openglgraphics.cpp11
7 files changed, 31 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 41d9faf1..d3acdb89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2006-05-02 Eugenio Favalli <elvenprogrammer@gmail.com>
+2006-05-03 Eugenio Favalli <elvenprogrammer@gmail.com>
+
+ * configure.ac, src/game.cpp, src/graphics.cpp, src/main.cpp,
+ src/openglgraphics.cpp, The Mana World: Increased fps limit granularity
+ and cleaned some code, fixed some xml library name in Dev-C++ project
+ file, switched version to 0.0.20.
+
+2006-05-02 Eugenio Favalli <elvenprogrammer@gmail.com>
* src/localplayer.cpp: Fixed the delay last move bug.
diff --git a/The Mana World.dev b/The Mana World.dev
index c296b348..9bfe9ac4 100644
--- a/The Mana World.dev
+++ b/The Mana World.dev
@@ -12,7 +12,7 @@ ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=-DUSE_OPENGL_@@_-Wall_@@_
-Linker=-lguichan_@@_-lguichan_sdl_@@_-lguichan_opengl_@@_-lwsock32_@@_-lSDL_image_@@_-lSDL_mixer_@@_-lSDL_net_@@_-lmingw32_@@_-lSDLmain_@@_-lSDL_@@_-lxml2_@@_-lopengl32_@@_-lpng_@@_-lz.dll_@@_-lphysfs_@@_-lcurl_@@_
+Linker=-lguichan_@@_-lguichan_sdl_@@_-lguichan_opengl_@@_-lwsock32_@@_-lSDL_image_@@_-lSDL_mixer_@@_-lSDL_net_@@_-lmingw32_@@_-lSDLmain_@@_-lSDL_@@_-lxml2.dll_@@_-lopengl32_@@_-lpng_@@_-lz.dll_@@_-lphysfs_@@_-lcurl_@@_
IsCpp=1
Icon=The Mana World.ico
ExeOutput=
@@ -32,19 +32,19 @@ CompilerSettings=0010001001000001001001
[VersionInfo]
Major=0
Minor=0
-Release=19
+Release=20
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=The Mana World Development Team
-FileVersion=0.0.19
+FileVersion=0.0.20
FileDescription=The Mana World
InternalName=tmw.exe
LegalCopyright=2004-2006 (C)
LegalTrademarks=
OriginalFilename=tmw.exe
ProductName=The Mana World MMORPG
-ProductVersion=0.0.19
+ProductVersion=0.0.20
AutoIncBuildNr=0
[Unit8]
diff --git a/configure.ac b/configure.ac
index 93d26859..a4a3eef6 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.59)
-AC_INIT([The Mana World], [0.0.19], [umperio@users.sourceforge.net], [tmw])
+AC_INIT([The Mana World], [0.0.20], [elvenprogrammer@gmail.com], [tmw])
AC_CONFIG_HEADERS([config.h:config.h.in])
AC_LANG_CPLUSPLUS
diff --git a/src/game.cpp b/src/game.cpp
index f8812b81..a03989fe 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -342,6 +342,13 @@ bool saveScreenshot(SDL_Surface *screenshot)
void Game::logic()
{
int gameTime = tick_time;
+ int drawTime = tick_time * 10;
+ int delta = 0;
+ int fpsLimit = (int)config.getValue("fpslimit", 0);
+ if (fpsLimit)
+ {
+ delta = 1000 / fpsLimit;
+ }
while (!done)
{
@@ -358,9 +365,17 @@ void Game::logic()
// Update the screen when application is active, delay otherwise
if (SDL_GetAppState() & SDL_APPACTIVE)
{
- frame++;
- engine->draw(graphics);
- graphics->updateScreen();
+ if (abs(tick_time * 10 - drawTime) >= delta)
+ {
+ frame++;
+ engine->draw(graphics);
+ graphics->updateScreen();
+ drawTime += delta;
+ }
+ else
+ {
+ SDL_Delay(10);
+ }
}
else
{
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 3f6a98c6..d709bfe1 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -29,8 +29,6 @@
#include "resources/image.h"
-extern volatile int framesToDraw;
-
Graphics::Graphics():
mScreen(0)
{
@@ -225,15 +223,6 @@ Graphics::drawImageRect(int x, int y, int w, int h,
void Graphics::updateScreen()
{
SDL_Flip(mScreen);
-
- // Decrement frame counter when using framerate limiting
- if (framesToDraw > 1) framesToDraw--;
-
- // Wait while we're not allowed to draw next frame yet
- while (framesToDraw == 1)
- {
- SDL_Delay(10);
- }
}
SDL_Surface* Graphics::getScreenshot()
diff --git a/src/main.cpp b/src/main.cpp
index d067d3c9..985a2ba4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -93,7 +93,6 @@ SERVER_INFO **server_info;
unsigned char state;
std::string errorMessage;
unsigned char screen_mode;
-volatile int framesToDraw = 0;
Sound sound;
Music *bgm;
@@ -101,18 +100,6 @@ Music *bgm;
Configuration config; /**< Xml file configuration reader */
Logger *logger; /**< Log object */
-/**
- * Allows the next frame to be drawn (part of framerate limiting)
- */
-Uint32 nextFrame(Uint32 interval, void *param)
-{
- if (framesToDraw < 10)
- {
- framesToDraw++;
- }
- return interval;
-}
-
namespace {
struct ErrorListener : public gcn::ActionListener
{
@@ -275,9 +262,6 @@ void init_engine()
hairset.push_back(tmp);
}
}
- /*hairset = resman->createSpriteset(
- "graphics/sprites/player_male_hair.png", 29, 29);
- if (!hairset) logger->error("Couldn't load hair spriteset!");*/
gui = new Gui(graphics);
state = UPDATE_STATE; /**< Initial game state */
@@ -295,15 +279,6 @@ void init_engine()
errorMessage = err;
logger->log("Warning: %s", err);
}
-
- // Set frame counter when using fps limit
- int fpsLimit = (int)config.getValue("fpslimit", 0);
- if (fpsLimit)
- {
- if (fpsLimit < 10) fpsLimit = 10;
- if (fpsLimit > 200) fpsLimit = 200;
- SDL_AddTimer(1000 / fpsLimit, nextFrame, NULL);
- }
}
/** Clear the engine */
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 9de59f79..1e8918cb 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -37,8 +37,6 @@
#include "resources/image.h"
-extern volatile int framesToDraw;
-
OpenGLGraphics::OpenGLGraphics():
mAlpha(false), mTexture(false), mColorAlpha(false)
{
@@ -108,15 +106,6 @@ void OpenGLGraphics::updateScreen()
glFlush();
glFinish();
SDL_GL_SwapBuffers();
-
- // Decrement frame counter when using framerate limiting
- if (framesToDraw > 1) framesToDraw--;
-
- // Wait while we're not allowed to draw next frame yet
- while (framesToDraw == 1)
- {
- SDL_Delay(10);
- }
}
void OpenGLGraphics::_beginDraw()