summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--Info.plist4
-rwxr-xr-xconfigure.ac2
-rw-r--r--data/help/header.txt2
-rw-r--r--packaging/windows/setup.nsi2
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/being.cpp77
-rw-r--r--src/being.h23
-rw-r--r--src/game.cpp17
-rw-r--r--src/gui/color.cpp6
-rw-r--r--src/gui/color.h10
-rw-r--r--src/gui/itempopup.cpp6
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/gui/setup_audio.cpp2
-rw-r--r--src/gui/setup_colors.cpp2
-rw-r--r--src/gui/setup_colors.h6
-rw-r--r--src/gui/setup_joystick.cpp2
-rw-r--r--src/gui/setup_keyboard.cpp2
-rw-r--r--src/gui/setup_players.cpp57
-rw-r--r--src/gui/setup_players.h2
-rw-r--r--src/gui/setup_video.cpp132
-rw-r--r--src/gui/setup_video.h12
-rw-r--r--src/gui/shortcutcontainer.cpp6
-rw-r--r--src/gui/shortcutcontainer.h6
-rw-r--r--src/gui/skill.cpp3
-rw-r--r--src/gui/speechbubble.cpp20
-rw-r--r--src/gui/speechbubble.h2
-rw-r--r--src/gui/table.cpp2
-rw-r--r--src/gui/truetypefont.cpp4
-rw-r--r--src/gui/truetypefont.h6
-rw-r--r--src/gui/widgets/dropdown.cpp6
-rw-r--r--src/gui/widgets/dropdown.h6
-rw-r--r--src/keyboardconfig.cpp4
-rw-r--r--src/keyboardconfig.h2
-rw-r--r--src/localplayer.cpp151
-rw-r--r--src/localplayer.h23
-rw-r--r--src/main.cpp8
-rw-r--r--src/main.h2
-rw-r--r--src/map.cpp31
-rw-r--r--src/map.h7
-rw-r--r--src/net/beinghandler.cpp1
-rw-r--r--src/net/partyhandler.cpp6
-rw-r--r--src/net/partyhandler.h6
-rw-r--r--src/party.cpp8
-rw-r--r--src/party.h8
-rw-r--r--src/resources/buddylist.cpp128
-rw-r--r--src/resources/buddylist.h80
-rw-r--r--src/resources/emotedb.cpp2
-rw-r--r--src/resources/emotedb.h2
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/monsterdb.cpp4
-rw-r--r--src/resources/music.h5
-rw-r--r--src/resources/soundeffect.h4
-rw-r--r--src/simpleanimation.cpp24
-rw-r--r--src/simpleanimation.h7
-rw-r--r--src/sound.h4
-rw-r--r--src/text.cpp6
-rw-r--r--src/tmw.rc2
-rw-r--r--src/utils/tostring.h2
-rw-r--r--src/winver.h6
-rw-r--r--tmw.cbp2
63 files changed, 449 insertions, 527 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b45c5376..71d85b12 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
PROJECT(TMW)
-SET(VERSION 0.0.28.1)
+SET(VERSION 0.0.29)
# where to look for cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
diff --git a/Info.plist b/Info.plist
index 36084dd8..213f2ea0 100644
--- a/Info.plist
+++ b/Info.plist
@@ -5,13 +5,13 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
- <string>The Mana World</string>
+ <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>The Mana World.icns</string>
<key>CFBundleIdentifier</key>
<string>TMW</string>
<key>CFBundleName</key>
- <string>The Mana World</string>
+ <string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
diff --git a/configure.ac b/configure.ac
index 9e05f76f..00b6e9ba 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.59)
-AC_INIT([The Mana World], [0.0.28.1], [themanaworld-devel@lists.sourceforge.net], [tmw])
+AC_INIT([The Mana World], [0.0.29], [themanaworld-devel@lists.sourceforge.net], [tmw])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h:config.h.in])
AC_LANG_CPLUSPLUS
diff --git a/data/help/header.txt b/data/help/header.txt
index 661ec1e7..7312b3cc 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.28.1 ##2Date:##3 12 February 2009
+ ##2Version:##6 0.0.29 ##2Date:##3 12 February 2009
##2 Website: http://themanaworld.org
diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi
index fd2f324b..834c2d3b 100644
--- a/packaging/windows/setup.nsi
+++ b/packaging/windows/setup.nsi
@@ -9,7 +9,7 @@ SetCompressor /SOLID lzma
; HM NIS Edit helper defines
!define PRODUCT_NAME "The Mana World"
-!define PRODUCT_VERSION "0.0.28.1"
+!define PRODUCT_VERSION "0.0.29"
!define PRODUCT_PUBLISHER "The Mana World Development Team"
!define PRODUCT_WEB_SITE "http://themanaworld.org"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\tmw.exe"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 034b0a79..3ddc855a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -50,8 +50,6 @@ src/net/loginhandler.cpp
src/net/maploginhandler.cpp
src/net/playerhandler.cpp
src/net/tradehandler.cpp
-src/resources/colordb.cpp
-src/resources/emotedb.cpp
src/resources/itemdb.cpp
src/resources/monsterdb.cpp
src/resources/npcdb.cpp
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c7e3d936..25f1a4bc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -255,8 +255,6 @@ SET(SRCS
resources/ambientoverlay.h
resources/animation.cpp
resources/animation.h
- resources/buddylist.cpp
- resources/buddylist.h
resources/colordb.cpp
resources/colordb.h
resources/dye.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 8de13464..65b60c8c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -205,8 +205,6 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \
resources/ambientoverlay.h \
resources/animation.cpp \
resources/animation.h \
- resources/buddylist.cpp \
- resources/buddylist.h \
resources/colordb.cpp \
resources/colordb.h \
resources/dye.cpp \
diff --git a/src/being.cpp b/src/being.cpp
index dcb45a9d..86811e33 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -30,6 +30,7 @@
#include "log.h"
#include "map.h"
#include "particle.h"
+#include "simpleanimation.h"
#include "sound.h"
#include "text.h"
#include "statuseffect.h"
@@ -37,10 +38,8 @@
#include "gui/speechbubble.h"
#include "resources/colordb.h"
-
#include "resources/emotedb.h"
#include "resources/image.h"
-#include "resources/imageset.h"
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
#include "resources/resourcemanager.h"
@@ -95,7 +94,8 @@ Being::Being(int id, int job, Map *map):
mSpriteColors(VECTOREND_SPRITE, ""),
mStatusParticleEffects(&mStunParticleEffects, false),
mChildParticleEffects(&mStatusParticleEffects, false),
- mMustResetParticles(false)
+ mMustResetParticles(false),
+ mUsedTargetCursor(NULL)
{
setMap(map);
@@ -113,7 +113,8 @@ Being::Being(int id, int job, Map *map):
emotionSet.push_back(AnimatedSprite::load(file, variant));
}
- // Hairstyles are encoded as negative numbers. Count how far negative we can go.
+ // Hairstyles are encoded as negative numbers. Count how far negative
+ // we can go.
int hairstyles = 1;
while (ItemDB::get(-hairstyles).getSprite(GENDER_MALE) != "error.xml")
{
@@ -130,6 +131,7 @@ Being::Being(int id, int job, Map *map):
Being::~Being()
{
+ mUsedTargetCursor = NULL;
delete_all(mSprites);
clearPath();
@@ -149,9 +151,7 @@ Being::~Being()
void Being::setDestination(Uint16 destX, Uint16 destY)
{
if (mMap)
- {
setPath(mMap->findPath(mX, mY, destX, destY));
- }
}
void Being::clearPath()
@@ -232,19 +232,13 @@ void Being::takeDamage(int amount)
// Selecting the right color
if (damage == "miss")
- {
font = hitYellowFont;
- }
else
{
if (getType() == MONSTER)
- {
font = hitBlueFont;
- }
else
- {
font = hitRedFont;
- }
}
// Show damage number
@@ -270,17 +264,13 @@ void Being::setMap(Map *map)
{
// Remove sprite from potential previous map
if (mMap)
- {
mMap->removeSprite(mSpriteIterator);
- }
mMap = map;
// Add sprite to potential new map
if (mMap)
- {
mSpriteIterator = mMap->addSprite(this);
- }
// Clear particle effect list because child particles became invalid
mChildParticleEffects.clear();
@@ -316,9 +306,7 @@ void Being::setAction(Action action)
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
if (mSprites[i])
- {
mSprites[i]->reset();
- }
}
break;
case HURT:
@@ -339,9 +327,7 @@ void Being::setAction(Action action)
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
if (mSprites[i])
- {
mSprites[i]->play(currentAction);
- }
}
mAction = action;
}
@@ -449,18 +435,18 @@ void Being::logic()
if (mEmotion != 0)
{
mEmotionTime--;
- if (mEmotionTime == 0) {
+ if (mEmotionTime == 0)
mEmotion = 0;
- }
}
// Update sprite animations
+ if (mUsedTargetCursor != NULL)
+ mUsedTargetCursor->update(tick_time * 10);
+
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
if (mSprites[i])
- {
mSprites[i]->update(tick_time * 10);
- }
}
// Restart status/particle effects, if needed
@@ -485,6 +471,11 @@ void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
int px = mPx + offsetX;
int py = mPy + offsetY;
+ if (mUsedTargetCursor != NULL)
+ {
+ mUsedTargetCursor->draw(graphics, px, py);
+ }
+
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
if (mSprites[i])
@@ -509,28 +500,33 @@ void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
void Being::drawSpeech(int offsetX, int offsetY)
{
- int px = mPx + offsetX;
- int py = mPy + offsetY;
+ const int px = mPx + offsetX;
+ const int py = mPy + offsetY;
+ const int speech = (int) config.getValue("speech", NAME_IN_BUBBLE);
// Draw speech above this being
- if (mSpeechTime > 0 && config.getValue("speechbubble", 1))
+ if (mSpeechTime > 0 && (speech == NAME_IN_BUBBLE ||
+ speech == NO_NAME_IN_BUBBLE))
{
+ const bool showName = (speech == NAME_IN_BUBBLE);
+
if (mText)
{
delete mText;
mText = 0;
}
- mSpeechBubble->setCaption(mName, mNameColor);
+ mSpeechBubble->setCaption(showName ? mName : "", mNameColor);
- // Not quite centered, but close enough. However, it's not too important to get
- // it right right now, as it doesn't take bubble collision into account yet.
- mSpeechBubble->setText(mSpeech);
- mSpeechBubble->setPosition(px - (mSpeechBubble->getWidth() * 4 / 11), py - 70 -
- (mSpeechBubble->getNumRows()*14));
+ // Not quite centered, but close enough. However, it's not too important
+ // to get it right right now, as it doesn't take bubble collision into
+ // account yet.
+ mSpeechBubble->setText(mSpeech, showName);
+ mSpeechBubble->setPosition(px - (mSpeechBubble->getWidth() * 4 / 11),
+ py - 40 - (mSpeechBubble->getHeight()));
mSpeechBubble->setVisible(true);
}
- else if (mSpeechTime > 0 && !config.getValue("speechbubble", 1))
+ else if (mSpeechTime > 0 && speech == TEXT_OVERHEAD)
{
mSpeechBubble->setVisible(false);
// don't introduce a memory leak
@@ -540,6 +536,13 @@ void Being::drawSpeech(int offsetX, int offsetY)
mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
gcn::Graphics::CENTER, gcn::Color(255, 255, 255));
}
+ else if (speech == NO_SPEECH)
+ {
+ mSpeechBubble->setVisible(false);
+ if (mText)
+ delete mText;
+ mText = NULL;
+ }
else if (mSpeechTime == 0)
{
mSpeechBubble->setVisible(false);
@@ -648,7 +651,6 @@ int Being::getWidth() const
}
}
-
int Being::getHeight() const
{
if (mSprites[BASE_SPRITE])
@@ -664,6 +666,11 @@ int Being::getHeight() const
}
}
+void Being::setTargetAnimation(SimpleAnimation* animation)
+{
+ mUsedTargetCursor = animation;
+ mUsedTargetCursor->reset();
+}
struct EffectDescription {
std::string mGFXEffect;
diff --git a/src/being.h b/src/being.h
index 3c3a9b73..ef830e3a 100644
--- a/src/being.h
+++ b/src/being.h
@@ -50,6 +50,7 @@ class Map;
class Graphics;
class Particle;
class Position;
+class SimpleAnimation;
class SpeechBubble;
class Text;
@@ -114,6 +115,15 @@ class Being : public Sprite
NUM_TC
};
+ enum Speech
+ {
+ NO_SPEECH = 0,
+ TEXT_OVERHEAD,
+ NO_NAME_IN_BUBBLE,
+ NAME_IN_BUBBLE,
+ NUM_SPEECH
+ };
+
/**
* Directions, to be used as bitmask values
*/
@@ -364,6 +374,16 @@ class Being : public Sprite
*/
void controlParticle(Particle *particle);
+ /**
+ * Sets the target animation for this being.
+ */
+ void setTargetAnimation(SimpleAnimation* animation);
+
+ /**
+ * Untargets the being
+ */
+ void untarget() { mUsedTargetCursor = NULL; }
+
AnimatedSprite* getEmote(int index) { return emotionSet[index]; }
void setEmote(Uint8 emotion, Uint8 emote_time)
@@ -503,6 +523,9 @@ class Being : public Sprite
// Speech Bubble components
SpeechBubble *mSpeechBubble;
+ // Target cursor being used
+ SimpleAnimation* mUsedTargetCursor;
+
static int instances; /**< Number of Being instances */
static std::vector<AnimatedSprite*> emotionSet; /**< Emoticons used by beings */
};
diff --git a/src/game.cpp b/src/game.cpp
index 5b701fc1..68380f5b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -527,11 +527,11 @@ void Game::handleInput()
done = true;
// Close the Browser if opened
else if (helpWindow->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_TOGGLE_CHAT))
+ keyboard.isKeyActive(keyboard.KEY_OK))
helpWindow->setVisible(false);
// Close the config window, cancelling changes if opened
else if (setupWindow->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_TOGGLE_CHAT))
+ keyboard.isKeyActive(keyboard.KEY_OK))
setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
// Submits the text and proceeds to the next dialog
else if (npcStringDialog->isVisible() &&
@@ -553,7 +553,9 @@ void Game::handleInput()
KeyboardConfig::KEY_TOGGLE_CHAT) ==
keyboard.getKeyValue(
KeyboardConfig::KEY_OK) &&
- (npcStringDialog->isVisible() ||
+ (helpWindow->isVisible() ||
+ setupWindow->isVisible() ||
+ npcStringDialog->isVisible() ||
npcTextDialog->isVisible() ||
npcListDialog->isVisible() ||
npcIntegerDialog->isVisible())))
@@ -794,6 +796,15 @@ void Game::handleInput()
// Get the state of the keyboard keys
keyboard.refreshActiveKeys();
+ // Ignore input if either "ignore" key is pressed
+ // Stops the character moving about if the user's window manager
+ // uses "ignore+arrow key" to switch virtual desktops.
+ if (keyboard.isKeyActive(keyboard.KEY_IGNORE_INPUT_1) ||
+ keyboard.isKeyActive(keyboard.KEY_IGNORE_INPUT_2))
+ {
+ return;
+ }
+
const Uint16 x = player_node->mX;
const Uint16 y = player_node->mY;
unsigned char direction = 0;
diff --git a/src/gui/color.cpp b/src/gui/color.cpp
index 7a29025e..02469893 100644
--- a/src/gui/color.cpp
+++ b/src/gui/color.cpp
@@ -48,7 +48,7 @@ Color::~Color()
col != colEnd;
++col)
{
- config.setValue("color" + col->text, toString(col->rgb));
+ config.setValue("Color" + col->text, toString(col->rgb));
}
}
@@ -104,8 +104,8 @@ char Color::getColorCharAt(int i)
void Color::addColor(const char c, const int rgb, const std::string &text)
{
- int trueRgb = (int)config.getValue("color" + text, rgb);
- mColVector.push_back(colorElem(c, trueRgb, text));
+ int trueRgb = (int) config.getValue("Color" + text, rgb);
+ mColVector.push_back(ColorElem(c, trueRgb, text));
}
int Color::getColorAt(int i)
diff --git a/src/gui/color.h b/src/gui/color.h
index 509448e7..8684a1a7 100644
--- a/src/gui/color.h
+++ b/src/gui/color.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef COLOUR_H
-#define COLOUR_H
+#ifndef COLOR_H
+#define COLOR_H
#include <string>
#include <vector>
@@ -109,16 +109,16 @@ class Color : public gcn::ListModel
void rollback();
private:
- struct colorElem
+ struct ColorElem
{
- colorElem(const char c, const int rgb, const std::string &text) :
+ ColorElem(const char c, const int rgb, const std::string &text) :
ch(c), rgb(rgb), text(text) {}
char ch;
int rgb;
int committedRgb;
std::string text;
};
- typedef std::vector<colorElem> ColVector;
+ typedef std::vector<ColorElem> ColVector;
ColVector mColVector;
/**
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 4c117f0a..008a41d9 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -5,18 +5,18 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 09eaeff0..09f7109e 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -49,8 +49,8 @@ Setup::Setup():
Window(_("Setup"))
{
setCloseButton(true);
- int width = 310;
- int height = 310;
+ int width = 340;
+ int height = 340;
setContentSize(width, height);
static const char *buttonNames[] = {
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 5c189882..a4bc05ae 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -71,7 +71,7 @@ Setup_Audio::Setup_Audio():
place(0, 2, mMusicSlider);
place(1, 2, musicLabel);
- setDimension(gcn::Rectangle(0, 0, 290, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
void Setup_Audio::apply()
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 372dbd17..4f88f212 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -126,7 +126,7 @@ Setup_Colors::Setup_Colors() :
place(2, 10, mBlueSlider);
place(3, 10, mBlueText).setPadding(1);
- setDimension(gcn::Rectangle(0, 0, 290, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Colors::~Setup_Colors()
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index 8fd1ba59..2831297f 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef SETUP_COLOURS_H
-#define SETUP_COLOURS_H
+#ifndef SETUP_COLORS_H
+#define SETUP_COLORS_H
#include <string>
@@ -37,7 +37,7 @@
class BrowserBox;
class Setup_Colors : public SetupTab, public gcn::ActionListener,
- public TextFieldListener
+ public TextFieldListener
{
public:
Setup_Colors();
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 2ebcdbde..c0c04949 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -56,7 +56,7 @@ Setup_Joystick::Setup_Joystick():
place = h.getPlacer(0, 1);
place(0, 0, mCalibrateButton);
- setDimension(gcn::Rectangle(0, 0, 290, 75));
+ setDimension(gcn::Rectangle(0, 0, 325, 75));
}
void Setup_Joystick::action(const gcn::ActionEvent &event)
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 5d7519ef..6eef6f49 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -98,7 +98,7 @@ Setup_Keyboard::Setup_Keyboard():
place(0, 6, mMakeDefaultButton);
place(3, 6, mAssignKeyButton);
- setDimension(gcn::Rectangle(0, 0, 295, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Keyboard::~Setup_Keyboard()
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index d25117de..44b52b54 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright (C) 2004 The Mana World Development Team
+ * Copyright (C) 2008 The Mana World Development Team
*
* This file is part of The Mana World.
*
@@ -47,17 +47,19 @@
#define ROW_HEIGHT 12
// The following column widths really shouldn't be hardcoded but should scale with the size of the widget... except
// that, right now, the widget doesn't exactly scale either.
-#define NAME_COLUMN_WIDTH 195
+#define NAME_COLUMN_WIDTH 230
#define RELATION_CHOICE_COLUMN_WIDTH 80
#define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column)
-static const char *table_titles[COLUMNS_NR] = {
+static const char *table_titles[COLUMNS_NR] =
+{
N_("Name"),
N_("Relation")
};
-static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = {
+static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] =
+{
N_("Neutral"),
N_("Friend"),
N_("Disregarded"),
@@ -153,9 +155,10 @@ public:
virtual void updateModelInRow(int row)
{
gcn::DropDown *choicebox = dynamic_cast<gcn::DropDown *>(
- getElementAt(row, RELATION_CHOICE_COLUMN));
+ getElementAt(row, RELATION_CHOICE_COLUMN));
player_relations.setRelation(getPlayerAt(row),
- static_cast<PlayerRelation::relation>(choicebox->getSelected()));
+ static_cast<PlayerRelation::relation>(
+ choicebox->getSelected()));
}
@@ -170,7 +173,9 @@ public:
delete mPlayers;
mPlayers = NULL;
- for (std::vector<gcn::Widget *>::const_iterator it = mWidgets.begin(); it != mWidgets.end(); it++) {
+ for (std::vector<gcn::Widget *>::const_iterator it = mWidgets.begin();
+ it != mWidgets.end(); it++)
+ {
delete *it;
}
@@ -202,9 +207,9 @@ public:
virtual std::string getElementAt(int i)
{
- if (i >= getNumberOfElements()) {
+ if (i >= getNumberOfElements())
return _("???");
- }
+
return (*player_relations.getPlayerIgnoreStrategies())[i]->mDescription;
}
};
@@ -230,11 +235,9 @@ Setup_Players::Setup_Players():
setOpaque(false);
mPlayerTable->setOpaque(false);
- int table_width = NAME_COLUMN_WIDTH + RELATION_CHOICE_COLUMN_WIDTH;
mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH);
mPlayerTableTitleModel->fixColumnWidth(RELATION_CHOICE_COLUMN,
RELATION_CHOICE_COLUMN_WIDTH);
- mPlayerTitleTable->setDimension(gcn::Rectangle(10, 10, table_width - 1, 10));
mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf));
gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel();
@@ -256,7 +259,6 @@ Setup_Players::Setup_Players():
gcn::Label *ignore_action_label = new gcn::Label(_("When ignoring:"));
- mIgnoreActionChoicesBox->setDimension(gcn::Rectangle(80, 132, 120, 12));
mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY);
mIgnoreActionChoicesBox->addActionListener(this);
@@ -289,7 +291,7 @@ Setup_Players::Setup_Players():
player_relations.addListener(this);
- setDimension(gcn::Rectangle(0, 0, 290, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Players::~Setup_Players()
@@ -304,9 +306,12 @@ void Setup_Players::reset()
// current selection. We could use an index into the table of config
// options in player_relations instead of strategies to sidestep this.
int selection = 0;
- for (unsigned int i = 0; i < player_relations.getPlayerIgnoreStrategies()->size(); ++i)
+ for (unsigned int i = 0;
+ i < player_relations.getPlayerIgnoreStrategies()->size();
+ ++i)
if ((*player_relations.getPlayerIgnoreStrategies())[i] ==
- player_relations.getPlayerIgnoreStrategy()) {
+ player_relations.getPlayerIgnoreStrategy())
+ {
selection = i;
break;
@@ -320,11 +325,14 @@ void Setup_Players::apply()
player_relations.setPersistIgnores(mPersistIgnores->isSelected());
player_relations.store();
- unsigned int old_default_relations =
- player_relations.getDefault() & ~(PlayerRelation::TRADE | PlayerRelation::WHISPER);
+ unsigned int old_default_relations = player_relations.getDefault() &
+ ~(PlayerRelation::TRADE |
+ PlayerRelation::WHISPER);
player_relations.setDefault(old_default_relations
- | (mDefaultTrading->isSelected()? PlayerRelation::TRADE : 0)
- | (mDefaultWhisper->isSelected()? PlayerRelation::WHISPER : 0));
+ | (mDefaultTrading->isSelected() ?
+ PlayerRelation::TRADE : 0)
+ | (mDefaultWhisper->isSelected() ?
+ PlayerRelation::WHISPER : 0));
}
void Setup_Players::cancel()
@@ -333,7 +341,8 @@ void Setup_Players::cancel()
void Setup_Players::action(const gcn::ActionEvent &event)
{
- if (event.getId() == ACTION_TABLE) {
+ if (event.getId() == ACTION_TABLE)
+ {
// temporarily eliminate ourselves: we are fully aware of this change,
// so there is no need for asynchronous updates. (In fact, thouse
// might destroy the widet that triggered them, which would be rather
@@ -346,7 +355,9 @@ void Setup_Players::action(const gcn::ActionEvent &event)
player_relations.addListener(this);
- } else if (event.getId() == ACTION_DELETE) {
+ }
+ else if (event.getId() == ACTION_DELETE)
+ {
int player_index = mPlayerTable->getSelectedRow();
if (player_index < 0)
@@ -356,7 +367,9 @@ void Setup_Players::action(const gcn::ActionEvent &event)
player_relations.removePlayer(name);
- } else if (event.getId() == ACTION_STRATEGY) {
+ }
+ else if (event.getId() == ACTION_STRATEGY)
+ {
PlayerIgnoreStrategy *s =
(*player_relations.getPlayerIgnoreStrategies())[
mIgnoreActionChoicesBox->getSelected()];
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 74247b77..72d81f71 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright (C) 2004 The Mana World Development Team
+ * Copyright (C) 2008 The Mana World Development Team
*
* This file is part of The Mana World.
*
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index c02025c8..6e26bab6 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -108,18 +108,19 @@ Setup_Video::Setup_Video():
mOpenGLEnabled(config.getValue("opengl", false)),
mCustomCursorEnabled(config.getValue("customcursor", true)),
mParticleEffectsEnabled(config.getValue("particleeffects", true)),
- mSpeechBubbleEnabled(config.getValue("speechbubble", true)),
mNameEnabled(config.getValue("showownname", false)),
mOpacity(config.getValue("guialpha", 0.8)),
mFps((int) config.getValue("fpslimit", 0)),
+ mSpeechMode((int) config.getValue("speech", 3)),
mModeListModel(new ModeListModel),
mModeList(new ListBox(mModeListModel)),
mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)),
mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)),
mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)),
- mSpeechBubbleCheckBox(new CheckBox(_("Speech bubbles"), mSpeechBubbleEnabled)),
mNameCheckBox(new CheckBox(_("Show name"), mNameEnabled)),
+ mSpeechSlider(new Slider(0, 3)),
+ mSpeechLabel(new gcn::Label("")),
mAlphaSlider(new Slider(0.2, 1.0)),
mFpsCheckBox(new CheckBox(_("FPS Limit:"))),
mFpsSlider(new Slider(10, 200)),
@@ -142,11 +143,12 @@ Setup_Video::Setup_Video():
ScrollArea *scrollArea = new ScrollArea(mModeList);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- gcn::Label *alphaLabel = new gcn::Label(_("Gui opacity"));
- gcn::Label *scrollRadiusLabel = new gcn::Label(_("Scroll radius"));
- gcn::Label *scrollLazinessLabel = new gcn::Label(_("Scroll laziness"));
- gcn::Label *overlayDetailLabel = new gcn::Label(_("Ambient FX"));
- gcn::Label *particleDetailLabel = new gcn::Label(_("Particle Detail"));
+ speechLabel = new gcn::Label(_("Overhead text"));
+ alphaLabel = new gcn::Label(_("Gui opacity"));
+ scrollRadiusLabel = new gcn::Label(_("Scroll radius"));
+ scrollLazinessLabel = new gcn::Label(_("Scroll laziness"));
+ overlayDetailLabel = new gcn::Label(_("Ambient FX"));
+ particleDetailLabel = new gcn::Label(_("Particle Detail"));
mModeList->setEnabled(true);
#ifndef USE_OPENGL
@@ -167,10 +169,10 @@ Setup_Video::Setup_Video():
mModeList->setActionEventId("videomode");
mCustomCursorCheckBox->setActionEventId("customcursor");
mParticleEffectsCheckBox->setActionEventId("particleeffects");
- mSpeechBubbleCheckBox->setActionEventId("speechbubble");
mNameCheckBox->setActionEventId("showownname");
mAlphaSlider->setActionEventId("guialpha");
mFpsCheckBox->setActionEventId("fpslimitcheckbox");
+ mSpeechSlider->setActionEventId("speech");
mFpsSlider->setActionEventId("fpslimitslider");
mScrollRadiusSlider->setActionEventId("scrollradiusslider");
mScrollRadiusField->setActionEventId("scrollradiusfield");
@@ -184,10 +186,10 @@ Setup_Video::Setup_Video():
mModeList->addActionListener(this);
mCustomCursorCheckBox->addActionListener(this);
mParticleEffectsCheckBox->addActionListener(this);
- mSpeechBubbleCheckBox->addActionListener(this);
mNameCheckBox->addActionListener(this);
mAlphaSlider->addActionListener(this);
mFpsCheckBox->addActionListener(this);
+ mSpeechSlider->addActionListener(this);
mFpsSlider->addActionListener(this);
mFpsField->addKeyListener(this);
mScrollRadiusSlider->addActionListener(this);
@@ -205,6 +207,23 @@ Setup_Video::Setup_Video():
mScrollLazinessField->setText(toString(mOriginalScrollLaziness));
mScrollLazinessSlider->setValue(mOriginalScrollLaziness);
+ switch (mSpeechMode)
+ {
+ case 0:
+ mSpeechLabel->setCaption(_("No text"));
+ break;
+ case 1:
+ mSpeechLabel->setCaption(_("Text"));
+ break;
+ case 2:
+ mSpeechLabel->setCaption(_("Bubbles, no names"));
+ break;
+ case 3:
+ mSpeechLabel->setCaption(_("Bubbles with names"));
+ break;
+ }
+ mSpeechSlider->setValue(mSpeechMode);
+
switch (mOverlayDetail)
{
case 0:
@@ -244,36 +263,71 @@ Setup_Video::Setup_Video():
place(1, 0, mFsCheckBox, 3);
place(1, 1, mOpenGLCheckBox, 3);
place(1, 2, mCustomCursorCheckBox, 3);
- place(1, 3, mSpeechBubbleCheckBox, 3);
- place(1, 4, mNameCheckBox, 3);
- place(1, 5, mParticleEffectsCheckBox, 3);
-
- place(0, 7, mAlphaSlider);
- place(0, 8, mFpsSlider);
- place(0, 9, mScrollRadiusSlider);
- place(0, 10, mScrollLazinessSlider);
+ place(1, 3, mNameCheckBox, 3);
+ place(1, 4, mParticleEffectsCheckBox, 3);
+
+ place(0, 6, mAlphaSlider);
+ place(0, 7, mFpsSlider);
+ place(0, 8, mScrollRadiusSlider);
+ place(0, 9, mScrollLazinessSlider);
+ place(0, 10, mSpeechSlider);
place(0, 11, mOverlayDetailSlider);
place(0, 12, mParticleDetailSlider);
- place(1, 7, alphaLabel, 2);
- place(1, 8, mFpsCheckBox).setPadding(3);
- place(1, 9, scrollRadiusLabel);
- place(1, 10, scrollLazinessLabel);
+ place(1, 6, alphaLabel, 2);
+ place(1, 7, mFpsCheckBox).setPadding(3);
+ place(1, 8, scrollRadiusLabel);
+ place(1, 9, scrollLazinessLabel);
+ place(1, 10, speechLabel);
place(1, 11, overlayDetailLabel);
place(1, 12, particleDetailLabel);
- place(2, 8, mFpsField).setPadding(1);
- place(2, 9, mScrollRadiusField).setPadding(1);
- place(2, 10, mScrollLazinessField).setPadding(1);
+ place(2, 7, mFpsField).setPadding(1);
+ place(2, 8, mScrollRadiusField).setPadding(1);
+ place(2, 9, mScrollLazinessField).setPadding(1);
+ place(2, 10, mSpeechLabel, 2).setPadding(2);
place(2, 11, mOverlayDetailField, 2).setPadding(2);
place(2, 12, mParticleDetailField, 2).setPadding(2);
- setDimension(gcn::Rectangle(0, 0, 295, 250));
+ setDimension(gcn::Rectangle(0, 0, 325, 280));
}
Setup_Video::~Setup_Video()
{
delete mModeListModel;
+
+ delete speechLabel;
+ delete alphaLabel;
+ delete scrollRadiusLabel;
+ delete scrollLazinessLabel;
+ delete overlayDetailLabel;
+ delete particleDetailLabel;
+
+ delete mModeList;
+ delete mFsCheckBox;
+ delete mOpenGLCheckBox;
+ delete mCustomCursorCheckBox;
+ delete mParticleEffectsCheckBox;
+ delete mNameCheckBox;
+
+ delete mSpeechSlider;
+ delete mSpeechLabel;
+ delete mAlphaSlider;
+ delete mFpsCheckBox;
+ delete mFpsSlider;
+ delete mFpsField;
+
+ delete mScrollLazinessSlider;
+ delete mScrollLazinessField;
+
+ delete mScrollRadiusSlider;
+ delete mScrollRadiusField;
+
+ delete mOverlayDetailSlider;
+ delete mOverlayDetailField;
+
+ delete mParticleDetailSlider;
+ delete mParticleDetailField;
}
void Setup_Video::apply()
@@ -333,8 +387,8 @@ void Setup_Video::apply()
mFullScreenEnabled = config.getValue("screen", false);
mCustomCursorEnabled = config.getValue("customcursor", true);
mParticleEffectsEnabled = config.getValue("particleeffects", true);
- mSpeechBubbleEnabled = config.getValue("speechbubble", true);
mNameEnabled = config.getValue("showownname", false);
+ mSpeechMode = (int) config.getValue("speech", 3);
mOpacity = config.getValue("guialpha", 0.8);
mOverlayDetail = (int) config.getValue("OverlayDetail", 2);
mOpenGLEnabled = config.getValue("opengl", false);
@@ -366,7 +420,7 @@ void Setup_Video::cancel()
mOpenGLCheckBox->setSelected(mOpenGLEnabled);
mCustomCursorCheckBox->setSelected(mCustomCursorEnabled);
mParticleEffectsCheckBox->setSelected(mParticleEffectsEnabled);
- mSpeechBubbleCheckBox->setSelected(mSpeechBubbleEnabled);
+ mSpeechSlider->setValue(mSpeechMode);
mNameCheckBox->setSelected(mNameEnabled);
mAlphaSlider->setValue(mOpacity);
mOverlayDetailSlider->setValue(mOverlayDetail);
@@ -380,7 +434,7 @@ void Setup_Video::cancel()
config.setValue("screen", mFullScreenEnabled ? true : false);
config.setValue("customcursor", mCustomCursorEnabled ? true : false);
config.setValue("particleeffects", mParticleEffectsEnabled ? true : false);
- config.setValue("speechbubble", mSpeechBubbleEnabled ? true : false);
+ config.setValue("speech", mSpeechMode);
config.setValue("showownname", mNameEnabled ? true : false);
config.setValue("guialpha", mOpacity);
config.setValue("opengl", mOpenGLEnabled ? true : false);
@@ -417,10 +471,26 @@ void Setup_Video::action(const gcn::ActionEvent &event)
new OkDialog(_("Particle effect settings changed"),
_("Restart your client or change maps for the change to take effect."));
}
- else if (event.getId() == "speechbubble")
+ else if (event.getId() == "speech")
{
- config.setValue("speechbubble",
- mSpeechBubbleCheckBox->isSelected() ? true : false);
+ int val = (int) mSpeechSlider->getValue();
+ switch (val)
+ {
+ case 0:
+ mSpeechLabel->setCaption(_("No text"));
+ break;
+ case 1:
+ mSpeechLabel->setCaption(_("Text"));
+ break;
+ case 2:
+ mSpeechLabel->setCaption(_("Bubbles, no names"));
+ break;
+ case 3:
+ mSpeechLabel->setCaption(_("Bubbles with names"));
+ break;
+ }
+ mSpeechSlider->setValue(val);
+ config.setValue("speech", val);
}
else if (event.getId() == "showownname")
{
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 303b5bfc..13735e0f 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -52,21 +52,29 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
bool mOpenGLEnabled;
bool mCustomCursorEnabled;
bool mParticleEffectsEnabled;
- bool mSpeechBubbleEnabled;
bool mNameEnabled;
double mOpacity;
int mFps;
+ int mSpeechMode;
class ModeListModel *mModeListModel;
+ gcn::Label *speechLabel;
+ gcn::Label *alphaLabel;
+ gcn::Label *scrollRadiusLabel;
+ gcn::Label *scrollLazinessLabel;
+ gcn::Label *overlayDetailLabel;
+ gcn::Label *particleDetailLabel;
+
gcn::ListBox *mModeList;
gcn::CheckBox *mFsCheckBox;
gcn::CheckBox *mOpenGLCheckBox;
gcn::CheckBox *mCustomCursorCheckBox;
gcn::CheckBox *mParticleEffectsCheckBox;
- gcn::CheckBox *mSpeechBubbleCheckBox;
gcn::CheckBox *mNameCheckBox;
+ gcn::Slider *mSpeechSlider;
+ gcn::Label *mSpeechLabel;
gcn::Slider *mAlphaSlider;
gcn::CheckBox *mFpsCheckBox;
gcn::Slider *mFpsSlider;
diff --git a/src/gui/shortcutcontainer.cpp b/src/gui/shortcutcontainer.cpp
index 4472818e..9fed040e 100644
--- a/src/gui/shortcutcontainer.cpp
+++ b/src/gui/shortcutcontainer.cpp
@@ -4,18 +4,18 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/gui/shortcutcontainer.h b/src/gui/shortcutcontainer.h
index f5f06163..b08c6d73 100644
--- a/src/gui/shortcutcontainer.h
+++ b/src/gui/shortcutcontainer.h
@@ -4,18 +4,18 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 03711a47..05b782d5 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -40,7 +40,8 @@
static const char *SKILLS_FILE = _("skills.xml");
-struct SkillInfo {
+struct SkillInfo
+{
std::string name;
bool modifiable;
};
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index dd404a63..c1451d51 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -73,20 +73,28 @@ void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color)
mCaption->setForegroundColor(color);
}
-void SpeechBubble::setText(std::string mText)
+void SpeechBubble::setText(std::string mText, bool showName)
{
- int width = mCaption->getWidth() + 3;
+ int width = mCaption->getWidth();
mSpeechBox->setTextWrapped(mText, 130 > width ? 130 : width);
const int fontHeight = getFont()->getHeight();
- const int numRows = mSpeechBox->getNumberOfRows() + 1;
+ const int numRows = showName ? mSpeechBox->getNumberOfRows() + 1 :
+ mSpeechBox->getNumberOfRows();
+ int yPos = showName ? fontHeight + 3 : 3;
+ int height = (numRows * fontHeight);
if (width < mSpeechBox->getMinWidth())
width = mSpeechBox->getMinWidth();
- setContentSize(width + fontHeight, (numRows * fontHeight) + 6);
- mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5,
- (numRows * fontHeight)));
+ if (numRows == 1)
+ {
+ yPos = (fontHeight / 4) + 3;
+ height = ((3 * fontHeight) / 2) + 1;
+ }
+
+ setContentSize(width + fontHeight, height + 6);
+ mSpeechArea->setDimension(gcn::Rectangle(4, yPos, width + 5, height));
}
unsigned int SpeechBubble::getNumRows()
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index d2d81332..323f6667 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -35,7 +35,7 @@ class SpeechBubble : public Window
void setCaption(const std::string &name,
const gcn::Color &color = 0x000000);
- void setText(std::string mText);
+ void setText(std::string mText, bool showName = true);
void setLocation(int x, int y);
unsigned int getNumRows();
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index 567272f0..76877c6b 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright (C) 2004 The Mana World Development Team
+ * Copyright (C) 2008 The Mana World Development Team
*
* This file is part of The Mana World.
*
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index 8e6636df..8481d80d 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <list>
-
#include <guichan/exception.hpp>
#include "truetypefont.h"
@@ -74,8 +72,6 @@ class TextChunk
gcn::Color color;
};
-// Word surfaces cache
-static std::list<TextChunk> cache;
typedef std::list<TextChunk>::iterator CacheIterator;
static int fontCounter;
diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h
index cd68a94e..3ab24248 100644
--- a/src/gui/truetypefont.h
+++ b/src/gui/truetypefont.h
@@ -22,6 +22,7 @@
#ifndef TRUETYPEFONT_H
#define TRUETYPEFONT_H
+#include <list>
#include <string>
#include <guichan/font.hpp>
@@ -31,6 +32,8 @@
#include <SDL_ttf.h>
#endif
+class TextChunk;
+
/**
* A wrapper around SDL_ttf for allowing the use of TrueType fonts.
*
@@ -65,6 +68,9 @@ class TrueTypeFont : public gcn::Font
private:
TTF_Font *mFont;
+
+ // Word surfaces cache
+ std::list<TextChunk> cache;
};
#endif
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 79d9ff06..6219d98e 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -4,18 +4,18 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index e5919dc7..4aba73dd 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -4,18 +4,18 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 5a0c0678..5d2d7797 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -95,7 +95,9 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
{"keyChatScrollUp", SDLK_PAGEUP, _("Scroll Chat Up")},
{"keyChatScrollDown", SDLK_PAGEDOWN, _("Scroll Chat Down")},
{"keyOK", SDLK_RETURN, _("Select OK")},
- {"keyQuit", SDLK_ESCAPE, _("Quit")}
+ {"keyQuit", SDLK_ESCAPE, _("Quit")},
+ {"keyIgnoreInput1", SDLK_LSUPER, _("Ignore input 1")},
+ {"keyIgnoreInput2", SDLK_RSUPER, _("Ignore input 2")}
};
void KeyboardConfig::init()
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 8949a48e..f7750b30 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -207,6 +207,8 @@ class KeyboardConfig
KEY_SCROLL_CHAT_DOWN,
KEY_OK,
KEY_QUIT,
+ KEY_IGNORE_INPUT_1,
+ KEY_IGNORE_INPUT_2,
KEY_TOTAL
};
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a02a8b1b..33f2f480 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -43,7 +43,6 @@
#include "net/protocol.h"
#include "resources/animation.h"
-#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
@@ -97,10 +96,10 @@ LocalPlayer::~LocalPlayer()
for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++)
{
- delete mTargetCursorInRange[i];
- delete mTargetCursorOutRange[i];
- mInRangeImages[i]->decRef();
- mOutRangeImages[i]->decRef();
+ delete mTargetCursor[0][i];
+ delete mTargetCursor[1][i];
+ mTargetCursorImages[0][i]->decRef();
+ mTargetCursorImages[1][i]->decRef();
}
}
@@ -121,33 +120,32 @@ void LocalPlayer::logic()
case WALK:
mFrame = (get_elapsed_time(mWalkTime) * 6) / mWalkSpeed;
- if (mFrame >= 6) {
+ if (mFrame >= 6)
nextStep();
- }
break;
case ATTACK:
int frames = 4;
- if ( mEquippedWeapon
- && mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW)
- {
+ if (mEquippedWeapon &&
+ mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW)
frames = 5;
- }
+
mFrame = (get_elapsed_time(mWalkTime) * frames) / mAttackSpeed;
- if (mFrame >= frames) {
+
+ if (mFrame >= frames)
nextStep();
- }
+
break;
}
// Actions are allowed once per second
- if (get_elapsed_time(mLastAction) >= 1000) {
+ if (get_elapsed_time(mLastAction) >= 1000)
mLastAction = -1;
- }
+
// Targeting allowed 4 times a second
- if (get_elapsed_time(mLastTarget) >= 250) {
+ if (get_elapsed_time(mLastTarget) >= 250)
mLastTarget = -1;
- }
+
// Remove target if its been on a being for more than a minute
if (get_elapsed_time(mTargetTime) >= 60000)
{
@@ -158,20 +156,20 @@ void LocalPlayer::logic()
if (mTarget)
{
+ // Find whether target is in range
+ const int rangeX = abs(mTarget->mX - mX);
+ const int rangeY = abs(mTarget->mY - mY);
+ const int attackRange = getAttackRange();
+ const int inRange = rangeX > attackRange || rangeY > attackRange ? 1 : 0;
+
+ mTarget->setTargetAnimation(
+ mTargetCursor[inRange][mTarget->getTargetCursorSize()]);
+
if (mTarget->mAction == DEAD)
- {
stopAttack();
- }
+
if (mKeepAttacking && mTarget)
- {
attack(mTarget, true);
- }
-
- for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++)
- {
- player_node->mTargetCursorInRange[i]->update(10);
- player_node->mTargetCursorOutRange[i]->update(10);
- }
}
Being::logic();
@@ -194,13 +192,9 @@ void LocalPlayer::setName(const std::string &name)
}
if (config.getValue("showownname", false) && mMapInitialized)
- {
Player::setName(name);
- }
else
- {
Being::setName(name);
- }
}
void LocalPlayer::nextStep()
@@ -208,15 +202,10 @@ void LocalPlayer::nextStep()
if (mPath.empty())
{
if (mPickUpTarget)
- {
pickUp(mPickUpTarget);
- }
if (mWalkingDir)
- {
walk(mWalkingDir);
- }
-
}
if (mGoingToTarget && mTarget && withinAttackRange(mTarget))
@@ -280,12 +269,15 @@ void LocalPlayer::pickUp(FloorItem *item)
int dx = item->getX() - mX;
int dy = item->getY() - mY;
- if (dx * dx + dy * dy < 4) {
+ if (dx * dx + dy * dy < 4)
+ {
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_ITEM_PICKUP);
outMsg.writeInt32(item->getId());
mPickUpTarget = NULL;
- } else {
+ }
+ else
+ {
setDestination(item->getX(), item->getY());
mPickUpTarget = item;
stopAttack();
@@ -341,27 +333,32 @@ void LocalPlayer::setTarget(Being *target)
{
if (mLastTarget != -1 || target == this)
return;
+
mLastTarget = tick_time;
- if (!target || target == mTarget)
- {
+ if (target == mTarget)
target = NULL;
- mKeepAttacking = false;
- mTargetTime = -1;
- }
- if (target)
+
+ if (target || mAction == ATTACK)
{
mTargetTime = tick_time;
}
- if (mTarget && mTarget->getType() == Being::MONSTER)
+ else
{
- static_cast<Monster *>(mTarget)->showName(false);
+ mKeepAttacking = false;
+ mTargetTime = -1;
}
+
+ if (mTarget)
+ mTarget->untarget();
+
+ if (mTarget && mTarget->getType() == Being::MONSTER)
+ static_cast<Monster *>(mTarget)->showName(false);
+
mTarget = target;
+
if (target && target->getType() == Being::MONSTER)
- {
static_cast<Monster *>(target)->showName(true);
- }
}
void LocalPlayer::setDestination(Uint16 x, Uint16 y)
@@ -541,7 +538,8 @@ void LocalPlayer::attack(Being *target, bool keep)
if (!soundFile.empty())
sound.playSfx(soundFile);
}
- else {
+ else
+ {
sound.playSfx("sfx/fist-swish.ogg");
}
@@ -551,9 +549,7 @@ void LocalPlayer::attack(Being *target, bool keep)
outMsg.writeInt8(0);
if (!keep)
- {
stopAttack();
- }
}
void LocalPlayer::stopAttack()
@@ -685,54 +681,19 @@ void LocalPlayer::loadTargetCursor(std::string filename, int width, int height,
currentImageSet = resman->getImageSet(filename, width, height);
Animation *anim = new Animation();
- for (unsigned int i = 0; i < currentImageSet->size(); ++i)
- {
- anim->addFrame(currentImageSet->get(i), 75, 0, 0);
- }
- currentCursor = new SimpleAnimation(anim);
- if (outRange)
- {
- mOutRangeImages[size] = currentImageSet;
- mTargetCursorOutRange[size] = currentCursor;
- }
- else
+ for (unsigned int i = 0; i < currentImageSet->size(); ++i)
{
- mInRangeImages[size] = currentImageSet;
- mTargetCursorInRange[size] = currentCursor;
+ anim->addFrame(currentImageSet->get(i), 75,
+ (16 - (currentImageSet->getWidth() / 2)),
+ (16 - (currentImageSet->getHeight() / 2)));
}
-}
-
-void LocalPlayer::drawTargetCursor(Graphics *graphics, int scrollX, int scrollY)
-{
-
- // Draw target marker if needed
- if (mTarget)
- {
- // Calculate target circle position
-
- // Find whether target is in range
- int rangeX = abs(mTarget->mX - mX);
- int rangeY = abs(mTarget->mY - mY);
- int attackRange = getAttackRange();
- // Get the correct target cursors graphic
- TargetCursorSize cursorSize = mTarget->getTargetCursorSize();
-
- if (rangeX > attackRange || rangeY > attackRange)
- {
- mTarget->mTargetCursor = mTargetCursorOutRange[cursorSize]->getCurrentImage();
- }
- else
- {
- mTarget->mTargetCursor = mTargetCursorInRange[cursorSize]->getCurrentImage();
- }
+ currentCursor = new SimpleAnimation(anim);
- // Draw the target cursor at the correct position
- int posX = mTarget->getPixelX() + 16 - mTarget->mTargetCursor->getWidth() / 2 - scrollX;
- int posY = mTarget->getPixelY() + 16 - mTarget->mTargetCursor->getHeight() / 2 - scrollY;
+ const int index = outRange ? 1 : 0;
- graphics->drawImage(mTarget->mTargetCursor, posX, posY);
- }
- return;
+ mTargetCursorImages[index][size] = currentImageSet;
+ mTargetCursor[index][size] = currentCursor;
}
+
diff --git a/src/localplayer.h b/src/localplayer.h
index c128f4a4..4d0a05be 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -40,7 +40,6 @@ class Inventory;
class Item;
class Map;
class Network;
-class SimpleAnimation;
/**
* The local player character.
@@ -232,14 +231,6 @@ class LocalPlayer : public Player
float mLastAttackTime; /**< Used to synchronize the charge dialog */
- void drawTargetCursor(Graphics *graphics, int offsetX, int offsetY);
-
- /** Animated in range target cursor. */
- SimpleAnimation *mTargetCursorInRange[NUM_TC];
-
- /** Animated out of range target cursor. */
- SimpleAnimation *mTargetCursorOutRange[NUM_TC];
-
const std::auto_ptr<Equipment> mEquipment;
protected:
@@ -270,20 +261,20 @@ class LocalPlayer : public Player
Inventory *mInventory;
Inventory *mStorage;
+ // Load the target cursors into memory
+ void initTargetCursor();
+
/**
* Helper function for loading target cursors
*/
void loadTargetCursor(std::string filename, int width, int height,
bool outRange, Being::TargetCursorSize size);
- /** Images of in range target cursor. */
- ImageSet *mInRangeImages[NUM_TC];
-
- /** Images of out of range target cursor. */
- ImageSet *mOutRangeImages[NUM_TC];
+ /** Images of the target cursor. */
+ ImageSet *mTargetCursorImages[2][NUM_TC];
- // Load the target cursors into memory
- void initTargetCursor();
+ /** Animated target cursors. */
+ SimpleAnimation *mTargetCursor[2][NUM_TC];
};
extern LocalPlayer *player_node;
diff --git a/src/main.cpp b/src/main.cpp
index 54320433..a9cf5abf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -497,7 +497,8 @@ void printHelp()
<< _("Options: ") << std::endl
<< _(" -C --configfile : Configuration file to use") << std::endl
<< _(" -d --data : Directory to load game data from") << std::endl
- << _(" -D --default : Bypass the login process with default settings") << std::endl
+ << _(" -D --default : Bypass the login process with default settings")
+ << std::endl
<< _(" -h --help : Display this help") << std::endl
<< _(" -S --homedir : Directory to use as home directory") << std::endl
<< _(" -H --updatehost : Use this update host") << std::endl
@@ -514,7 +515,7 @@ void printVersion()
std::cout << _("The Mana World version ") << PACKAGE_VERSION << std::endl;
#else
std::cout << _("The Mana World version ") <<
- _"(local build?, PACKAGE_VERSION is not defined)") << std::endl;
+ _("(local build?, PACKAGE_VERSION is not defined)") << std::endl;
#endif
}
@@ -676,7 +677,8 @@ void charLogin(Network *network, LoginData *loginData)
outMsg.writeInt32(loginData->account_ID);
outMsg.writeInt32(loginData->session_ID1);
outMsg.writeInt32(loginData->session_ID2);
- // [Fate] The next word is unused by the old char server, so we squeeze in tmw client version information
+ // [Fate] The next word is unused by the old char server, so we squeeze in
+ // tmw client version information
outMsg.writeInt16(CLIENT_PROTOCOL_VERSION);
outMsg.writeInt8(loginData->sex);
diff --git a/src/main.h b/src/main.h
index 42696568..1d984661 100644
--- a/src/main.h
+++ b/src/main.h
@@ -29,7 +29,7 @@
#elif defined WIN32
#include "winver.h"
#elif defined __APPLE__
-#define PACKAGE_VERSION "0.0.28.1"
+#define PACKAGE_VERSION "0.0.29"
#endif
#ifndef PKG_DATADIR
diff --git a/src/map.cpp b/src/map.cpp
index b5e815f3..4bbde186 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -25,9 +25,9 @@
#include "configuration.h"
#include "game.h"
#include "graphics.h"
-#include "localplayer.h"
#include "map.h"
#include "particle.h"
+#include "simpleanimation.h"
#include "sprite.h"
#include "tileset.h"
@@ -63,30 +63,35 @@ struct Location
};
TileAnimation::TileAnimation(Animation *ani):
- mAnimation(ani),
mLastImage(NULL)
{
+ mAnimation = new SimpleAnimation(ani);
}
+TileAnimation::~TileAnimation()
+{
+ delete mAnimation;
+}
void TileAnimation::update()
{
+ if (!mAnimation)
+ return;
+
//update animation
- mAnimation.update(1);
+ mAnimation->update(1);
// exchange images
- Image *img = mAnimation.getCurrentImage();
+ Image *img = mAnimation->getCurrentImage();
if (img != mLastImage)
{
- for (std::list<std::pair<MapLayer*, int> >::iterator i = mAffected.begin();
- i != mAffected.end();
- i++)
+ for (std::list<std::pair<MapLayer*, int> >::iterator i =
+ mAffected.begin(); i != mAffected.end(); i++)
{
i->first->setTile(i->second, img);
}
mLastImage = img;
}
-
}
MapLayer::MapLayer(int x, int y, int width, int height, bool isFringeLayer):
@@ -136,9 +141,10 @@ void MapLayer::draw(Graphics *graphics,
{
// If drawing the fringe layer, make sure all sprites above this row of
// tiles have been drawn
- if (mIsFringeLayer) {
- player_node->drawTargetCursor(graphics, scrollX, scrollY);
- while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32) {
+ if (mIsFringeLayer)
+ {
+ while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32)
+ {
(*si)->draw(graphics, -scrollX, -scrollY);
si++;
}
@@ -147,7 +153,8 @@ void MapLayer::draw(Graphics *graphics,
for (int x = startX; x < endX; x++)
{
Image *img = getTile(x, y);
- if (img) {
+ if (img)
+ {
const int px = (x + mX) * 32 - scrollX;
const int py = (y + mY) * 32 - scrollY + 32 - img->getHeight();
graphics->drawImage(img, px, py);
diff --git a/src/map.h b/src/map.h
index 3beab350..9703c5b3 100644
--- a/src/map.h
+++ b/src/map.h
@@ -27,7 +27,6 @@
#include "position.h"
#include "properties.h"
-#include "simpleanimation.h"
class Animation;
class AmbientOverlay;
@@ -35,6 +34,7 @@ class Graphics;
class Image;
class MapLayer;
class Particle;
+class SimpleAnimation;
class Sprite;
class Tileset;
@@ -72,13 +72,14 @@ class TileAnimation
{
public:
TileAnimation(Animation *ani);
+ ~TileAnimation();
void update();
void addAffectedTile(MapLayer *layer, int index)
{ mAffected.push_back(std::make_pair(layer, index)); }
private:
std::list<std::pair<MapLayer*, int> > mAffected;
- SimpleAnimation mAnimation;
- Image* mLastImage;
+ SimpleAnimation *mAnimation;
+ Image *mLastImage;
};
/**
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index d3ba4b03..f757308c 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -34,7 +34,6 @@
#include "../log.h"
#include "../npc.h"
#include "../player_relations.h"
-#include "../sound.h"
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
index fe7db55d..ad48460d 100644
--- a/src/net/partyhandler.cpp
+++ b/src/net/partyhandler.cpp
@@ -1,15 +1,15 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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.
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index 048da9b1..25a63da9 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -1,15 +1,15 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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.
diff --git a/src/party.cpp b/src/party.cpp
index 589aa9b1..5cebdf35 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -1,21 +1,21 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/party.h b/src/party.h
index 98252c37..2b3b72b7 100644
--- a/src/party.h
+++ b/src/party.h
@@ -1,21 +1,21 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program 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,
+ * This program 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
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp
deleted file mode 100644
index 719ecab1..00000000
--- a/src/resources/buddylist.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * The Mana World
- * Copyright (C) 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <algorithm>
-#include <cstring>
-#include <fstream>
-#include <iostream>
-
-#include "buddylist.h"
-
-#include "../configuration.h"
-#include "../main.h"
-
-BuddyList::BuddyList()
-{
- // TODO: A buddy list would have to use the Configuration class to store
- // the buddies. Also, there is now a player relationship manager
- // which probably makes this buddy list kind of obsolete.
-
- // Find saved buddy list file
- //mFilename = homeDir + "/buddy.txt";
-
- // Load buddy from file
- loadFile();
-}
-
-void BuddyList::loadFile()
-{
- // Open file
- std::ifstream inputStream(mFilename.c_str(), std::ios::in);
- if (!inputStream) {
- std::cerr << "Error opening input stream" << std::endl;
- return;
- }
-
- do {
- char *buddy = new char[LEN_MAX_USERNAME];
- inputStream.getline(buddy, LEN_MAX_USERNAME);
- // Ugly ?
- if (strcmp(buddy, "")) mBuddylist.push_back(buddy);
- delete [] buddy;
- } while (!inputStream.eof());
-
- // Read buddy and close file
- inputStream.close();
-}
-
-void BuddyList::saveFile()
-{
- std::string str;
-
- // Open file
- std::ofstream outputStream(mFilename.c_str(), std::ios::trunc);
- if (!outputStream) {
- std::cerr << "Error opening output stream" << std::endl;
- return;
- }
-
- // Write buddy and close file
- for (BuddyIterator i = mBuddylist.begin(); i != mBuddylist.end(); ++i)
- {
- outputStream << (const char*) i->c_str() << std::endl;
- }
- outputStream.close();
-}
-
-bool BuddyList::addBuddy(const std::string buddy)
-{
- if (find(mBuddylist.begin(), mBuddylist.end(), buddy) != mBuddylist.end())
- {
- return false;
- }
-
- // Buddy doesnt exist, add it
- mBuddylist.push_back(buddy);
-
- // Save file
- saveFile();
-
- return true;
-}
-
-bool BuddyList::removeBuddy(const std::string buddy)
-{
- BuddyIterator i = find(mBuddylist.begin(), mBuddylist.end(), buddy);
-
- if (i != mBuddylist.end()) {
- mBuddylist.erase(i);
- saveFile();
- return true;
- }
-
- return false;
-}
-
-int BuddyList::getNumberOfElements()
-{
- return mBuddylist.size();
-}
-
-std::string BuddyList::getElementAt(int number)
-{
- if (number >= (int) mBuddylist.size()) {
- return "";
- }
-
- BuddyIterator i = mBuddylist.begin();
- std::advance(i, number);
- return *i;
-}
diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h
deleted file mode 100644
index f0758c25..00000000
--- a/src/resources/buddylist.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * The Mana World
- * Copyright (C) 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef BUDDYLIST_H
-#define BUDDYLIST_H
-
-#include <list>
-#include <string>
-
-#include <guichan/listmodel.hpp>
-
-class BuddyList : public gcn::ListModel
-{
- public:
- /**
- * Constructor
- */
- BuddyList();
-
- /**
- * Destructor
- */
- virtual ~BuddyList() { }
-
- /**
- * Adds buddy to the list
- */
- bool addBuddy(const std::string buddy);
-
- /**
- * Removes buddy from the list
- */
- bool removeBuddy(const std::string buddy);
-
- /**
- * Returns the number of buddy on the list
- */
- int getNumberOfElements();
-
- /**
- * Returns the buddy of the number or null
- */
- std::string getElementAt(int number);
-
- private:
- /**
- * Save buddy to file
- */
- void saveFile();
-
- /**
- * Load buddy from file
- */
- void loadFile();
-
- typedef std::list<std::string> Buddies;
- typedef Buddies::iterator BuddyIterator;
- Buddies mBuddylist; /**< Buddy list */
- std::string mFilename; /* File to work with */
-};
-
-#endif /* BUDDYLIST_H */
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index 77c3c2fb..5e9a146c 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -1,6 +1,6 @@
/*
* Emote database
- * Copyright (C) 2008 Aethyra Development Team
+ * Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The Mana World.
*
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index 2cf3af62..ad21722a 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -1,6 +1,6 @@
/*
* Emote database
- * Copyright (C) 2008 Aethyra Development Team
+ * Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The Mana World.
*
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 6fa010d4..47538b87 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -62,7 +62,7 @@ void ItemDB::load()
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items"))
{
- logger->error(_("ItemDB: Error while loading items.xml!"));
+ logger->error("ItemDB: Error while loading items.xml!");
}
for_each_xml_child_node(node, rootNode)
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 15451c95..25a3102c 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -50,7 +50,7 @@ void MonsterDB::load()
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters"))
{
- logger->error(_("Monster Database: Error while loading monster.xml!"));
+ logger->error("Monster Database: Error while loading monster.xml!");
}
//iterate <monster>s
@@ -63,7 +63,7 @@ void MonsterDB::load()
MonsterInfo *currentInfo = new MonsterInfo();
- currentInfo->setName (XML::getProperty(monsterNode, "name", "unnamed"));
+ currentInfo->setName(XML::getProperty(monsterNode, "name", _("unnamed")));
std::string targetCursor;
targetCursor = XML::getProperty(monsterNode, "targetCursor", "medium");
diff --git a/src/resources/music.h b/src/resources/music.h
index 65f1ee88..34907cf1 100644
--- a/src/resources/music.h
+++ b/src/resources/music.h
@@ -22,8 +22,11 @@
#ifndef MUSIC_H
#define MUSIC_H
+#ifdef __APPLE__
+#include <SDL_mixer/SDL_mixer.h>
+#else
#include <SDL_mixer.h>
-
+#endif
#include "resource.h"
/**
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index 116df930..fc2d4a69 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -22,7 +22,11 @@
#ifndef SOUND_EFFECT_H
#define SOUND_EFFECT_H
+#ifdef __APPLE__
+#include <SDL_mixer/SDL_mixer.h>
+#else
#include <SDL_mixer.h>
+#endif
#include "resource.h"
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 48f2f6a5..87ef69e3 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -19,6 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "graphics.h"
#include "log.h"
#include "simpleanimation.h"
@@ -112,17 +113,34 @@ SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
mCurrentFrame = mAnimation->getFrame(0);
}
+bool SimpleAnimation::draw(Graphics* graphics, int posX, int posY) const
+{
+ if (!mCurrentFrame || !mCurrentFrame->image)
+ return false;
+
+ return graphics->drawImage(mCurrentFrame->image,
+ posX + mCurrentFrame->offsetX,
+ posY + mCurrentFrame->offsetY);
+}
+
+void SimpleAnimation::reset()
+{
+ mAnimationTime = 0;
+ mAnimationPhase = 0;
+}
+
void SimpleAnimation::update(unsigned int timePassed)
{
mAnimationTime += timePassed;
- while (mAnimationTime > mCurrentFrame->delay)
+
+ while (mAnimationTime > mCurrentFrame->delay && mCurrentFrame->delay > 0)
{
mAnimationTime -= mCurrentFrame->delay;
mAnimationPhase++;
+
if (mAnimationPhase >= mAnimation->getLength())
- {
mAnimationPhase = 0;
- }
+
mCurrentFrame = mAnimation->getFrame(mAnimationPhase);
}
}
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index 16ac2906..e48644d4 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -50,6 +50,13 @@ class SimpleAnimation
void update(unsigned int timePassed);
+ bool draw(Graphics* graphics, int posX, int posY) const;
+
+ /**
+ * Resets the animation.
+ */
+ void reset();
+
Image *getCurrentImage() const;
private:
diff --git a/src/sound.h b/src/sound.h
index 05b2def3..4dd68870 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -22,7 +22,11 @@
#ifndef SOUND_H
#define SOUND_H
+#ifdef __APPLE__
+#include <SDL_mixer/SDL_mixer.h>
+#else
#include <SDL_mixer.h>
+#endif
#include <string>
/** Sound engine
diff --git a/src/text.cpp b/src/text.cpp
index c4559879..cb4587d3 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -150,20 +150,16 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff)
graphics->setColor(gcn::Color(0, 0, 0));
graphics->drawText(mText, mX - xOff + 1, mY - yOff,
gcn::Graphics::LEFT);
-
graphics->drawText(mText, mX - xOff - 1, mY - yOff,
gcn::Graphics::LEFT);
-
graphics->drawText(mText, mX - xOff, mY - yOff + 1,
gcn::Graphics::LEFT);
-
graphics->drawText(mText, mX - xOff, mY - yOff - 1,
gcn::Graphics::LEFT);
}
graphics->setColor(mColor);
- graphics->drawText(mText, mX - xOff, mY - yOff,
- gcn::Graphics::LEFT);
+ graphics->drawText(mText, mX - xOff, mY - yOff, gcn::Graphics::LEFT);
}
FlashText::FlashText(const std::string &text, int x, int y,
diff --git a/src/tmw.rc b/src/tmw.rc
index 9661ac6b..d9689f28 100644
--- a/src/tmw.rc
+++ b/src/tmw.rc
@@ -13,7 +13,7 @@ FILETYPE VFT_APP {
VALUE "CompanyName", "The Mana World Development Team"
VALUE "FileVersion", PACKAGE_VERSION
VALUE "FileDescription", "The Mana World"
- VALUE "LegalCopyright", "2004-2006 (C)"
+ VALUE "LegalCopyright", "2004-2009 (C)"
VALUE "OriginalFilename", "tmw.exe"
VALUE "ProductName", "The Mana World MMORPG"
VALUE "ProductVersion", PACKAGE_VERSION
diff --git a/src/utils/tostring.h b/src/utils/tostring.h
index 62eb44e4..28d8c521 100644
--- a/src/utils/tostring.h
+++ b/src/utils/tostring.h
@@ -32,8 +32,6 @@ std::string toString(const T &arg)
return ss.str();
}
-// TODO: Is there a good way to suppress warnings from classes which don't use
-// this function?
inline char *iptostring(int address)
{
static char asciiIP[16];
diff --git a/src/winver.h b/src/winver.h
index 5f0e1fb2..4996bdfb 100644
--- a/src/winver.h
+++ b/src/winver.h
@@ -1,6 +1,6 @@
/* VERSION DEFINITIONS */
#define VER_MAJOR 0
#define VER_MINOR 0
-#define VER_RELEASE 28
-#define VER_BUILD 1
-#define PACKAGE_VERSION "0.0.28.1"
+#define VER_RELEASE 29
+#define VER_BUILD 0
+#define PACKAGE_VERSION "0.0.29"
diff --git a/tmw.cbp b/tmw.cbp
index b559b03c..9b0c54bc 100644
--- a/tmw.cbp
+++ b/tmw.cbp
@@ -358,8 +358,6 @@
<Unit filename="src\resources\ambientoverlay.h" />
<Unit filename="src\resources\animation.cpp" />
<Unit filename="src\resources\animation.h" />
- <Unit filename="src\resources\buddylist.cpp" />
- <Unit filename="src\resources\buddylist.h" />
<Unit filename="src\resources\colordb.cpp" />
<Unit filename="src\resources\colordb.h" />
<Unit filename="src\resources\dye.cpp" />