From 75906b43ecb9a04fdab365bd8b1a00fbdbc66918 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 3 Oct 2010 19:57:17 +0000 Subject: ui updates, removed impulse and jumpgte g_devel conditions, jumpdrive crash bugfix --- doc/STORYLINE | 37 ++++++++------- doc/TODO | 15 ++++--- doc/world.html | 100 ++++++++++++++++++++++++++++++++++++----- src/client/buymenu.cc | 4 +- src/client/buymenu.h | 4 +- src/client/entitymenu.cc | 4 +- src/client/entitymenu.h | 4 +- src/client/playerview.cc | 89 +++++++++++++++++++++++++++++++----- src/client/playerview.h | 12 ++++- src/client/targeticonbutton.cc | 2 +- src/client/trademenu.cc | 12 ++--- src/client/trademenu.h | 2 +- src/client/worldview.cc | 43 ------------------ src/client/worldview.h | 10 ----- src/game/base/jumppoint.cc | 7 ++- src/game/base/ship.cc | 49 ++++++++++---------- src/render/render.cc | 5 +-- src/ui/iconbutton.cc | 17 +++---- src/ui/iconbutton.h | 24 ++++------ src/ui/widget.cc | 1 + src/ui/widget.h | 34 +++++++------- 21 files changed, 289 insertions(+), 186 deletions(-) diff --git a/doc/STORYLINE b/doc/STORYLINE index 7bc30e0..1006650 100644 --- a/doc/STORYLINE +++ b/doc/STORYLINE @@ -39,15 +39,18 @@ - Lindblade system planet Lindblade - - Burtonian system + - Burton system planet Burton Trent outpost - Dover system - CENTRAL PROTECTORATE (protected by the Ordinators) + PROTECTORATE (protected by the Ordinators) - - Central Protectorate + The seat of the Council and the capital of the central planets. + Location of the Allied Intelligence Network headquarters. + + - Protectorate planet Corona INDEPENDENT COLONIES (protected by the Colonial Militia) @@ -69,7 +72,7 @@ - Antwerp system starbase Helianthos (guards the border) Buccaneer's Den pirate base - planet Hoboken? + planet Antwerp? BORDERWORLDS (not claimed by any lawfull faction) @@ -109,8 +112,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 Central Protectorate and the systems controlled by The Great Houses - are called to 'The Protectorate' or, more informal, 'the central planets'. + The Protectorate and the systems controlled by The Great Houses + are usually referred to as 'the central planets'. ------------------------------------------------------------------ TIMELINE @@ -125,13 +128,13 @@ from the House Lindblade historical records -Reach for the Stars +Reaching for the Stars - Since the beginning of time history of mankind had been written - in blood and fire. While many modern historians state the Exodus - as the the turning point in human civilization it certainly did - not precipitate an era of peace. Wars for resources and territory - would be commonplace for millenia to come. + History of mankind is a tale mostly written in blood and fire. Although + there are few written accounts of the events before the Exodus, it wouldn't + be hard to imagine why the Homeworld would have been abandoned in the first + place: wars for power, territory and resources would be commonplace + for almost five millenia to come. The Year of War @@ -271,6 +274,10 @@ What really happed to the Osirion What really happed after the death of the Tsu-Khan Emperor +Tsu-Khan Empress and the War Generals + +The Empress' niece + ------------------------------------------------------------------ PROJECT::OSIRION STORY @@ -428,10 +435,10 @@ III. The suit By now it was almost 3 am and I was almost certain I was going to regret this nightwandering episode when my alarm clock would obnoxiously announce the next morning. Almost, because by now I had learned that no regrets and focus on the task at hand was usually the wiser - course of action. Obivously, that action was sleep. + course of action. Right now, the task was finding some sleep. I turned around, walked to the elevator at the end of the corridor and pressed the button. After a few seconds the doors opened with a joyfull chime and I stepped inside. "Level 6". The elevator seemed to consider my request when the doors finaly closed and it started - moving upward. Casually I leaned against the back wall, my right hand trying to catch the - yawn escaping my mouth.  + moving upward. I leaned casually against the back wall, my right hand trying to catch the + yawn escaping my mouth. diff --git a/doc/TODO b/doc/TODO index 985868c..56823b8 100644 --- a/doc/TODO +++ b/doc/TODO @@ -13,12 +13,13 @@ general: explosion events sound events world sounds - eject/beam cargo weapons ship improvements (radars, shield, armor) -trading: - no-buy items (amount 0) +inventory: + no-buy items (amount 0) (ok) + eject cargo + beam cargo filesystem: write a filesystem based on streams @@ -42,7 +43,7 @@ network: zone/system chat group/clan chat (requires groups) rcon authentication, rcon command, servers must be able to disable rcon - RSA based authentication (player id) + player authentication (player id) send clients only updates from the current zone/server-side distance check fix lag/client interpolation @@ -66,7 +67,7 @@ render: ui: fix modelview 'can't load' spam -> clear modelname (or tradewindow) (ok) modelview control axis, default orientation tilted - check modelview lighting (-> it uses current zone lighting) + modelview lighting (-> it uses current zone lighting) sound: entity/event positional sounds @@ -74,10 +75,12 @@ sound: game: entity health/shield/armor + 'give ship' destroys inventory + implement 'give cargo' data: update starsystem roadmap - rename skies (lindblade1, lindblade2, ...) + rename skies (lindblade1, lindblade2, ...) win32 port: diff --git a/doc/world.html b/doc/world.html index 5792c83..e94c063 100644 --- a/doc/world.html +++ b/doc/world.html @@ -29,6 +29,7 @@ .osirion in your home directory. On windows, your personal osirion directory is My Documents\My Games\Osirion.

+

File structure

@@ -51,6 +52,14 @@ texture=planets/seymour radius=68 +

+ Textures +

+

+ The engine supports textures in the TGA, PNG and JPG file formats, where required. + The filename extension should be lowercase and in 24bit RGB or 32bit RGBA format. +

+

World

@@ -79,7 +88,7 @@ radius=68 zone=ghant zone=brogha - +

Zones

@@ -413,26 +422,97 @@ color=1.0 1.0 0.9 radius=96 -

- Ships -

- TODO Definition of the shopping list. + Consult the wikipedia article on stellar classification + and this image.

+ +

+ [ship] +

+

+ Some planets and stations have ship dealers where players can buy a new ship. [station] and [planet] + sections can be followed by one or more [ship] sections to add ship models to the ship dealers inventory. +

+
+; station definition
+[station]
+label=alexendria
+.
+. more station definitions
+.
+
+	; the Micron Vector is sold here
+	[ship]
+	label=vector
+
+	; the P.O.D. is sold here
+	[ship]
+	label=pod
+
+

+ Indenting the [ship] sections like in the example above is not required, + but it improves readability. The label key is mandatory and referes to + a ship type as defined in ships.ini. +

+

+ [cargo] +

+

+ Cargo trade is defined similar to ship dealers. [station] and [planet] sections can be followed + by one or more [cargo] section to add specific items to the trader's inventory. The label + key is mandatory and referes to a cargo type as defined in cargo.ini. + The price and amount keys> can be used to set the most important trading parameters. +

+ + + + + + + + + + + +
price =[float]price this type of cargo is bought and sold at
amount =[float]initial amount of available cargo. The default is -1 and means unlimited. + 0 means this type of cargo can only be sold here.
+ +
+; station definition
+[station]
+label=alexendria
+.
+. more station definitions
+.
+	; this station buys and sells crates at 25 credits per unit
+	[cargo]
+	label=crates
+	price=25
+
+	; this station buys niobium at 200 credits per unit
+	[cargo]
+	label=niobium
+	price=200
+	amount=0
+
+

- Entity menus + Ships

+

- TODO + The list of a available ship types is read from the file ships.ini.

+

- Textures + Cargo

- The engine supports textures in the TGA, PNG and JPG file formats. The filename extension - should be lowercase and the texture should be in 24bit RGB or 32bit RGBA format. + The list of available cargo types is read from the file cargo.ini.

+ diff --git a/src/client/buymenu.cc b/src/client/buymenu.cc index b42dc00..91f3dba 100644 --- a/src/client/buymenu.cc +++ b/src/client/buymenu.cc @@ -13,7 +13,7 @@ namespace client { -BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent) +BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Widget(parent) { set_border(false); set_background(false); @@ -150,7 +150,7 @@ bool BuyMenu::on_keypress(const int key, const unsigned int modifier) break; } - return Window::on_keypress(key, modifier); + return Widget::on_keypress(key, modifier); } } diff --git a/src/client/buymenu.h b/src/client/buymenu.h index 85801ce..91ed10e 100644 --- a/src/client/buymenu.h +++ b/src/client/buymenu.h @@ -12,14 +12,14 @@ #include "ui/button.h" #include "ui/label.h" #include "ui/modelview.h" -#include "ui/window.h" +#include "ui/widget.h" #include "ui/scrollpane.h" namespace client { /// The buy menu is used to trade a single item, like a ship or an upgrade -class BuyMenu : public ui::Window +class BuyMenu : public ui::Widget { public: /// create a new menu diff --git a/src/client/entitymenu.cc b/src/client/entitymenu.cc index d0fccef..56ce235 100644 --- a/src/client/entitymenu.cc +++ b/src/client/entitymenu.cc @@ -12,7 +12,7 @@ namespace client { -EntityMenu::EntityMenu(ui::Widget *parent, const char * label) : ui::Window(parent) +EntityMenu::EntityMenu(ui::Widget *parent, const char * label) : ui::Widget(parent) { set_border(false); set_background(false); @@ -191,7 +191,7 @@ bool EntityMenu::on_keypress(const int key, const unsigned int modifier) break; } - return Window::on_keypress(key, modifier); + return Widget::on_keypress(key, modifier); } } diff --git a/src/client/entitymenu.h b/src/client/entitymenu.h index 0285879..4907c98 100644 --- a/src/client/entitymenu.h +++ b/src/client/entitymenu.h @@ -10,13 +10,13 @@ #include "core/entity.h" #include "ui/container.h" #include "ui/label.h" -#include "ui/window.h" +#include "ui/widget.h" namespace client { /// entity menu -class EntityMenu : public ui::Window +class EntityMenu : public ui::Widget { public: /// create a new menu diff --git a/src/client/playerview.cc b/src/client/playerview.cc index 159371c..5cbd408 100644 --- a/src/client/playerview.cc +++ b/src/client/playerview.cc @@ -10,8 +10,10 @@ #include "core/info.h" #include "core/application.h" #include "audio/audio.h" -#include "client/playerview.h" #include "ui/ui.h" +#include "client/targeticonbutton.h" +#include "client/playerview.h" + namespace client { @@ -31,16 +33,23 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent) label_viewname->set_background(true); label_viewname->set_font(ui::root()->font_large()); - view_chat = new Chat(this); + // sub menus view_map = new Map(this); view_entitymenu = new EntityMenu(this); view_buymenu = new BuyMenu(this); view_trademenu = new TradeMenu(this); view_inventory = new Inventory(this); + view_chat = new Chat(this); - //view_hud->set_focus(); - //view_hud->raise(); - //view_entitymenu->raise(); + // icon buttons + view_menubutton = new ui::IconButton(this, "bitmaps/icons/button_menu", "ui_menu"); + + view_launchbutton = new ui::IconButton(this, "bitmaps/icons/button_launch", "launch"); + view_dockbutton = new TargetIconButton(this, "bitmaps/icons/button_dock", "dock", core::Entity::Dockable); + + view_chatbutton = new ui::IconButton(this, "bitmaps/icons/button_chat", "ui_chat"); + view_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map"); + view_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_inventory", "ui_inventory"); } PlayerView::~PlayerView() @@ -80,14 +89,23 @@ void PlayerView::toggle_map() if (view_entitymenu->visible()) { view_entitymenu->hide(); } + + if (view_buymenu->visible()) { + view_buymenu->hide(); + } + + if (view_trademenu->visible()) { + view_trademenu->hide(); + } } map()->toggle(); audio::play("ui/menu"); - if (map()->visible() && chat()->visible() && chat()->small_view()) { +/* if (map()->visible() && chat()->visible() && chat()->small_view()) { chat()->raise(); } +*/ } void PlayerView::toggle_inventory() @@ -105,18 +123,31 @@ void PlayerView::toggle_inventory() if (view_entitymenu->visible()) { view_entitymenu->hide(); } + + if (view_buymenu->visible()) { + view_buymenu->hide(); + } + + if (view_trademenu->visible()) { + view_trademenu->hide(); + } } inventory()->toggle(); audio::play("ui/menu"); - if (inventory()->visible() && chat()->visible() && chat()->small_view()) { +/* if (inventory()->visible() && chat()->visible() && chat()->small_view()) { chat()->raise(); } +*/ } void PlayerView::toggle_chat() { + if (chat()->small_view()) { + chat()->hide(); + } + if (!chat()->visible()) { if (map()->visible()) map()->hide(); @@ -125,9 +156,19 @@ void PlayerView::toggle_chat() inventory()->hide(); } - if (view_entitymenu->visible()) + if (view_entitymenu->visible()) { view_entitymenu->hide(); + } + + if (view_buymenu->visible()) { + view_buymenu->hide(); + } + + if (view_trademenu->visible()) { + view_trademenu->hide(); + } } + chat()->set_small_view(false); chat()->toggle(); audio::play("ui/menu"); @@ -135,6 +176,10 @@ void PlayerView::toggle_chat() void PlayerView::toggle_chatbar() { + if (!chat()->small_view()) { + chat()->hide(); + } + chat()->set_small_view(true); chat()->toggle(); } @@ -167,7 +212,7 @@ void PlayerView::show_menu(const std::string & args) // requesting the info through game makes sure it is retreived from the server view_buymenu->set_item( core::game()->request_info(id)); // show buy menu - view_buymenu->show(); + view_buymenu->show(); } else { con_print << "usage: view buy [info id] show the buy menu for this kind of item" << std::endl; } @@ -203,8 +248,9 @@ void PlayerView::show_menu(const std::string & args) view_entitymenu->show(); } - if (chat()->visible() && chat()->small_view()) +/* if (chat()->visible() && chat()->small_view()) chat()->raise(); +*/ } void PlayerView::resize() @@ -213,6 +259,21 @@ void PlayerView::resize() set_size(parent()->size()); + // icons + const float icon_margin = 4.0f; + const float icon_size = 48.0f; + const float icon_count = 7; + const float l = (width() - ((icon_count + 1) * icon_margin) - (icon_count * icon_size)) * 0.5f; + + view_menubutton->set_geometry(l, icon_margin, icon_size, icon_size); + // spacer + view_dockbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + view_launchbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + // spacer + view_inventorybutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + view_chatbutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + view_mapbutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + // reposition buy menu view_buymenu->event_resize(); // reposition trade menu @@ -241,6 +302,14 @@ void PlayerView::resize() void PlayerView::draw() { const float smallmargin = ui::UI::elementsize.height(); + + if (core::localcontrol()->state() == core::Entity::Docked) { + view_launchbutton->show(); + view_dockbutton->hide(); + } else { + view_launchbutton->hide(); + view_dockbutton->show(); + } if (core::localplayer()->view()) { diff --git a/src/client/playerview.h b/src/client/playerview.h index 66672cf..5e82be5 100644 --- a/src/client/playerview.h +++ b/src/client/playerview.h @@ -7,6 +7,9 @@ #ifndef __INCLUDED_CLIENT_PLAYERVIEW_H__ #define __INCLUDED_CLIENT_PLAYERVIEW_H__ +#include "ui/widget.h" +#include "ui/label.h" +#include "ui/iconbutton.h" #include "client/chat.h" #include "client/buymenu.h" #include "client/entitymenu.h" @@ -15,8 +18,6 @@ #include "client/hud.h" #include "client/map.h" #include "client/notifications.h" -#include "ui/widget.h" -#include "ui/label.h" namespace client { @@ -82,6 +83,13 @@ private: TradeMenu *view_trademenu; ui::Label *label_viewname; + + ui::IconButton *view_menubutton; + ui::IconButton *view_dockbutton; + ui::IconButton *view_launchbutton; + ui::IconButton *view_chatbutton; + ui::IconButton *view_mapbutton; + ui::IconButton *view_inventorybutton; }; } diff --git a/src/client/targeticonbutton.cc b/src/client/targeticonbutton.cc index 8bd3b1a..1ef2da0 100644 --- a/src/client/targeticonbutton.cc +++ b/src/client/targeticonbutton.cc @@ -33,7 +33,7 @@ bool TargetIconButton::on_keypress(const int key, const unsigned int modifier) void TargetIconButton::draw() { - enable(targets::current() && ((targets::current()->flags() & entity_flags) == entity_flags)); + set_enabled(targets::current() && ((targets::current()->flags() & entity_flags) == entity_flags)); ui::IconButton::draw(); } diff --git a/src/client/trademenu.cc b/src/client/trademenu.cc index c0d1f03..f0030f5 100644 --- a/src/client/trademenu.cc +++ b/src/client/trademenu.cc @@ -17,7 +17,7 @@ namespace client { -TradeMenu::TradeMenu(ui::Widget *parent, const char * label) : ui::Window(parent) +TradeMenu::TradeMenu(ui::Widget *parent, const char * label) : ui::Widget(parent) { set_border(false); set_background(false); @@ -188,7 +188,7 @@ void TradeMenu::set_item(ui::ListItem *item) std::ostringstream str; str << "Price: " << std::setw(12) << (amount > 0 ? amount : 1) * trader_item->price() << '\n' - << "Volume: " << std::setw(12) << std::setprecision(2) << (float)(amount > 0 ? amount : 1) * trader_item->info()->volume(); + << "Volume: " << std::setw(12) << (float)(amount > 0 ? amount : 1) * trader_item->info()->volume(); menu_tradertext->set_text(str.str()); } else { menu_msgtext->set_text("^1Can not sell here"); @@ -244,7 +244,7 @@ void TradeMenu::set_item(ui::ListItem *item) std::ostringstream str; str << "Price: " << std::setw(12) << (amount > 0 ? amount : 1) * item->item()->price() << '\n' - << "Volume: " << std::setw(12) << std::setprecision(2) << (float) (amount > 0 ? amount : 1) * item->info()->volume(); + << "Volume: " << std::setw(12) << (float) (amount > 0 ? amount : 1) * item->info()->volume(); menu_tradertext->set_text(str.str()); } @@ -337,7 +337,7 @@ bool TradeMenu::on_emit(Widget *sender, const Event event, void *data) return true; } - return ui::Window::on_emit(sender, event, data); + return ui::Widget::on_emit(sender, event, data); } void TradeMenu::draw() @@ -361,7 +361,7 @@ void TradeMenu::draw() } menu_inventorytext->set_text(str.str()); - Window::draw(); + Widget::draw(); } bool TradeMenu::on_keypress(const int key, const unsigned int modifier) @@ -376,7 +376,7 @@ bool TradeMenu::on_keypress(const int key, const unsigned int modifier) break; } - return Window::on_keypress(key, modifier); + return Widget::on_keypress(key, modifier); } } // namespace client diff --git a/src/client/trademenu.h b/src/client/trademenu.h index ecc41b9..56fe259 100644 --- a/src/client/trademenu.h +++ b/src/client/trademenu.h @@ -22,7 +22,7 @@ namespace client { /// trade menu -class TradeMenu : public ui::Window +class TradeMenu : public ui::Widget { public: /// create a new trade menu diff --git a/src/client/worldview.cc b/src/client/worldview.cc index 265277f..35cada2 100644 --- a/src/client/worldview.cc +++ b/src/client/worldview.cc @@ -27,16 +27,6 @@ WorldView::WorldView(ui::Widget *parent) : ui::Widget(parent) view_playerview = new PlayerView(this); view_playerview->raise(); view_playerview->hide(); - - // icon buttons - view_menubutton = new ui::IconButton(this, "bitmaps/icons/button_menu", "ui_menu"); - - view_launchbutton = new ui::IconButton(this, "bitmaps/icons/button_launch", "launch"); - view_dockbutton = new TargetIconButton(this, "bitmaps/icons/button_dock", "dock", core::Entity::Dockable); - - view_chatbutton = new ui::IconButton(this, "bitmaps/icons/button_chat", "ui_chat"); - view_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map"); - view_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_inventory", "ui_inventory"); } WorldView::~WorldView() @@ -66,21 +56,6 @@ void WorldView::resize() view_keyinfo->set_size(font()->width()*12, font()->height()*1); view_keyinfo->set_location(width() - view_keyinfo->width() - smallmargin, height() - view_keyinfo->height() - smallmargin); - - // icons - const float icon_margin = 4.0f; - const float icon_size = 48.0f; - const float icon_count = 7; - const float l = (width() - ((icon_count + 1) * icon_margin) - (icon_count * icon_size)) * 0.5f; - - view_menubutton->set_geometry(l, icon_margin, icon_size, icon_size); - // spacer - view_dockbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - view_launchbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - // spacer - view_inventorybutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - view_chatbutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - view_mapbutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); } void WorldView::clear() @@ -104,28 +79,10 @@ void WorldView::draw() if (ui::root()->active() || !core::game()->interactive() || !core::localcontrol() || (core::localplayer()->view() && !core::localplayer()->view()->menus().size())) { view_playerview->hide(); - view_menubutton->hide(); - view_dockbutton->hide(); - view_launchbutton->hide(); - view_chatbutton->hide(); - view_mapbutton->hide(); - view_inventorybutton->hide(); } else { view_playerview->show(); view_playerview->set_focus(); - if (core::localcontrol()->state() == core::Entity::Docked) { - view_launchbutton->show(); - view_dockbutton->hide(); - } else { - view_launchbutton->hide(); - view_dockbutton->show(); - } - - view_menubutton->show(); - view_chatbutton->show(); - view_mapbutton->show(); - view_inventorybutton->show(); } } diff --git a/src/client/worldview.h b/src/client/worldview.h index 266d3eb..9def8c5 100644 --- a/src/client/worldview.h +++ b/src/client/worldview.h @@ -10,7 +10,6 @@ #include "ui/widget.h" #include "client/playerview.h" #include "client/infowidget.h" -#include "ui/iconbutton.h" namespace client { @@ -40,15 +39,6 @@ private: KeyInfoWidget *view_keyinfo; Notifications *view_notify; PlayerView *view_playerview; - - ui::IconButton *view_menubutton; - - ui::IconButton *view_dockbutton; - ui::IconButton *view_launchbutton; - - ui::IconButton *view_chatbutton; - ui::IconButton *view_mapbutton; - ui::IconButton *view_inventorybutton; }; } diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc index 9ef18d9..ae66262 100644 --- a/src/game/base/jumppoint.cc +++ b/src/game/base/jumppoint.cc @@ -20,6 +20,8 @@ JumpPoint::JumpPoint() : core::EntityDynamic() set_radius(0.25f); set_flag(core::Entity::Static); set_flag(core::Entity::Bright); + // FIXME jumppoints should be harder to find + set_flag(core::Entity::ShowOnMap); entity_moduletypeid = jumppoint_enttype; jumppoint_target = 0; @@ -60,17 +62,18 @@ void JumpPoint::validate() core::Entity *targetentity = targetzone->find_entity(entitylabel); if (!targetentity) { - con_warn << " Could not find target jumppoint '" << entitylabel << "'\n"; + con_warn << " Could not find target jumppoint '" << entitylabel << "' in zone '" << zonelabel << "'\n"; return; } if ((targetentity->moduletype() != jumppoint_enttype) && (targetentity->moduletype() != jumpgate_enttype)) { - con_warn << " Jumppoint with invalid target jumppoint '" << entitylabel << "'\n"; + con_warn << " Jumppoint with invalid target jumppoint '" << entitylabel << "' in zone '" << zonelabel << "'\n"; return; } jumppoint_target = static_cast(targetentity); + con_debug << " jumppoint to " << targetzone->label() << std::endl; //con_debug << " Jumppoint " << zone->label() << ":" << label() << " with target " << targetlabel() << std::endl; } diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index d51a119..78764e3 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -23,6 +23,9 @@ namespace game { const float MIN_DELTA = 0.000001f; +const float impulse_delay = 3.0f; // 3 second delay before impulse kicks in + // note: this delay must match the impulse drive sound set +const float jump_delay = 5.0f; // 5 seconds delay before jump driv kicks in Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(), PhysicsBody(this) { @@ -126,29 +129,30 @@ void Ship::func_impulse() entity_state = core::Entity::Normal; target_thrust = 1.0f; entity_thrust = 0.0f; + set_dirty(); + return; + } - } else if (entity_state == core::Entity::ImpulseInitiate) { + if (entity_state == core::Entity::ImpulseInitiate) { entity_state = core::Entity::Normal; - - } else if (entity_state != core::Entity::Normal) { + set_dirty(); return; + } - } else { - if (entity_state == core::Entity::JumpInitiate) { - ship_jumpdrive_timer = 0; - entity_timer = 0; - } - - entity_state = core::Entity::ImpulseInitiate; - if (Game::g_devel->value()) { - entity_timer = 0; - } else { - entity_timer = 3; - } - ship_impulsedrive_timer = core::server()->time(); + if (entity_state == core::Entity::JumpInitiate) { + entity_state = core::Entity::Normal; + ship_jumpdrive_timer = 0; + entity_timer = 0; + set_dirty(); } - set_dirty(); + if (entity_state != core::Entity::Normal) + return; + + entity_state = core::Entity::ImpulseInitiate; + entity_timer = impulse_delay; + ship_impulsedrive_timer = core::server()->time(); + } void Ship::initiate_jump(JumpPoint *depart) @@ -163,14 +167,9 @@ void Ship::initiate_jump(JumpPoint *depart) ship_jumpdepart = depart; entity_state = core::Entity::JumpInitiate; - - if (Game::g_devel->value()) { - entity_timer = 0; - } else { - entity_timer = 8; - } - + entity_timer = jump_delay; ship_jumpdrive_timer = core::server()->time(); + set_dirty(); } @@ -351,7 +350,7 @@ void Ship::frame(float seconds) set_zone(ship_jumpdepart->target()->zone()); - if (owner() && owner()->view()->zone() != ship_jumpdepart->target()->zone()) + if (owner() && owner()->view() && (owner()->view()->zone() != ship_jumpdepart->target()->zone())) owner()->set_view(0); owner()->send("^BJumping to the " + ship_jumpdepart->target()->zone()->name()); diff --git a/src/render/render.cc b/src/render/render.cc index 384280c..5a6c6bc 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -80,7 +80,7 @@ void init(int width, int height) r_normals->set_info("[bool] render face normals"); r_normalize = core::Cvar::get("r_normalize", "0", core::Cvar::Archive); - r_normalize->set_info("[bool] use GL_NORMALIZE instead of GL_RESCALE_NORMAL (recommended off)"); + r_normalize->set_info("[bool] use GL_NORMALIZE instead of GL_RESCALE_NORMAL (recommended off)"); r_grid = core::Cvar::get("r_grid", "0", core::Cvar::Archive); r_grid->set_info("[bool] render the space grid"); @@ -92,7 +92,7 @@ void init(int width, int height) r_bbox->set_info("[bool] render model bounding box"); r_sky = core::Cvar::get("r_sky", "1", core::Cvar::Archive); - r_sky->set_info("[bool] render the sky globe"); + r_sky->set_info("[bool] render the sky"); r_particles = core::Cvar::get("r_particles", "1", core::Cvar::Archive); r_particles->set_info("[bool] render particles"); @@ -141,7 +141,6 @@ void init(int width, int height) func = core::Func::add("list_materials", func_list_materials); func->set_info("list registered materials"); - func = core::Func::add("list_particles", func_list_particles); func->set_info("list registered particle scripts"); diff --git a/src/ui/iconbutton.cc b/src/ui/iconbutton.cc index 87203ee..204918e 100644 --- a/src/ui/iconbutton.cc +++ b/src/ui/iconbutton.cc @@ -24,7 +24,7 @@ IconButton::IconButton(Widget *parent, const char *icon, const char *command) : set_border(false); set_command(command); set_icon(icon); - iconbutton_enabled = true; + set_highlight(false); } IconButton::~IconButton() @@ -58,19 +58,14 @@ void IconButton::set_icon(const char *icon) iconbutton_icon.clear(); } -void IconButton::set_icon(const std::string &icon) +void IconButton::set_highlight(const bool highlight) { - iconbutton_icon.assign(icon); + iconbutton_highlight = highlight; } -void IconButton::enable(bool enabled) -{ - iconbutton_enabled = enabled; -} - -void IconButton::disable(bool disabled) +void IconButton::set_icon(const std::string &icon) { - iconbutton_enabled = !disabled; + iconbutton_icon.assign(icon); } void IconButton::draw() @@ -80,7 +75,7 @@ void IconButton::draw() if (disabled()) { Paint::set_color(palette()->disabled()); - } else if (has_mouse_focus()) { + } else if (highlight() || has_mouse_focus()) { Paint::set_color(palette()->highlight()); } else { Paint::set_color(palette()->foreground()); diff --git a/src/ui/iconbutton.h b/src/ui/iconbutton.h index 37d1c7b..c9a7c5b 100644 --- a/src/ui/iconbutton.h +++ b/src/ui/iconbutton.h @@ -28,22 +28,11 @@ public: return iconbutton_icon; } - /// enabled or disabled - inline const bool enabled() const { - return iconbutton_enabled; + /// highlight state + inline const bool highlight() const { + return iconbutton_highlight; } - - /// enabled or disabled - inline const bool disabled() const { - return !iconbutton_enabled; - } - - /// enable or disable the button - void enable(bool enabled = true); - - /// enable or disable the button - void disable(bool disabled = true); - + /// set the command this button will execute void set_command(const std::string &command); @@ -56,6 +45,9 @@ public: /// set the icon texture void set_icon(const char *icon); + /// set the highlight state + void set_highlight(const bool highlight); + /// print button description virtual void print(const size_t indent) const; @@ -78,7 +70,7 @@ protected: private: std::string iconbutton_command; std::string iconbutton_icon; - bool iconbutton_enabled; + bool iconbutton_highlight; }; } diff --git a/src/ui/widget.cc b/src/ui/widget.cc index 2f35185..f663cc6 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -188,6 +188,7 @@ void Widget::set_enabled(const bool enabled) else disable(); } + void Widget::set_border(const bool border) { widget_border = border; diff --git a/src/ui/widget.h b/src/ui/widget.h index 8b61bc1..530af05 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -57,7 +57,7 @@ public: /** * @see location() */ - inline float left() const { + inline const float left() const { return widget_location.x(); } @@ -66,7 +66,7 @@ public: * @see location() * @see size() */ - inline float right() const { + inline const float right() const { return widget_location.x() + widget_size.width(); } @@ -74,7 +74,7 @@ public: /** * @see location() */ - inline float top() const { + inline const float top() const { return widget_location.y(); } @@ -83,7 +83,7 @@ public: * @see location() * @see size() */ - inline float bottom() const { + inline const float bottom() const { return widget_location.y() + widget_size.height(); } @@ -91,7 +91,7 @@ public: /** * @see size() */ - inline float width() const { + inline const float width() const { return widget_size.width(); } @@ -99,7 +99,7 @@ public: /** * @see size() */ - inline float height() const { + inline const float height() const { return widget_size.height(); } @@ -109,32 +109,32 @@ public: } /// true if this widget will draw a background - inline bool background() const { + inline const bool background() const { return widget_background; } /// true if this widget will draw a border - inline bool border() const { + inline const bool border() const { return widget_border; } /// true if this widget is visible - inline bool visible() const { + inline const bool visible() const { return widget_visible; } /// true if this widget is not visible - inline bool hidden() const { + inline const bool hidden() const { return !widget_visible; } /// true if the widget is enabled - inline bool enabled() const { + inline const bool enabled() const { return widget_enabled; } /// true if the widget is disabled - inline bool disabled() const { + inline const bool disabled() const { return !widget_enabled; } @@ -170,12 +170,12 @@ public: /// set visibility void set_visible(const bool visible = true); - /// disable the widget - virtual void disable(); - - /// enable the widget + /// enable or disable the widget virtual void enable(); - + + /// enable or disable the widget + virtual void disable(); + ///set enabled or disabled state void set_enabled(const bool enabled = true); -- cgit v1.2.3