From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/client/client.cc | 61 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'src/client/client.cc') diff --git a/src/client/client.cc b/src/client/client.cc index 1fa2796..6a50743 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -1,7 +1,7 @@ /* client/client.cc - This file is part of the Osirion project and is distributed under - the terms and conditions of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms and conditions of the GNU General Public License version 2 */ #include @@ -22,7 +22,7 @@ #include "render/render.h" #include "ui/ui.h" -namespace client +namespace client { core::Cvar *cl_framerate = 0; @@ -42,7 +42,7 @@ void run(int count, char **arguments) { std::cout << core::name() << " " << core::version() << std::endl; - for (int i =0; i < count; i++) + for (int i = 0; i < count; i++) std::cout << arguments[i] << " "; std::cout << std::endl; @@ -104,7 +104,7 @@ void Client::init(int count, char **arguments) // initialize audio audio::init(); - + // add engine functions core::Func *func = 0; @@ -116,19 +116,19 @@ void Client::init(int count, char **arguments) func = core::Func::add("list_ui", func_list_ui); func->set_info("list user interface widgets"); - + func = core::Func::add("list_menu", func_list_menu); func->set_info("list available menus"); - + func = core::Func::add("ui", func_ui); func->set_info("[command] user interface functions"); - + func = core::Func::add("ui_restart", func_ui_restart); func->set_info("reload user interface files"); func = core::Func::add("ui_console", func_ui_console); func->set_info("toggle console"); - + func = core::Func::add("ui_chat", Client::func_ui_chat); func->set_info("toggle chat window"); @@ -160,14 +160,14 @@ void Client::run() // default framerate 125fps, 8 milliseconds Uint32 client_frame_lenght = 8; - + Uint32 client_current_timestamp = 0; Uint32 client_previous_timestamp = 0; - + while (true) { // current time in microseconds client_current_timestamp = SDL_GetTicks(); - + // calculate the desired frame length if (cl_framerate->value() < 0) { (*cl_framerate) = 0.0f; @@ -180,12 +180,12 @@ void Client::run() } else { client_frame_lenght = 0; } - + // only advance per microsecond frame Uint32 d = client_current_timestamp - client_previous_timestamp; if ((d > 0)) { if (d >= client_frame_lenght) { - frame(client_current_timestamp); + frame(client_current_timestamp); client_previous_timestamp = client_current_timestamp; } else { SDL_Delay(client_frame_lenght - d); @@ -222,7 +222,7 @@ void Client::frame(unsigned long timestamp) if (!core::game()->interactive()) { ui::root()->show_menu("main"); - // show the join menu when player does not control an entity + // show the join menu when player does not control an entity } else if (core::game()->time() && !core::localcontrol()) { ui::root()->show_menu("join"); } @@ -231,13 +231,13 @@ void Client::frame(unsigned long timestamp) // hide join menu if (ui::root()->active()->label().compare("join") == 0) { - ui::root()->hide_menu(); + ui::root()->hide_menu(); } } } video::frame((float)(timestamp - previous_timestamp) / 1000.0f); - + previous_timestamp = timestamp; } @@ -248,7 +248,7 @@ void Client::shutdown() if (connected()) disconnect(); core::Func::remove("r_restart"); - core::Func::remove("snd_restart"); + core::Func::remove("snd_restart"); core::Func::remove("list_menu"); core::Func::remove("list_ui"); core::Func::remove("ui"); @@ -302,7 +302,7 @@ void Client::notify_zonechange() { video::set_loader_message(); video::frame_loader(); - + // unload entity sounds for (core::Entity::Registry::iterator it = core::Entity::registry().begin(); it != core::Entity::registry().end(); it++) { core::Entity *entity = (*it).second; @@ -333,7 +333,7 @@ void Client::notify_message(const std::string &message) void Client::notify_message(const core::Message::Channel channel, const std::string &message) { - switch(channel) { + switch (channel) { case core::Message::Info: // Info message break; @@ -363,7 +363,8 @@ void Client::notify_message(const core::Message::Channel channel, const std::str con_print << message << std::endl; } -void Client::notify_loader(const std::string &message) { +void Client::notify_loader(const std::string &message) +{ video::set_loader_message(message.c_str()); } @@ -436,7 +437,7 @@ void Client::func_ui(std::string const &args) con_warn << "User Interface not available!" << std::endl; return; } - + if (!args.size()) { func_ui_help(); return; @@ -445,7 +446,7 @@ void Client::func_ui(std::string const &args) std::string command; argstr >> command; aux::to_label(command); - + if (command.compare("help") == 0) { func_ui_help(); } else if (command.compare("debug") == 0) { @@ -517,7 +518,7 @@ void Client::func_menu(std::string const &args) con_warn << "User Interface not available!" << std::endl; return; } - + if (!args.size()) { con_print << "^Bmenu functions" << std::endl; con_print << " menu help show this help" << std::endl; @@ -533,21 +534,21 @@ void Client::func_menu(std::string const &args) std::stringstream argstr(args); std::string command; argstr >> command; - + aux::to_label(command); - + if (command.compare("hide") == 0) { ui::root()->hide_menu(); - + } else if (command.compare("close") == 0) { ui::root()->hide_menu(); - + } else if (command.compare("back") == 0) { ui::root()->previous_menu(); - + } else if (command.compare("previous") == 0) { ui::root()->previous_menu(); - + } else if (command.compare("list") == 0) { ui::root()->list_menus(); -- cgit v1.2.3