From dd2162af7727c0f30d77cc7ae33ccbb346611b20 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 8 Nov 2013 21:01:05 +0000 Subject: Code cleanups, removed unnecessary functions, added star coronas to the map. --- src/client/gamewindow.cc | 121 ++++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 58 deletions(-) (limited to 'src/client/gamewindow.cc') diff --git a/src/client/gamewindow.cc b/src/client/gamewindow.cc index 01e1e81..71a2171 100644 --- a/src/client/gamewindow.cc +++ b/src/client/gamewindow.cc @@ -9,7 +9,9 @@ #include "core/info.h" #include "core/application.h" + #include "ui/ui.h" +#include "ui/iconbutton.h" #include "client/targeticonbutton.h" @@ -93,13 +95,13 @@ void GameWindow::event_text(const std::string & text) void GameWindow::toggle_map() { - if (!map()->visible()) { - if (chat()->visible() && !chat()->small_view()) { - chat()->hide(); + if (!gamewindow_map->visible()) { + if (gamewindow_chat->visible() && !gamewindow_chat->small_view()) { + gamewindow_chat->hide(); } - if (inventory()->visible()) { - inventory()->hide(); + if (gamewindow_inventory->visible()) { + gamewindow_inventory->hide(); } if (gamewindow_entitymenu->visible()) { @@ -117,26 +119,23 @@ void GameWindow::toggle_map() if (gamewindow_reputation->visible()) { gamewindow_reputation->hide(); } + + gamewindow_map->show(); + } else { + gamewindow_map->hide(); } - - map()->toggle(); - -/* if (map()->visible() && chat()->visible() && chat()->small_view()) { - chat()->raise(); - } -*/ } void GameWindow::toggle_inventory() { - if (!inventory()->visible()) { - if (chat()->visible() && !chat()->small_view()) { - chat()->hide(); + if (!gamewindow_inventory->visible()) { + if (gamewindow_chat->visible() && !gamewindow_chat->small_view()) { + gamewindow_chat->hide(); } - if (map()->visible()) { - map()->hide(); + if (gamewindow_map->visible()) { + gamewindow_map->hide(); } if (gamewindow_reputation->visible()) { @@ -156,23 +155,23 @@ void GameWindow::toggle_inventory() gamewindow_trademenu->hide(); } - inventory()->show(); + gamewindow_inventory->show(); } else { - inventory()->hide(); + gamewindow_inventory->hide(); } } void GameWindow::toggle_reputation() { - if (!reputation()->visible()) { - if (chat()->visible() && !chat()->small_view()) { - chat()->hide(); + if (!gamewindow_reputation->visible()) { + if (gamewindow_chat->visible() && !gamewindow_chat->small_view()) { + gamewindow_chat->hide(); } - if (map()->visible()) { - map()->hide(); + if (gamewindow_map->visible()) { + gamewindow_map->hide(); } if (gamewindow_inventory->visible()) { @@ -191,25 +190,27 @@ void GameWindow::toggle_reputation() gamewindow_trademenu->hide(); } - reputation()->show(); + gamewindow_reputation->show(); } else { - reputation()->hide(); + gamewindow_reputation->hide(); } } void GameWindow::toggle_chat() { - if (chat()->small_view()) { - chat()->hide(); + // if the chat window is in small view, hide it first and open the full view + if (gamewindow_chat->visible() && gamewindow_chat->small_view()) { + gamewindow_chat->set_small_view(false); + gamewindow_chat->hide(); } - if (!chat()->visible()) { - if (map()->visible()) - map()->hide(); + if (!gamewindow_chat->visible()) { + if (gamewindow_map->visible()) + gamewindow_map->hide(); - if (inventory()->visible()) { - inventory()->hide(); + if (gamewindow_inventory->visible()) { + gamewindow_inventory->hide(); } if (gamewindow_reputation->visible()) { @@ -227,20 +228,27 @@ void GameWindow::toggle_chat() if (gamewindow_trademenu->visible()) { gamewindow_trademenu->hide(); } + + gamewindow_chat->set_small_view(false); + gamewindow_chat->show(); + } else { + gamewindow_chat->hide(); } - - chat()->set_small_view(false); - chat()->toggle(); } void GameWindow::toggle_chatbar() { - if (!chat()->small_view()) { - chat()->hide(); + if (gamewindow_chat->visible() && !gamewindow_chat->small_view()) { + gamewindow_chat->set_small_view(true); + gamewindow_chat->hide(); } - chat()->set_small_view(true); - chat()->toggle(); + if (!gamewindow_chat->visible()) { + gamewindow_chat->set_small_view(true); + gamewindow_chat->show(); + } else { + gamewindow_chat->hide(); + } } void GameWindow::show_menu(const std::string & args) @@ -321,10 +329,6 @@ void GameWindow::show_menu(const std::string & args) gamewindow_entitymenu->generate(core::localplayer()->view(), label.c_str()); gamewindow_entitymenu->show(); } - -/* if (chat()->visible() && chat()->small_view()) - chat()->raise(); -*/ } void GameWindow::resize() @@ -393,6 +397,7 @@ void GameWindow::draw() gamewindow_gotobutton->hide(); gamewindow_dockbutton->hide(); gamewindow_formationbutton->hide(); + } else { gamewindow_launchbutton->hide(); @@ -413,8 +418,8 @@ void GameWindow::draw() if (gamewindow_entitymenu->generated_entity() != core::localplayer()->view()) { // initially show the menu show_menu("main"); - map()->hide(); - chat()->hide(); + gamewindow_map->hide(); + gamewindow_chat->hide(); // hide other windows gamewindow_chat->hide(); @@ -426,10 +431,10 @@ void GameWindow::draw() !gamewindow_entitymenu->visible() && !gamewindow_buymenu->visible() && !gamewindow_trademenu->visible() && - !inventory()->visible() && - !reputation()->visible() && - !map()->visible() && - (!chat()->visible() || chat()->small_view()) + !gamewindow_inventory->visible() && + !gamewindow_reputation->visible() && + !gamewindow_map->visible() && + (!gamewindow_chat->visible() || gamewindow_chat->small_view()) ) { @@ -437,7 +442,7 @@ void GameWindow::draw() gamewindow_entitymenu->show(); } - gamewindow_homebutton->enable(); + gamewindow_homebutton->show(); } else { // entity without menus, plain view @@ -446,7 +451,7 @@ void GameWindow::draw() } } else { - gamewindow_homebutton->disable(); + gamewindow_homebutton->hide(); if (gamewindow_entitymenu->visible()) { gamewindow_entitymenu->hide(); @@ -464,7 +469,7 @@ void GameWindow::draw() gamewindow_trademenu->hide(); } - if (!map()->visible() && !chat()->visible() && !inventory()->visible() && !reputation()->visible()) { + if (!gamewindow_map->visible() && !gamewindow_chat->visible() && !gamewindow_inventory->visible() && !gamewindow_reputation->visible()) { gamewindow_hud->set_focus(); } @@ -472,7 +477,7 @@ void GameWindow::draw() } // reposition chat widget - if (chat()->visible()) { + if (gamewindow_chat->visible()) { if (gamewindow_chat->small_view()) { gamewindow_chat->set_size(width() - smallmargin * 2, font()->height() * 2); gamewindow_chat->set_location(smallmargin, height() - smallmargin *2 - gamewindow_chat->height()); @@ -508,13 +513,13 @@ bool GameWindow::on_keypress(const int key, const unsigned int modifier) return true; } - if (map()->visible()) { - map()->hide(); + if (gamewindow_map->visible()) { + gamewindow_map->hide(); return true; } - if (inventory()->visible()) { - inventory()->hide(); + if (gamewindow_inventory->visible()) { + gamewindow_inventory->hide(); return true; } -- cgit v1.2.3