summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-02-06 18:17:09 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-02-06 18:17:09 +0000
commit5ec4143bde0fd67c7aca841804a5d165c794bdf0 (patch)
tree4ecfaf02a2f1831d545d21de3385b34b6c8c4388
parent49ea67bae1d2969c21005c06bb764f3c6b479e9c (diff)
downloadmana-client-5ec4143bde0fd67c7aca841804a5d165c794bdf0.tar.gz
mana-client-5ec4143bde0fd67c7aca841804a5d165c794bdf0.tar.bz2
mana-client-5ec4143bde0fd67c7aca841804a5d165c794bdf0.tar.xz
mana-client-5ec4143bde0fd67c7aca841804a5d165c794bdf0.zip
Added minimal minimap
-rw-r--r--The Mana World.dev22
-rw-r--r--docs/items.txt2
-rw-r--r--file.list1
-rw-r--r--src/graphic/graphic.cpp6
-rw-r--r--src/gui/minimap.cpp84
-rw-r--r--src/gui/minimap.h51
6 files changed, 165 insertions, 1 deletions
diff --git a/The Mana World.dev b/The Mana World.dev
index dd92f4e5..00f75a91 100644
--- a/The Mana World.dev
+++ b/The Mana World.dev
@@ -1,7 +1,7 @@
[Project]
FileName=The Mana World.dev
Name=tmw
-UnitCount=96
+UnitCount=98
Type=0
Ver=1
ObjFiles=
@@ -1016,3 +1016,23 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
+[Unit97]
+FileName=src\gui\minimap.h
+CompileCpp=1
+Folder=gui
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit98]
+FileName=src\gui\minimap.cpp
+CompileCpp=1
+Folder=gui
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
diff --git a/docs/items.txt b/docs/items.txt
index 7301c6ad..3ebccb1f 100644
--- a/docs/items.txt
+++ b/docs/items.txt
@@ -31,3 +31,5 @@ of items. An item can have the following properties:
Every being will have a variable number of slots to equip items. For a player
we will have 6 slots: head, upper body, lower body, feet, left hand, right
hand.
+To equip an item you should go to the inventory, select the desired item and push the "Equip"
+button. To uneqip, push the "Unequip" button in the equipment window. Unequipped items should automatically go back in the inventory. \ No newline at end of file
diff --git a/file.list b/file.list
index 168de561..053f8381 100644
--- a/file.list
+++ b/file.list
@@ -14,6 +14,7 @@ MODULES = src/sound/sound.cpp \
src/gui/itemcontainer.cpp \
src/gui/listbox.cpp \
src/gui/login.cpp \
+ src/gui/minimap.cpp \
src/gui/npc.cpp \
src/gui/npc_text.cpp \
src/gui/ok_dialog.cpp \
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 591c7443..99a7c319 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -25,6 +25,7 @@
#include "../gui/gui.h"
#include "../gui/textfield.h"
#include "../gui/status.h"
+#include "../gui/minimap.h"
#include "../main.h"
#include "../being.h"
@@ -53,6 +54,7 @@ NpcTextDialog *npcTextDialog;
SkillDialog *skillDialog;
StatsWindow *statsWindow;
Setup* setupWindow;
+Minimap *minimap;
void ChatListener::action(const std::string& eventId)
{
@@ -266,6 +268,10 @@ Engine::Engine()
setupWindow = new Setup();
setupWindow->setVisible(false);
+
+ // Create minimap
+
+ minimap = new Minimap();
// Give focus to the chat input
chatInput->requestFocus();
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
new file mode 100644
index 00000000..a1104b8a
--- /dev/null
+++ b/src/gui/minimap.cpp
@@ -0,0 +1,84 @@
+/*
+ * The Mana World
+ * Copyright 2004-2005 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $IdS
+ */
+
+#define MINIMAP_W 100
+#define MINIMAP_H 100
+
+#include "minimap.h"
+#include "../being.h"
+
+Minimap::Minimap()
+{
+ setSize(MINIMAP_W, MINIMAP_H);
+ setPosition(20, 20);
+
+ mapBackground = SDL_AllocSurface(SDL_SWSURFACE, MINIMAP_W, MINIMAP_H,
+ (screen->format->BytesPerPixel*8), 0, 0, 0, 0);
+ Uint32 mapColor = SDL_MapRGB(screen->format, 255, 255, 255);
+ SDL_Rect sourceRect;
+ sourceRect.x = sourceRect.y = 0;
+ sourceRect.w = MINIMAP_W;
+ sourceRect.h = MINIMAP_H;
+ if ( mapBackground )
+ {
+ SDL_FillRect(mapBackground, &sourceRect, mapColor);
+ SDL_SetAlpha(mapBackground, SDL_SRCALPHA, 120);
+ }
+}
+
+void Minimap::draw(gcn::Graphics *graphics)
+{
+ int x, y;
+
+ getAbsolutePosition(x, y);
+
+ if ( (mapBackground->w != getWidth()) || (mapBackground->h != getHeight()) )
+ {
+ SDL_FreeSurface(mapBackground);
+ mapBackground = SDL_AllocSurface(SDL_SWSURFACE, getWidth(), getHeight(),
+ (screen->format->BytesPerPixel*8), 0, 0, 0, 0);
+ Uint32 mapColor = SDL_MapRGB(screen->format, 52, 149, 210);
+ SDL_Rect sourceRect;
+ sourceRect.x = sourceRect.y = 0;
+ sourceRect.w = getWidth();
+ sourceRect.h = getHeight();
+ if ( mapBackground )
+ {
+ SDL_FillRect(mapBackground, &sourceRect, mapColor);
+ SDL_SetAlpha(mapBackground, SDL_SRCALPHA, 120);
+ }
+
+ }
+
+ SDL_Rect screenRect;
+ screenRect.w = getWidth();
+ screenRect.h = getHeight();
+ screenRect.x = x;
+ screenRect.y = y;
+ if ( mapBackground ) SDL_BlitSurface(mapBackground, NULL, screen, &screenRect);
+
+ graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
+ graphics->setColor(gcn::Color(209, 52, 61));
+ graphics->fillRectangle(gcn::Rectangle(player_node->x /2,
+ player_node->y / 2, 3, 3));
+} \ No newline at end of file
diff --git a/src/gui/minimap.h b/src/gui/minimap.h
new file mode 100644
index 00000000..08a39fb6
--- /dev/null
+++ b/src/gui/minimap.h
@@ -0,0 +1,51 @@
+/*
+ * The Mana World
+ * Copyright 2004-2005 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef _TMW_MINIMAP_H
+#define _TMW_MINIMAP_H
+
+#include "gui.h"
+#include "window.h"
+
+/**
+ * Minimap dialog.
+ *
+ * \ingroup GUI
+ */
+class Minimap : public Window {
+ public:
+ /**
+ * Constructor.
+ */
+ Minimap();
+
+ /**
+ * Draws the minimap.
+ */
+ void draw(gcn::Graphics *graphics);
+
+ // The Alpha-Blended Surface for the background transluency effect.
+ SDL_Surface *mapBackground;
+};
+
+#endif