Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-11-25 12:06:13 +0000
committerStijn Buys <ingar@osirion.org>2012-11-25 12:06:13 +0000
commitd8be908233fd7b85492d7a9e87f07bb207173990 (patch)
tree70d9103a867688838fc517290bb370366c69fedb /src/client
parentedc5ddce817244111b302e449c28a052f2746cc4 (diff)
Moved core::EntityGlobe into a separate file,
added various methods to core::Item and core::Slot, added r_slots cvar to draw entity slots and docks, added game methods for mounting and umounting of weapons, added playerlist to chat window.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/chat.cc28
-rw-r--r--src/client/chat.h2
-rw-r--r--src/client/inventorywindow.cc25
-rw-r--r--src/client/inventorywindow.h4
-rw-r--r--src/client/mapwindow.cc2
-rw-r--r--src/client/video.cc3
6 files changed, 54 insertions, 10 deletions
diff --git a/src/client/chat.cc b/src/client/chat.cc
index c49550e..25b437c 100644
--- a/src/client/chat.cc
+++ b/src/client/chat.cc
@@ -213,23 +213,37 @@ void Chat::set_prompt()
void Chat::draw()
{
if (!chat_small && (chat_playerlist_timestamp != core::game()->playerlist_timestamp())) {
- update_player_list();
+ refresh();
}
set_prompt();
ui::Window::draw();
}
-void Chat::update_player_list()
+void Chat::refresh()
{
chat_playerlist->clear();
+ ui::ListItem *listitem = 0;
+ /*
+ listitem = new ui::ListItem(chat_playerlist, "Shout");
+ listitem->set_height(listitem->font()->height() * 2.0f);
+ listitem->set_sortkey(" 0");
+
+ listitem = new ui::ListItem(chat_playerlist, "Say");
+ listitem->set_height(listitem->font()->height() * 2.0f);
+ listitem->set_sortkey(" 1");
+ */
for (core::GameInterface::Players::const_iterator it = core::game()->players().begin(); it != core::game()->players().end(); it++) {
- ui::ListItem *listitem = new ui::ListItem(chat_playerlist, (*it)->name().c_str());
- listitem->set_height(listitem->font()->height() * 1.5f);
+ std::string descr(aux::text_strip((*it)->name().c_str()));
+ if ((*it)->zone()) {
+ descr.append("\n^N");
+ descr.append(aux::pad_left((*it)->zone()->name(), 20));
+ }
+ listitem = new ui::ListItem(chat_playerlist, descr.c_str());
+ listitem->set_height(listitem->font()->height() * 3.0f);
listitem->set_sortkey(aux::text_strip_lowercase((*it)->name()));
- }
-
+ }
chat_playerlist->sort();
chat_playerlist_timestamp = core::game()->playerlist_timestamp();
@@ -259,7 +273,7 @@ void Chat::resize()
// resize player names listview
chat_playerlist->set_location(padding, chat_titlelabel->bottom() + padding);
- chat_playerlist->set_size(ui::UI::elementsize.width() * 1.5f, height() - chat_playerlist->top() - padding * 2.0f);
+ chat_playerlist->set_size(ui::UI::elementsize.width(), height() - chat_playerlist->top() - padding * 2.0f);
// resize chat text pane
chat_scrollpane->set_location(chat_playerlist->right() + padding, chat_titlelabel->bottom() + padding);
diff --git a/src/client/chat.h b/src/client/chat.h
index 9b64297..eaaed10 100644
--- a/src/client/chat.h
+++ b/src/client/chat.h
@@ -54,7 +54,7 @@ protected:
private:
- void update_player_list();
+ void refresh();
bool chat_small;
ui::Text chat_log;
diff --git a/src/client/inventorywindow.cc b/src/client/inventorywindow.cc
index 7912d0d..9539061 100644
--- a/src/client/inventorywindow.cc
+++ b/src/client/inventorywindow.cc
@@ -68,6 +68,7 @@ InventoryWindow::InventoryWindow(ui::Widget *parent) : ui::Window(parent)
inventorywindow_shipbutton = new ui::IconButton(this, "bitmaps/icons/button_ship");
inventorywindow_ejectbutton = new ui::IconButton(this, "bitmaps/icons/button_eject");
+ inventorywindow_mountbutton = new ui::IconButton(this, "bitmaps/icons/button_mount");
// eject dialog
inventorywindow_ejectconfirmbutton = new ui::Button(inventorywindow_scrollpane, "Eject");
@@ -209,6 +210,9 @@ void InventoryWindow::resize()
inventorywindow_ejectbutton->set_size(icon_size, icon_size);
inventorywindow_ejectbutton->set_location(inventorywindow_inventorytext->right() - icon_size, height() - icon_size - padding);
+ inventorywindow_mountbutton->set_size(icon_size, icon_size);
+ inventorywindow_mountbutton->set_location(inventorywindow_ejectbutton->left() - icon_size - padding, height() - icon_size - padding);
+
// resize modelview
inventorywindow_modelview->set_size( width() - inventorywindow_listview->right() - padding * 2.0f ,ui::UI::elementsize.width());
inventorywindow_modelview->set_location(inventorywindow_listview->right() + padding, padding * 3.0f);
@@ -335,12 +339,29 @@ void InventoryWindow::act_eject()
show_item_info(0);
}
+void InventoryWindow::act_mount()
+{
+ if (!inventorywindow_listview->selected()) {
+ return;
+ }
+ if (!inventorywindow_listview->selected()->item()) {
+ return;
+ }
+
+ std::ostringstream cmdstr;
+
+ cmdstr << "remote mount ";
+ cmdstr << inventorywindow_listview->selected()->item()->id();
+ core::CommandBuffer::exec(cmdstr.str());
+}
+
void InventoryWindow::show_item_info(const ui::ListItem *listitem)
{
if (listitem) {
set_info(listitem->info(), listitem->item()->amount());
if (listitem->item()->amount()) {
inventorywindow_ejectbutton->enable();
+ inventorywindow_mountbutton->enable();
}
} else {
set_info(0, 0);
@@ -353,6 +374,7 @@ void InventoryWindow::set_info(const core::Info *info, const int amount)
inventorywindow_infotext.clear();
inventorywindow_amount = amount;
inventorywindow_ejectbutton->disable();
+ inventorywindow_mountbutton->disable();
inventorywindow_ejectconfirmbutton->hide();
inventorywindow_ejectcancelbutton->hide();
@@ -393,8 +415,9 @@ bool InventoryWindow::on_emit(Widget *sender, const Event event, void *data)
} else if (sender == inventorywindow_ejectcancelbutton) {
show_item_info(inventorywindow_listview->selected());
} else if (sender == inventorywindow_ejectconfirmbutton) {
- // TODO do actual eject
act_eject();
+ } else if (sender == inventorywindow_mountbutton) {
+ act_mount();
} else if (sender == inventorywindow_closebutton) {
hide();
}
diff --git a/src/client/inventorywindow.h b/src/client/inventorywindow.h
index e32bf44..239ff11 100644
--- a/src/client/inventorywindow.h
+++ b/src/client/inventorywindow.h
@@ -57,6 +57,8 @@ private:
void act_eject();
+ void act_mount();
+
void show_item_info(const ui::ListItem *listitem);
bool verify() const;
@@ -83,6 +85,8 @@ private:
ui::ScrollPane *inventorywindow_scrollpane;
ui::IconButton *inventorywindow_shipbutton;
+ ui::IconButton *inventorywindow_mountbutton;
+
ui::IconButton *inventorywindow_ejectbutton;
ui::Button *inventorywindow_ejectconfirmbutton;
ui::Button *inventorywindow_ejectcancelbutton;
diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc
index e6bc5bb..c8ebaa8 100644
--- a/src/client/mapwindow.cc
+++ b/src/client/mapwindow.cc
@@ -7,6 +7,8 @@
#include "audio/audio.h"
#include "core/application.h"
+#include "core/entity.h"
+#include "core/entityglobe.h"
#include "client/mapwindow.h"
#include "client/targets.h"
#include "ui/ui.h"
diff --git a/src/client/video.cc b/src/client/video.cc
index 7f15eea..a75089f 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -363,9 +363,10 @@ void frame(float elapsed)
render::draw(elapsed); // draw the world
targets::frame(); // validate current target, render sound
+ /*
if (!core::localplayer()->view() && targets::current()) // draw target docks etc
render::draw_target(targets::current());
-
+ */
render::Camera::ortho();
client()->mainwindow()->show();