Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/client.cc')
-rw-r--r--src/client/client.cc91
1 files changed, 35 insertions, 56 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 69f36b6..706634a 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -224,44 +224,34 @@ void Client::frame()
core::Application::frame();
if (!connected()) {
+
const std::string module_label(core::Loader::label());
+
+ if (!ui::console()->visible()) {
- // load the intro if nothing is running
- if (load("intro")) {
- connect("");
- if (module_label.size())
- load(module_label);
+ // load the intro if nothing is running
+ if (load("intro")) {
+ connect("");
+ if (module_label.size())
+ load(module_label);
+ } else {
+ ui::console()->toggle();
+ }
}
- // show the console if everything fails
- if (!connected() && !ui::console()->visible()) {
- ui::console()->toggle();
+
+ if (client_mainwindow->visible()) {
+ client_mainwindow->hide();
}
- } else if (!ui::root()->active()) {
-
- // show the main menu on non-interactive modules
- if (!core::game()->interactive()) {
- ui::root()->show_menu("main");
-
- // show the join menu when player does not control an entity
- } else if (core::game()->time() && !core::localcontrol()) {
- ui::root()->show_menu("join");
+
+ } else {
+ if (client_mainwindow->hidden()) {
+ client_mainwindow->show();
}
- if (testmodelwindow()->visible()) {
- testmodelwindow()->raise();
- }
if (ui::console()->visible()) {
ui::console()->raise();
ui::console()->set_focus();
}
- } else {
- if (core::localcontrol()) {
-
- // hide join menu
- if (ui::root()->active()->label().compare("join") == 0) {
- ui::root()->hide_menu();
- }
- }
}
const float now = timestamp();
@@ -310,9 +300,6 @@ void Client::notify_connect()
video::frame_loader();
mainwindow()->clear();
- ui::root()->hide_menu();
-
- //video::set_caption();
}
void Client::notify_disconnect()
@@ -322,8 +309,6 @@ void Client::notify_disconnect()
input::reset();
mainwindow()->clear();
-
- //video::set_caption();
}
void Client::notify_zonechange()
@@ -444,7 +429,7 @@ void Client::func_ui_restart(std::string const &args)
void Client::func_list_menu(std::string const &args)
{
if (ui::root()) {
- ui::root()->list_menus();
+ // FIXME ui::root()->list_menus();
}
}
@@ -500,14 +485,12 @@ void Client::func_ui(std::string const &args)
void Client::func_menu_help()
{
con_print << "^Bmenu functions" << std::endl;
- con_print << " menu help show this help" << std::endl;
- con_print << " menu list list available menus" << std::endl;
- con_print << " menu [name] show a menu" << std::endl;
- con_print << " menu back return to the previous menu" << std::endl;
- con_print << " menu previous return to the previous menu" << std::endl;
- con_print << " menu close close the current menu" << std::endl;
- con_print << " menu hide hide the current menu" << std::endl;
- ui::root()->list_menus();
+ con_print << "^RTODO" << std::endl;
+}
+
+void Client::show_menu(const char *menu)
+{
+ client()->client_mainwindow->mainmenu()->show_menu(menu);
}
// global menu fuctions
@@ -528,28 +511,24 @@ void Client::func_menu(std::string const &args)
argstr >> command;
aux::to_label(command);
-
if (command.compare("help") == 0) {
func_menu_help();
} else if (command.compare("hide") == 0) {
- ui::root()->hide_menu();
+ client()->client_mainwindow->mainmenu()->hide();
} else if (command.compare("close") == 0) {
- ui::root()->hide_menu();
-
- } else if (command.compare("back") == 0) {
- ui::root()->previous_menu();
+ client()->client_mainwindow->mainmenu()->hide();
- } else if (command.compare("previous") == 0) {
- ui::root()->previous_menu();
+ } else if (command.compare("default") == 0) {
+ client()->client_mainwindow->mainmenu()->show_default();
} else if (command.compare("list") == 0) {
- ui::root()->list_menus();
+ // TODO client_mainwindow->mainmenu()->list();
} else {
- ui::root()->show_menu(command.c_str());
+ show_menu(command.c_str());
}
}
@@ -557,14 +536,14 @@ void Client::func_menu(std::string const &args)
void Client::func_ui_menu(std::string const &args)
{
if (client()->connected()) {
- if (ui::root()->active()) {
- ui::root()->hide_menu();
+ if (client()->client_mainwindow->mainmenu()->visible()) {
+ client()->client_mainwindow->mainmenu()->hide();
} else {
// show the main menu on non-interactive modules
if (!core::game()->interactive()) {
- ui::root()->show_menu("main");
+ show_menu("main");
} else {
- ui::root()->show_menu("game");
+ show_menu("game");
}
}
} else {