summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLloyd Bryant <lloyd_bryant@netzero.net>2008-08-13 15:02:59 +0000
committerLloyd Bryant <lloyd_bryant@netzero.net>2008-08-13 15:02:59 +0000
commit94024e2b57b31ee92bb81fc48ce236283330b60c (patch)
treea526015cfcdd33c3482b710dc4fa22bbec4e0090
parentc9175a4d140f4c852aa5195b72ad9bd1ae8d5cee (diff)
downloadmana-94024e2b57b31ee92bb81fc48ce236283330b60c.tar.gz
mana-94024e2b57b31ee92bb81fc48ce236283330b60c.tar.bz2
mana-94024e2b57b31ee92bb81fc48ce236283330b60c.tar.xz
mana-94024e2b57b31ee92bb81fc48ce236283330b60c.zip
Added support for different colored fonts for different being types
-rw-r--r--ChangeLog7
-rw-r--r--data/graphics/gui/Makefile.am3
-rw-r--r--data/graphics/gui/rpgfont_wider-blue.pngbin0 -> 4475 bytes
-rw-r--r--data/graphics/gui/rpgfont_wider-green.pngbin0 -> 4423 bytes
-rw-r--r--data/graphics/gui/rpgfont_wider-orange.pngbin0 -> 4415 bytes
-rw-r--r--src/being.cpp1
-rw-r--r--src/being.h4
-rw-r--r--src/gui/gui.cpp47
-rw-r--r--src/gui/gui.h8
-rw-r--r--src/monster.cpp2
-rw-r--r--src/net/beinghandler.cpp6
-rw-r--r--src/npc.cpp2
-rw-r--r--src/player.cpp13
13 files changed, 86 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 2bb8660f..171295d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-13 Lloyd Bryant ("Sanga") <sanga@aethyra.com>
+
+ * Added code to display NPC and monster names using an
+ alternate colored font. Added support for a server
+ provided "GM flag", which prepends "(GM)" to the player's
+ name and changes the font color.
+
2008-08-08 Lloyd Bryant ("Sanga") <lloyd_bryant@netzero.net>
* Made "--skipupdate" skip the update download process, but
diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am
index cfa14192..ec99fdf6 100644
--- a/data/graphics/gui/Makefile.am
+++ b/data/graphics/gui/Makefile.am
@@ -32,6 +32,9 @@ gui_DATA = \
radioout.png \
resize.png \
rpgfont_wider.png \
+ rpgfont_wider-blue.png \
+ rpgfont_wider-green.png \
+ rpgfont_wider-orange.png \
selection.png \
sansserif8.png \
slider.png \
diff --git a/data/graphics/gui/rpgfont_wider-blue.png b/data/graphics/gui/rpgfont_wider-blue.png
new file mode 100644
index 00000000..4cd45c5c
--- /dev/null
+++ b/data/graphics/gui/rpgfont_wider-blue.png
Binary files differ
diff --git a/data/graphics/gui/rpgfont_wider-green.png b/data/graphics/gui/rpgfont_wider-green.png
new file mode 100644
index 00000000..00098746
--- /dev/null
+++ b/data/graphics/gui/rpgfont_wider-green.png
Binary files differ
diff --git a/data/graphics/gui/rpgfont_wider-orange.png b/data/graphics/gui/rpgfont_wider-orange.png
new file mode 100644
index 00000000..18dd67e9
--- /dev/null
+++ b/data/graphics/gui/rpgfont_wider-orange.png
Binary files differ
diff --git a/src/being.cpp b/src/being.cpp
index 14f7ce20..822bc647 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -82,6 +82,7 @@ Being::Being(int id, int job, Map *map):
instances++;
mSpeech = 0;
+ mIsGM = false;
}
Being::~Being()
diff --git a/src/being.h b/src/being.h
index 90bab9ac..7f68c8c3 100644
--- a/src/being.h
+++ b/src/being.h
@@ -233,6 +233,9 @@ class Being : public Sprite
virtual void
nextStep();
+ virtual void
+ setGM() { mIsGM = true; }
+
/**
* Performs being logic.
*/
@@ -382,6 +385,7 @@ class Being : public Sprite
Map *mMap; /**< Map on which this being resides */
std::string mName; /**< Name of character */
SpriteIterator mSpriteIterator;
+ bool mIsGM;
/** Engine-related infos about weapon. */
const ItemInfo* mEquippedWeapon;
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index e56afc76..edc25152 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -56,6 +56,13 @@ gcn::Font *hitYellowFont;
// Font used to display speech and player names
gcn::Font *speechFont;
+// Font for displaying NPC names
+gcn::Font *npcNameFont;
+// Font for displaying mob names
+gcn::Font *mobNameFont;
+// Font for displaying GM names
+gcn::Font *gmNameFont;
+
class GuiConfigListener : public ConfigListener
{
public:
@@ -128,6 +135,46 @@ Gui::Gui(Graphics *graphics):
logger->error("Unable to load rpgfont_wider.png!");
}
+ // Set npc name font
+ try {
+ npcNameFont = new gcn::ImageFont("graphics/gui/rpgfont_wider-blue.png",
+ " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
+ "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
+ );
+ }
+ catch (gcn::Exception e)
+ {
+ logger->error("Unable to load rpgfont_wider-blue.png!");
+ }
+
+ // Set monster name font
+ try {
+ mobNameFont = new gcn::ImageFont("graphics/gui/rpgfont_wider-orange.png",
+ " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
+ "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
+ );
+ }
+ catch (gcn::Exception e)
+ {
+ logger->error("Unable to load rpgfont_wider-orange.png!");
+ }
+
+ // Set GM name font
+ try {
+ gmNameFont = new gcn::ImageFont("graphics/gui/rpgfont_wider-green.png",
+ " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
+ "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
+ );
+ }
+ catch (gcn::Exception e)
+ {
+ logger->error("Unable to load rpgfont_wider-green.png!");
+ }
+
+
gcn::Widget::setGlobalFont(mGuiFont);
// Load hits' colourful fonts
diff --git a/src/gui/gui.h b/src/gui/gui.h
index d2a832c7..f250a8e3 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -119,4 +119,12 @@ extern gcn::Font *hitYellowFont;
*/
extern gcn::Font *speechFont;
+/**
+ * being name fonts
+ */
+extern gcn::Font *npcNameFont;
+extern gcn::Font *mobNameFont;
+extern gcn::Font *gmNameFont;
+
+
#endif
diff --git a/src/monster.cpp b/src/monster.cpp
index 1a7f6c4e..5d62a9cc 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -168,7 +168,7 @@ void Monster::showName(bool show)
mText = new Text(getInfo().getName(), mPx + NAME_X_OFFSET,
mPy + NAME_Y_OFFSET - getHeight(),
gcn::Graphics::CENTER,
- speechFont, gcn::Color(255, 32, 32));
+ mobNameFont, gcn::Color(255, 32, 32));
}
else
{
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index a8591fce..34c65d1c 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -71,6 +71,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
Uint16 headTop, headMid, headBottom;
Uint16 shoes, gloves, cape, misc1, misc2;
Uint16 weapon, shield;
+ Uint16 gmstatus;
Sint16 param1;
Sint8 type;
Being *srcBeing, *dstBeing;
@@ -443,8 +444,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setDirection(dir);
}
- msg->readInt8(); // unknown
- msg->readInt8(); // unknown
+ gmstatus = msg->readInt16();
+ if (gmstatus & 0x01)
+ dstBeing->setGM();
if (msg->getId() == SMSG_PLAYER_UPDATE_1)
{
diff --git a/src/npc.cpp b/src/npc.cpp
index ec7088ab..1615ecd6 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -84,7 +84,7 @@ void NPC::setName(const std::string &name)
delete mName;
}
mName = new Text(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
- gcn::Graphics::CENTER, speechFont,
+ gcn::Graphics::CENTER, npcNameFont,
gcn::Color(200, 200, 255));
}
diff --git a/src/player.cpp b/src/player.cpp
index 5db009ba..0740c7db 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -43,6 +43,7 @@ Player::Player(int id, int job, Map *map):
Being(id, job, map)
{
mName = 0;
+ mIsGM = false;
}
Player::~Player()
@@ -57,9 +58,15 @@ void Player::setName(const std::string &name)
{
if (mName == 0)
{
- mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
- gcn::Graphics::CENTER,
- speechFont, gcn::Color(255, 255, 255));
+ if (mIsGM) {
+ mName = new FlashText("(GM) " + name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
+ gcn::Graphics::CENTER,
+ gmNameFont, gcn::Color(255, 255, 255));
+ } else {
+ mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
+ gcn::Graphics::CENTER,
+ speechFont, gcn::Color(255, 255, 255));
+ }
Being::setName(name);
}
}