summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-01 18:18:24 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-01 18:18:24 +0000
commit84a403f0a0590ebc11f66955e864c12886da5815 (patch)
tree628d49ac79ea159ba0109eb8817cfd9144dbab13
parente02192d7d1a34088d66072a60cf3ed57d638a695 (diff)
downloadmana-84a403f0a0590ebc11f66955e864c12886da5815.tar.gz
mana-84a403f0a0590ebc11f66955e864c12886da5815.tar.bz2
mana-84a403f0a0590ebc11f66955e864c12886da5815.tar.xz
mana-84a403f0a0590ebc11f66955e864c12886da5815.zip
Chat input now hides when not focussed, and doesn't allow player be controlled
by keyboard when it is.
-rwxr-xr-x.cvsignore1
-rw-r--r--docs/clientupdates.txt46
-rw-r--r--file.list1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/game.cpp10
-rw-r--r--src/gui/chat.cpp8
-rw-r--r--src/gui/chat.h4
-rw-r--r--src/gui/chatinput.cpp35
-rw-r--r--src/gui/chatinput.h47
9 files changed, 145 insertions, 9 deletions
diff --git a/.cvsignore b/.cvsignore
index ce7d7c3b..cffef8de 100755
--- a/.cvsignore
+++ b/.cvsignore
@@ -18,3 +18,4 @@ tmw.log
missing
install-sh
depcomp
+chatlog.txt
diff --git a/docs/clientupdates.txt b/docs/clientupdates.txt
new file mode 100644
index 00000000..24f36c7d
--- /dev/null
+++ b/docs/clientupdates.txt
@@ -0,0 +1,46 @@
+--------------------
+CLIENT AUTO-UPDATING
+--------------------
+
+UPDATING CLIENT DATA
+
+For future clients we need to develop a way in which they can automatically
+update to new data like for example new images, maps or item, being and skill
+definitions. Here is described the sequence of actions that could implement
+this functionality:
+
+ 1. Client loads initial core data for login screen (always included with
+ release)
+ 2. Client logs on
+ 3. Server sends client list of required packages (maybe with versions)
+ 4. Client notices he doesn't have a certain package yet or is out of date
+ 5. Client requests from server .torrent files (or maybe at first just URL)
+ from where to get the the missing packages
+ 6. Client downloads them and puts them in "data" directory (~/.tmw/data on
+ Linux, cause that's writable)
+ 7. Client loads the list of files server mentioned in PhysFS virtual
+ filesystem
+ 8. Client tells server that it is up to date
+ 9. Client could load some common data like item definitions here
+10. Server sends client player position and so on, game starts, client loads
+ and unloads additional data like maps, tilesets, sprites, etc. on demand.
+
+
+UPDATING THE CLIENT BINARY
+
+Updates to the actual client binary are also being considered, especially on
+the Windows operating system. While the plan is to move any specific game data
+outside of the binary, sometimes an update to the binary will be required for
+being able to play the game. Also especially Windows users are used to
+automatic update checks for many applications (possibly because of the lack of
+such a feature system-wide).
+
+On Linux this would require either installing a statically linked binary
+(which could still have some issues) or automatically compiling/installing
+from source. Neither are very attractive options, and I (Hammerbear) would
+prefer not to deal with automatic binary updates on Linux.
+
+On Windows a binary can't be replaced while it is running, so probably a
+separate update tool would need to be written that is run before the client
+to check for updates to the client and possibly replaces the client before
+running it.
diff --git a/file.list b/file.list
index 64caf4dc..64368f12 100644
--- a/file.list
+++ b/file.list
@@ -7,6 +7,7 @@ MODULES = src/sound.cpp \
src/gui/char_server.cpp \
src/gui/char_select.cpp \
src/gui/chat.cpp \
+ src/gui/chatinput.cpp \
src/gui/checkbox.cpp \
src/gui/confirm_dialog.cpp \
src/gui/equipment.cpp \
diff --git a/src/Makefile.am b/src/Makefile.am
index 69a24f1c..47bb0cb5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,8 @@ tmw_SOURCES = graphic/spriteset.cpp \
gui/char_select.h \
gui/chat.cpp \
gui/chat.h \
+ gui/chatinput.cpp \
+ gui/chatinput.h \
gui/checkbox.cpp \
gui/checkbox.h \
gui/confirm_dialog.cpp \
diff --git a/src/game.cpp b/src/game.cpp
index 8e0168b2..51a0a0c7 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -206,7 +206,7 @@ void do_input()
{
if (!chatWindow->isFocused())
{
- chatWindow->requestFocus();
+ chatWindow->requestChatFocus();
used = true;
}
}
@@ -287,7 +287,7 @@ void do_input()
state = EXIT;
}
- if (keysym.sym == SDLK_g)
+ if (keysym.sym == SDLK_g && !chatWindow->isFocused())
{
// Get the item code
if (!chatWindow->isFocused())
@@ -405,7 +405,8 @@ void do_input()
int yDirection = 0;
int Direction = DIR_NONE;
- if (player_node->action != DEAD && current_npc == 0)
+ if (player_node->action != DEAD && current_npc == 0 &&
+ !chatWindow->isFocused())
{
int x = player_node->x;
int y = player_node->y;
@@ -1368,14 +1369,13 @@ void do_parse()
inventoryWindow->items->setEquipped(
equipmentWindow->equipments[position - 1].inventoryIndex,
false);
-
inventoryWindow->items->setEquipped(RFIFOW(2),
true);
equipmentWindow->addEquipment(position - 1,
inventoryWindow->items->getId(RFIFOW(2)));
equipmentWindow->equipments[position - 1].inventoryIndex = RFIFOW(2);
-
+
// Trick to use the proper graphic until I find
// the right packet
switch (inventoryWindow->items->getId(RFIFOW(2))) {
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 380d9d13..40a44b13 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -24,6 +24,7 @@
#include "chat.h"
#include "textfield.h"
#include "textbox.h"
+#include "chatinput.h"
#include "../graphics.h"
#include "../main.h"
#include <iostream>
@@ -37,7 +38,7 @@ ChatWindow::ChatWindow(const char *logfile, int item_num):
setContentSize(600, 100);
textOutput = new TextBox();
- chatInput = new TextField();
+ chatInput = new ChatInput();
textOutput->setEditable(false);
scrollArea = new ScrollArea(textOutput);
scrollArea->setDimension(gcn::Rectangle(
@@ -228,13 +229,16 @@ void ChatWindow::action(const std::string& eventId)
chatInput->setText("");
}
+ // Remove focus and hide input
gui->focusNone();
+ chatInput->setVisible(false);
}
}
-void ChatWindow::requestFocus()
+void ChatWindow::requestChatFocus()
{
// Give focus to the chat input
+ chatInput->setVisible(true);
chatInput->requestFocus();
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 4b0946f9..1c3fc007 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -138,9 +138,9 @@ class ChatWindow : public Window, public gcn::ActionListener,
void action(const std::string &actionId);
/**
- * Request focus.
+ * Request focus for typing chat message.
*/
- void requestFocus();
+ void requestChatFocus();
/**
* Checks whether ChatWindow is Focused or not.
diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp
new file mode 100644
index 00000000..55417ac8
--- /dev/null
+++ b/src/gui/chatinput.cpp
@@ -0,0 +1,35 @@
+/*
+ * The Mana World
+ * Copyright 2004 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$
+ */
+
+#include "chatinput.h"
+
+ChatInput::ChatInput()
+{
+ setVisible(false);
+}
+
+void ChatInput::lostFocus()
+{
+ // TODO: Never mind this, it'll probably work in next Guichan version.
+ //setVisible(false);
+}
diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h
new file mode 100644
index 00000000..9f543e24
--- /dev/null
+++ b/src/gui/chatinput.h
@@ -0,0 +1,47 @@
+/*
+ * The Mana World
+ * Copyright 2004 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_CHATINPUT_H
+#define _TMW_CHATINPUT_H
+
+#include "textfield.h"
+
+/**
+ * The chat input hides when it loses focus. It is also invisible by default.
+ */
+class ChatInput : public TextField
+{
+ public:
+ /**
+ * Constructor.
+ */
+ ChatInput();
+
+ /**
+ * Called if the chat input loses focus. It will set itself to
+ * invisible as result.
+ */
+ void lostFocus();
+};
+
+#endif