From 178f0e4a83918df416ac8274b0e845b390772d76 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 27 Sep 2010 20:03:50 +0000 Subject: documentation updates, initial chat window playerlist, trade menu ESC key --- doc/STORYLINE | 11 +++--- doc/installation.html | 41 ++++++++++++---------- doc/models.html | 55 ++++++++++++++++++------------ src/client/chat.cc | 84 +++++++++++++++++++++++++--------------------- src/client/chat.h | 12 ++++--- src/client/trademenu.cc | 15 +++++++++ src/client/trademenu.h | 5 +++ src/core/gameconnection.cc | 1 + src/core/gameinterface.cc | 6 ++++ src/core/gameinterface.h | 10 ++++++ src/core/gameserver.cc | 2 ++ src/core/netconnection.cc | 2 ++ 12 files changed, 155 insertions(+), 89 deletions(-) diff --git a/doc/STORYLINE b/doc/STORYLINE index c5c5514..22c29e8 100644 --- a/doc/STORYLINE +++ b/doc/STORYLINE @@ -23,7 +23,7 @@ - House Lindblade - House Illia - - Lance Protectorate + - Council Protectorate Tsu-Khan Empire @@ -45,9 +45,9 @@ - Dover system - COUNCIL PROTECTORATE (protected by the Ordinators) + CENTRAL PROTECTORATE (protected by the Ordinators) - - Council Protectorate + - Central Protectorate planet Corona INDEPENDENT COLONIES (protected by the Colonial Militia) @@ -109,9 +109,8 @@ Since the war, the term 'Borderworlds' is used to indicate systems destroyed during the war, while the term 'colonies' is generally used as abreviation for the 'Independent Colonies'. - The Great Houses are referred to as the 'Lance Protectorate' or, - more informal, as 'the central planets'. - + The Central Protectorate and the systems controlled by The Great Houses + are called to 'The Protectorate' or, more informal, 'the central planets'. ------------------------------------------------------------------ TIMELINE diff --git a/doc/installation.html b/doc/installation.html index a1fa0b9..c10011c 100644 --- a/doc/installation.html +++ b/doc/installation.html @@ -56,7 +56,8 @@

Download the windows package:
- osirion-win32-latest.zip
+ osirion-win32-latest.zip (32 bit)
+ osirion-win64-latest.zip (64 bit)
This package contains the win32 version of the server and the client.

Dowload the game data package:
@@ -78,14 +79,14 @@

Download the linux packages:
- osirion-linux-latest.zip
+ osirion-linux-latest.zip(32 and 64 bit)
This package contains the linux 32 and 64 bit versions of the client and the server.

Extract the package, a new subdirectory will be created. The actual directory name will depend on the version number. Enter the new subdirectory.

tar jxvf osirion-latest.tar.bz2
-cd osirion-linux-669 +cd osirion-linux-740

Dowload the game data package:
@@ -105,7 +106,6 @@ unzip ../osirion-data-latest.zip

./osirion.x86_64
-
@@ -173,8 +173,9 @@ svn co svn://intranifty.no-ip.org/osirion osirion osirion-src-latest.tar.bz2

+
Compiling the source code
@@ -265,7 +267,7 @@ svn checkout svn://intranifty.no-ip.org/osirion-data data

The client and the dedicated server will look for game data in the data subdirectory of the current working directory. Since the binaries are build in the src you will - have to copy them with the src/ prefix. + have start them with the src/ prefix.

To start the client: @@ -273,6 +275,10 @@ svn checkout svn://intranifty.no-ip.org/osirion-data data

src/osirion
+

+ If the client opens a new window and immediatly close it again, it probably could not find + the game data and exited. Check your installation. +

To start the dedicated server:

@@ -317,17 +323,17 @@ make
- GtkRadiant 1.5.0 support files (optional) + NetRadiant/GtkRadiant 1.5.0 support files (optional)

- You can skip this section if you do not intent to create to create models with gtkradiant 1.5. - Note that these files probably won't work with other versions. You can find precompiled - gtkradiant 1.5.0 binaries for linux on my gtkradiant page:
+ You can skip this section if you do not intent to create to create models with netradiant or + gtkradiant 1.5. Note that these files probably won't work with other versions. You can find precompiled + netradiant packages here:
http://ingar.satgnu.net/gtkradiant

These instructions assume gtkradiant is installed in the directory - /usr/local/games/gtkradiant-1.5.0. If it is installed in a different + /usr/local/games/netradiant. If it is installed in a different directory on your system, edit these instructions accordingly.

Copy the support files to the gtkradiant folder: @@ -335,10 +341,10 @@ make

cd data
cd gtkradiant
-cp -vr * /usr/local/games/gtkradiant-1.5.0 +cp -vr * /usr/local/games/netradiant

- Open the file /usr/local/games/gtkradiant-1.5.0/games/osirion.game in + Open the file /usr/local/games/netradiant/games/osirion.game in your favourite editor. Look for a line that begins with:

@@ -401,18 +407,19 @@ Organization of the distribution /math mathematical classes and functions /sys low-level system functions /render render library - /ui user interface widget library + /ui user interface library /data Data files /base game data files /bitmaps essential bitmaps /ini game world description files - /maps game world models - /scripts gtkradiant shader files + /maps 3D models (.map format) + /models 3D models (ase and other formats) + /scripts radiant compatible shader files /textures game world textures - /gtkradiant gtkradiant support files + /gtkradiant radiant support files
diff --git a/doc/models.html b/doc/models.html index 68026f4..bd0565a 100644 --- a/doc/models.html +++ b/doc/models.html @@ -10,30 +10,29 @@ The Osirion Project - Creating models

- The engine supports loading of Quake 3 style .map files with custom osirion - entities. While it might look like a weird choice for a file format - it has been a well-considered pragmatic choice. -

- First of all, creating commercial grade graphics has never been - my goal. Polished high-quality models demand a lot of time, - skill and effort. -

- The same goes for 3D modelling packages like Blender or 3D Studio Max. - They are capable of producing awesome results, but the learning curve - is quite steep and the number of available 3D artists is rather limited. + The engine supports two kind of models: The first one are + Quake 3 style .map files with custom osirion entities. The second + one are .ase models. Textures are supported, but no advanced features + like normal mapping. +

- GtkRadiant on the other hand has been my personal tool for some time - now. An experienced mapper can create a LEGO-style model in a matter - of hours and without having the usual technical difficulties of creating - a map for a shoot'em'up. + The .map format allows for a quick and easy way to create usable + 3D models, while the .ase format allows importing more complex + models made with modelling packages. The .map format is also used + as a container format to place tags on models, like lights, + smoke trails and weapon locations. +

- Creating game content is usually a chicken-and-egg in a small game - project. I hope to solve this by choosing a widely available and - easy to master format. + .ase models can be loaded as sub-models into a .map file, + making modular spaceship design possible. Ship parts like engines + can be placed into seperate files and reused in other models. +

- The rest of this document contains information specific to creating + The rest of the document describes how to create models using + GtkRadiant and contains mostly information specific to creating models for The Osirion Project. Even if you can handle GtkRadiant, it is still worth a read. +

Content

@@ -50,6 +49,7 @@
  • Flares
  • Particles
  • Function groups +
  • Submodels
  • Other entities @@ -110,14 +110,14 @@

    Any brush face that has the common/caulk texture will be ignored on load. - +

    Clip

    Any brush face that has the common/clip texture will be ignored on load. Clip is reserved for future use. - +

    Detail brushes

    @@ -187,7 +187,12 @@ glass on hidden faces. The common/clip material is reserved for future use brush faces using this texture will be ignored as well.

    - +

    + For .ase models, the material name inside the .ase file is interpreted as an osirion material. + If you'd use a material called common/entity, those model faces will rendered using + the object's primary in-game color, regardless of the actual material settings in the .ase file. +

    +

    Shader files

    @@ -333,6 +338,12 @@ textures/ship/stripes is automaticly calculated as the geometrical center of the group. The rotation axis can be set with the direction, pitch and roll keys. angle is an alias for direction.

    +

    + Submodels +

    +

    + misc_model can be used to add a submodel. +

    Other entities

    diff --git a/src/client/chat.cc b/src/client/chat.cc index c1fc78f..8191e52 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -29,21 +29,19 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) chat_scrollpane->set_border(false); chat_scrollpane->set_label("text"); - chat_playerpane = new ui::ScrollPane(this, chat_players); - chat_playerpane->set_border(false); - chat_playerpane->set_label("players"); - chat_playerpane->set_alignment(ui::AlignLeft | ui::AlignTop); + chat_playerlist = new ui::ListView(this); + chat_playerlist->set_label("playerlist"); chat_input = new ui::InputBox(this); chat_input->set_border(false); chat_input->set_prompt("^BSay^F:^B "); - chat_input->set_focus(); set_background(true); set_visible(false); chat_small = false; + chat_playerlist_timestamp = 0; } Chat::~Chat() @@ -53,15 +51,17 @@ Chat::~Chat() void Chat::clear() { - chat_players.clear(); chat_log.clear(); chat_input->clear(); + chat_playerlist->clear(); + chat_playerlist_timestamp = 0; } void Chat::set_small_view(bool small_chat_view) { chat_small = small_chat_view; + resize(); } void Chat::event_text(const std::string & text) @@ -164,8 +164,11 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) return false; } -void Chat::event_draw() +void Chat::draw() { + /* + * this never worked before, event_draw is NOT virtual + if (ui::console()->visible()) return; @@ -178,48 +181,51 @@ void Chat::event_draw() hide(); return; } + */ + + if (!chat_small && (chat_playerlist_timestamp != core::game()->playerlist_timestamp())) { + update_player_list(); + } + + ui::Window::draw(); +} - if (chat_small) { - chat_playerpane->hide(); - chat_scrollpane->hide(); - } else { - chat_playerpane->show(); - chat_scrollpane->show(); - - chat_players.clear(); - std::ostringstream ostr; - - ostr << "^B" << core::game()->players().size() << " " << aux::plural("player", core::game()->players().size()); - chat_players.push_back(ostr.str()); - - for (core::GameInterface::Players::iterator it = core::game()->players().begin(); it != core::game()->players().end(); it++) { - core::Player *player = (*it); - chat_players.push_back(player->name() + "^N"); - } +void Chat::update_player_list() +{ + chat_playerlist->clear(); + + 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); } - Widget::event_draw(); + chat_playerlist_timestamp = core::game()->playerlist_timestamp(); } void Chat::resize() { - const float margin = 8.0f; - math::Vector2f s(size()); - - s[0] -= margin * 2; - s[1] -= margin * 2; - - // player names - chat_playerpane->set_size(ui::UI::elementsize.width() , s.height() - font()->height() * 2.5f); - chat_playerpane->set_location(s.width() - chat_playerpane->width() + 2.0f * margin, margin + font()->height()); + const float fontmargin = ui::root()->font_large()->height(); + + if (chat_small) { + chat_playerlist->hide(); + chat_scrollpane->hide(); + + } else { + chat_playerlist->show(); + chat_scrollpane->show(); + + // player names + chat_playerlist->set_size(ui::UI::elementsize.width(), height() - fontmargin * 3.0f); + chat_playerlist->set_location(width() - ui::UI::elementsize.width() - fontmargin, fontmargin); - // chat text - chat_scrollpane->set_size(s.width() - chat_playerpane->width() - margin, s.height() - font()->height() * 1.5f); - chat_scrollpane->set_location(margin, margin); + // chat text + chat_scrollpane->set_size(width() - ui::UI::elementsize.width() - fontmargin * 3.0f, height() - fontmargin * 3.0f); + chat_scrollpane->set_location(fontmargin, fontmargin); + } // input bar - chat_input->set_location(margin, height() - font()->height() - margin); - chat_input->set_size(s.width(), font()->height()); + chat_input->set_location(fontmargin, height() - fontmargin); + chat_input->set_size(width() - 2.0f * fontmargin , fontmargin); } diff --git a/src/client/chat.h b/src/client/chat.h index 61f5bd1..0972400 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -13,6 +13,7 @@ #include "ui/inputbox.h" #include "ui/scrollpane.h" #include "ui/window.h" +#include "ui/listview.h" namespace client { @@ -37,22 +38,23 @@ public: void clear(); protected: - virtual void event_draw(); + virtual void draw(); + virtual void resize(); virtual bool on_keypress(const int key, const unsigned int modifier); private: + void update_player_list(); bool chat_small; ui::Text chat_log; ui::ScrollPane *chat_scrollpane; - - ui::Text chat_players; - ui::ScrollPane *chat_playerpane; - ui::InputBox *chat_input; + ui::ListView *chat_playerlist; + + unsigned long chat_playerlist_timestamp; typedef std::deque History; diff --git a/src/client/trademenu.cc b/src/client/trademenu.cc index 8aa9a52..c0d1f03 100644 --- a/src/client/trademenu.cc +++ b/src/client/trademenu.cc @@ -364,4 +364,19 @@ void TradeMenu::draw() Window::draw(); } +bool TradeMenu::on_keypress(const int key, const unsigned int modifier) +{ + switch (key) { + + case SDLK_ESCAPE: + this->hide(); + return true; + break; + default: + break; + } + + return Window::on_keypress(key, modifier); +} + } // namespace client diff --git a/src/client/trademenu.h b/src/client/trademenu.h index 5ea34aa..ecc41b9 100644 --- a/src/client/trademenu.h +++ b/src/client/trademenu.h @@ -36,11 +36,16 @@ protected: /// resize event handler virtual void resize(); + /// draw event handler virtual void draw(); /// emit event handler virtual bool on_emit(Widget *sender, const Event event, void *data); + /// keypress event handler + virtual bool on_keypress(const int key, const unsigned int modifier); + + private: void set_item(ui::ListItem *item); diff --git a/src/core/gameconnection.cc b/src/core/gameconnection.cc index f64c8fb..ba18bd5 100644 --- a/src/core/gameconnection.cc +++ b/src/core/gameconnection.cc @@ -61,6 +61,7 @@ GameConnection::GameConnection(std::string const &connectionstr) } game_players.push_back(localplayer()); + set_playerlist_timestamp(timestamp()); connection_running = true; } diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index 5caa270..23018d3 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -122,6 +122,7 @@ void GameInterface::clear() } } game_players.clear(); + game_playerlist_timestamp = 0; // remove all game functions for (Func::Registry::iterator it = Func::registry().begin(); it != Func::registry().end();) { @@ -193,4 +194,9 @@ void GameInterface::list_players() con_print << count << " connected " << aux::plural("player", count) << std::endl; } +void GameInterface::set_playerlist_timestamp(const unsigned long timestamp) +{ + game_playerlist_timestamp = ( timestamp > 0 ? timestamp : 1); +} + } diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h index bdce1d3..98894e7 100644 --- a/src/core/gameinterface.h +++ b/src/core/gameinterface.h @@ -38,6 +38,10 @@ public: inline Players & players() { return game_players; } + + inline const unsigned long playerlist_timestamp() const { + return game_playerlist_timestamp; + } inline model::VertexArray *vertexarray() { return game_vertexarray; @@ -68,6 +72,9 @@ public: /// request inventory for entity with id virtual Inventory *request_inventory(Entity *entity) = 0; + + void set_playerlist_timestamp(const unsigned long timestamp); + /*----- mutators ------------------------------------------------- */ @@ -89,6 +96,9 @@ protected: Players game_players; model::VertexArray *game_vertexarray; + + /// timestamp of the time the playerlist was last changed + unsigned long game_playerlist_timestamp; }; /// global local player instance diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index 963db6d..31c6d42 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -441,6 +441,7 @@ void GameServer::player_connect(Player *player) // manage player list game_players.push_back(player); + set_playerlist_timestamp(timestamp()); } void GameServer::player_disconnect(Player *player) @@ -464,6 +465,7 @@ void GameServer::player_disconnect(Player *player) if (it != game_players.end()) { game_players.erase(it); } + set_playerlist_timestamp(timestamp()); } void GameServer::frame(unsigned long timestamp) diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index 3318c1e..15e57e2 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -755,6 +755,7 @@ void NetConnection::parse_incoming_message(const std::string & message) if (!player) { player = new Player(); game()->players().push_back(player); + game()->set_playerlist_timestamp(game()->timestamp()); } player->receive_short_server_update(msgstream); @@ -781,6 +782,7 @@ void NetConnection::parse_incoming_message(const std::string & message) for (GameInterface::Players::iterator it = game()->players().begin(); it != game()->players().end() && !player; it++) { if ((*it)->id() == player_id) { game()->players().erase(it); + game()->set_playerlist_timestamp(game()->timestamp()); return; } } -- cgit v1.2.3