You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(11) |
Apr
(47) |
May
(14) |
Jun
|
Jul
(73) |
Aug
(4) |
Sep
(2) |
Oct
(60) |
Nov
(48) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(27) |
Apr
(82) |
May
(89) |
Jun
(91) |
Jul
(44) |
Aug
(53) |
Sep
(113) |
Oct
(20) |
Nov
(37) |
Dec
(10) |
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(21) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(76) |
Feb
(89) |
Mar
(52) |
Apr
(11) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(27) |
2010 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(14) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ult...@us...> - 2007-07-07 08:49:31
|
Revision: 626 http://svn.sourceforge.net/opengate/?rev=626&view=rev Author: ultrasick Date: 2007-07-07 01:49:33 -0700 (Sat, 07 Jul 2007) Log Message: ----------- adding required political status Modified Paths: -------------- trunk/data/capacitors/mantra.xml Modified: trunk/data/capacitors/mantra.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-07 08:45:49
|
Revision: 625 http://svn.sourceforge.net/opengate/?rev=625&view=rev Author: ultrasick Date: 2007-07-07 01:45:49 -0700 (Sat, 07 Jul 2007) Log Message: ----------- adding required political status Modified Paths: -------------- trunk/data/power_plants/contender_xl.xml Modified: trunk/data/power_plants/contender_xl.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-07-07 08:32:59
|
Revision: 624 http://svn.sourceforge.net/opengate/?rev=624&view=rev Author: egore Date: 2007-07-07 01:32:59 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Add a working version check. It's only not working if we login before. We need to reset something in ASIO I'm missing right now. I think we need to close and reopen the socket. Modified Paths: -------------- branches/ogsector/src/Makefile.am branches/ogsector/src/Makefile.in branches/ogsector/src/metaserver.cpp branches/ogsector/src/metaserver.h branches/ogsector/src/opengateclient.cpp Modified: branches/ogsector/src/Makefile.am =================================================================== --- branches/ogsector/src/Makefile.am 2007-07-06 22:22:34 UTC (rev 623) +++ branches/ogsector/src/Makefile.am 2007-07-07 08:32:59 UTC (rev 624) @@ -74,7 +74,9 @@ networkServer.h \ networkServer.cpp \ networkServerUser.h \ - networkServerUser.cpp + networkServerUser.cpp \ + metaserver.h \ + metaserver.cpp testopenalmanager_SOURCES = \ testopenalmanager.cpp \ Modified: branches/ogsector/src/Makefile.in =================================================================== --- branches/ogsector/src/Makefile.in 2007-07-06 22:22:34 UTC (rev 623) +++ branches/ogsector/src/Makefile.in 2007-07-07 08:32:59 UTC (rev 624) @@ -66,7 +66,7 @@ am_opengateserver_OBJECTS = opengateserver.$(OBJEXT) common.$(OBJEXT) \ LogManager.$(OBJEXT) InputManager.$(OBJEXT) \ networkProtocol.$(OBJEXT) networkServer.$(OBJEXT) \ - networkServerUser.$(OBJEXT) + networkServerUser.$(OBJEXT) metaserver.$(OBJEXT) opengateserver_OBJECTS = $(am_opengateserver_OBJECTS) opengateserver_LDADD = $(LDADD) am_testopenalmanager_OBJECTS = testopenalmanager.$(OBJEXT) \ @@ -255,7 +255,9 @@ networkServer.h \ networkServer.cpp \ networkServerUser.h \ - networkServerUser.cpp + networkServerUser.cpp \ + metaserver.h \ + metaserver.cpp testopenalmanager_SOURCES = \ testopenalmanager.cpp \ Modified: branches/ogsector/src/metaserver.cpp =================================================================== --- branches/ogsector/src/metaserver.cpp 2007-07-06 22:22:34 UTC (rev 623) +++ branches/ogsector/src/metaserver.cpp 2007-07-07 08:32:59 UTC (rev 624) @@ -20,6 +20,7 @@ #include "metaserver.h" #include <boost/regex.hpp> +#include "config.h" namespace OpenGate{ @@ -57,50 +58,15 @@ int MetaConnection::login( const std::string & userName, const std::string & passwd ) { - std::cout << userName << ":" << passwd << std::endl; - try { - // Form the request. We specify the "Connection: close" header so that the - // server will close the socket after transmitting the response. This will - // allow us to treat all data up until the EOF as the content. - asio::streambuf request; - std::ostream request_stream(&request); - request_stream << "GET " << "/script/schnittstelle/?action=login&username=" << userName << "&password=" << passwd << " HTTP/1.0\r\n"; - request_stream << "Host: " << hostname_ << "\r\n"; - request_stream << "Accept: */*\r\n"; - request_stream << "Connection: close\r\n\r\n"; - // Send the request. - asio::write(socket_, request); - - // Read the response status line. asio::streambuf response; - asio::read_until(socket_, response, boost::regex("\r\n")); - - // Check that response is OK. - std::istream response_stream(&response); - std::string http_version; - response_stream >> http_version; - unsigned int status_code; - response_stream >> status_code; - std::string status_message; - std::getline(response_stream, status_message); - if ( !response_stream || http_version.substr(0, 5) != "HTTP/" ) { - std::cout << "Invalid response\n"; - return -1; + std::string parameters( "login&username=" + userName + "&password=" + passwd); + int retval = request(parameters, response); + if (retval < 0) { + return retval; } - if (status_code != 200) { - std::cout << "Response returned with status code " << status_code << "\n"; - return -2; - } - // Read the response headers, which are terminated by a blank line. - asio::read_until(socket_, response, boost::regex("\r\n\r\n")); - - // Process the response headers. (to get the crap of the response before reading the body!) - std::string header; - while (std::getline(response_stream, header) && header != "\r"); - // We got a usefull body. The body is an int, lets use it. if (response.size() > 0) { std::ostringstream stream; @@ -124,14 +90,6 @@ } } - asio::error error = asio::error::eof; - // Read until EOF, writing data to output as we go. - while (asio::read(socket_, response, - asio::transfer_at_least(1), - asio::assign_error(error))) - std::cout << &response; - if (error != asio::error::eof) - throw error; } catch ( asio::error & e) { log_->fatal( e.what() ); @@ -146,4 +104,105 @@ return 1; } +int MetaConnection::check_version( int user_id ) { + + try { + + asio::streambuf response; + std::string parameters("check_version&version=" + std::string(PACKAGE_VERSION) + "&user_id=" + toStr(user_id)); + int retval = request(parameters, response); + if (retval < 0) { + return retval; + } + + // We got a usefull body. The body is an int, lets use it. + if (response.size() > 0) { + std::ostringstream stream; + stream << &response; + int returncode = toInt( stream.str() ); + switch (returncode) { + case -101: log_->warn ( std::string ("no action given") ); return -3; + case -102: log_->warn ( std::string ("action given but unknown") ); return -3; + case -103: log_->warn ( std::string ("database is not available") ); return -3; + case -1: log_->warn ( std::string ("no user_id given") ); return -3; + case -3: log_->warn ( std::string ("user_id doesn't exist") ); return -3; + case -6: log_->warn ( std::string ("no version given") ); return -3; + case -7: log_->warn ( std::string ("version given but it isn't the newest (the same version as set in the admin interface of the project website)") ); return -3; + default: + if (returncode > 0) { + return returncode; + } else { + log_->warn ( std::string ("unkown return code for version check ") + toStr( returncode ) ); + return -4; + } + } + } + + } catch ( asio::error & e) { + log_->fatal( std::string( "check_version: ASIO: " ) + e.what() ); + return -5; + } catch ( std::exception & e) { + log_->fatal( std::string( "check_version: Exception: " ) + e.what() ); + return -5; + } catch (...) { + log_->fatal( "check_version: Unkown exception occured while resolving the server" ); + return -5; + } + return 1; +} + +int MetaConnection::request( const std::string & parameters, asio::streambuf & response ) { + // Form the request. We specify the "Connection: close" header so that the + // server will close the socket after transmitting the response. This will + // allow us to treat all data up until the EOF as the content. + asio::streambuf request; + std::ostream request_stream(&request); + request_stream << "GET " << "/script/schnittstelle/?action=" << parameters << " HTTP/1.0\r\n"; + request_stream << "Host: " << hostname_ << "\r\n"; + request_stream << "Accept: */*\r\n"; + request_stream << "Connection: close\r\n\r\n"; + + // Send the request. + asio::write(socket_, request); + + // Read the response status line. + asio::read_until(socket_, response, boost::regex("\r\n")); + + // Check that response is OK. + std::istream response_stream(&response); + std::string http_version; + response_stream >> http_version; + unsigned int status_code; + response_stream >> status_code; + std::string status_message; + std::getline(response_stream, status_message); + if ( !response_stream || http_version.substr(0, 5) != "HTTP/" ) { + std::cout << "Invalid response\n"; + return -51; + } + if (status_code != 200) { + std::cout << "Response returned with status code " << status_code << "\n"; + return -52; + } + + // Read the response headers, which are terminated by a blank line. + asio::read_until(socket_, response, boost::regex("\r\n\r\n")); + + // Process the response headers. (to get the crap of the response before reading the body!) + std::string header; + while (std::getline(response_stream, header) && header != "\r"); + + asio::error error = asio::error::eof; + // Read until EOF, writing data to output as we go. + while (asio::read(socket_, response, + asio::transfer_at_least(1), + asio::assign_error(error))) + std::cout << &response; + if (error != asio::error::eof) + throw error; + + return 1; +} + + } // namespace OpenGate Modified: branches/ogsector/src/metaserver.h =================================================================== --- branches/ogsector/src/metaserver.h 2007-07-06 22:22:34 UTC (rev 623) +++ branches/ogsector/src/metaserver.h 2007-07-07 08:32:59 UTC (rev 624) @@ -34,6 +34,7 @@ ~MetaConnection(); int login( const std::string & userName, const std::string & passwd = "" ); + int check_version( int user_id ); private: @@ -44,6 +45,8 @@ tcp::socket socket_; tcp::resolver resolver_; + int request( const std::string & parameters, asio::streambuf & response ); + }; } Modified: branches/ogsector/src/opengateclient.cpp =================================================================== --- branches/ogsector/src/opengateclient.cpp 2007-07-06 22:22:34 UTC (rev 623) +++ branches/ogsector/src/opengateclient.cpp 2007-07-07 08:32:59 UTC (rev 624) @@ -37,10 +37,11 @@ int main( int argc, char * argv[ ] ) { int option_dialog = 1; + int option_version = 0; std::string username = "testuser"; std::string hostname = "localhost"; std::string password = "dummy"; - bool withMetaServer = false; + int withMetaServer = 0; OpenGate::LogManager *log = new OpenGate::LogManager(); log->setLogFile( "OpenGate.log" ); @@ -49,20 +50,22 @@ while (1) { static struct option long_options[] = { /* These options set a flag. */ - {"config", no_argument, &option_dialog, 1}, - {"no-config", no_argument, &option_dialog, 0}, + {"config", no_argument, &option_dialog, 1}, + {"no-config", no_argument, &option_dialog, 0}, + {"checkversion", no_argument, &option_version, 1}, + {"Metaserver", no_argument, &withMetaServer, 1}, /* These options don't set a flag. We distinguish them by their indices. */ - {"help", no_argument, 0, 'h'}, - {"Metaserver", no_argument, 0, 'M'}, - {"username", required_argument, 0, 'u'}, - {"password", required_argument, 0, 'p'}, - {"server", required_argument, 0, 's'}, + {"help", no_argument, 0, 'h'}, + {"username", required_argument, 0, 'u'}, + {"password", required_argument, 0, 'p'}, + {"server", required_argument, 0, 's'}, + {"version", no_argument, 0, 'v'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; - int c = getopt_long (argc, argv, "cnhMu:p:s:", long_options, &option_index); + int c = getopt_long (argc, argv, "cnhMVvu:p:s:", long_options, &option_index); /* Detect the end of the options. */ if ( c == -1 ) break; @@ -70,28 +73,31 @@ switch ( c ) { case 0: // If this option set a flag, do nothing else now if ( long_options[option_index].flag != 0 ) break; - + printf ("option %s", long_options[option_index].name); if ( optarg ) printf (" with arg %s", optarg); printf ("\n"); break; case 'c': option_dialog = true; break; + case 'V': option_version = true; break; + case 'M': withMetaServer = true; break; case 'h': #ifdef PACKAGE_NAME std::cout << PACKAGE_NAME << std::endl; #endif std::cout << std::endl << "Usage instructions" << std::endl; std::cout << " -h --help Show this information" << std::endl; + std::cout << " -v --version Show version information" << std::endl; std::cout << " -M --with-metaserver Connect to metaserver" << std::endl; std::cout << " -u name --username=name Set username to 'name'" << std::endl; std::cout << " -p pass --password=pass Set password to 'pass'" << std::endl; std::cout << " -s server --server=server Set server hostname to 'server'" << std::endl; + std::cout << " -V --checkversion See if a new version of opengate was released" << std::endl; std::cout << std::endl; std::cout << " -c --config Show config dialog" << std::endl; std::cout << " -n --no-config Disable config dialog, reuse last settings" << std::endl; delete log; return EXIT_SUCCESS; - case 'M': withMetaServer = true; break; case 'u': log->debug ( std::string ("Setting username to ") + optarg); username = optarg; @@ -101,15 +107,19 @@ password = optarg; break; case 's': - log->debug ( std::string ("Setting server to ") + optarg); - hostname = optarg; - break; - case '?': - // getopt_long already printed an error message. - break; - default: - // Fail on unkown options - abort(); + log->debug ( std::string ("Setting server to ") + optarg); + hostname = optarg; + break; + case 'v': + log->info ( std::string (PACKAGE_STRING) ); + delete log; + return EXIT_SUCCESS; + case '?': + // getopt_long already printed an error message. + break; + default: + // Fail on unkown options + abort(); } } @@ -125,7 +135,14 @@ if ( withMetaServer ){ OpenGate::MetaConnection meta( io_service ); - if ( meta.login( username, password ) > 0) { + int user_id = meta.login( username, password ); + if (( user_id > 0 ) && ( option_version == 1)) { + int response = meta.check_version( user_id ); + if (response == 1) { + log->debug( "Version is ok" ); + } else { + log->warn( "Version is not ok" ); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-06 22:22:32
|
Revision: 623 http://svn.sourceforge.net/opengate/?rev=623&view=rev Author: ultrasick Date: 2007-07-06 15:22:34 -0700 (Fri, 06 Jul 2007) Log Message: ----------- revert Modified Paths: -------------- trunk/data/guns/bender.xml Modified: trunk/data/guns/bender.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-06 22:19:06
|
Revision: 622 http://svn.sourceforge.net/opengate/?rev=622&view=rev Author: ultrasick Date: 2007-07-06 15:19:09 -0700 (Fri, 06 Jul 2007) Log Message: ----------- changed "type" to "projectile type" Modified Paths: -------------- trunk/data/guns/bender.xml Modified: trunk/data/guns/bender.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-06 20:27:37
|
Revision: 621 http://svn.sourceforge.net/opengate/?rev=621&view=rev Author: ultrasick Date: 2007-07-06 13:27:37 -0700 (Fri, 06 Jul 2007) Log Message: ----------- correcting category #10 "guns" instead of "weapons" because missiles are also weapons Modified Paths: -------------- trunk/data/misc/ids.xml Modified: trunk/data/misc/ids.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-06 17:35:38
|
Revision: 620 http://svn.sourceforge.net/opengate/?rev=620&view=rev Author: ultrasick Date: 2007-07-06 10:35:40 -0700 (Fri, 06 Jul 2007) Log Message: ----------- moved the docu. into subdir.s + added the docu. to add, remove and list game servers currently you can only remove your own game server till the net code is more clear how to find and kill dead servers Modified Paths: -------------- trunk/doc/meta_server/global_error_code_overview.odt trunk/doc/meta_server/global_error_code_overview.pdf Added Paths: ----------- trunk/doc/meta_server/client/ trunk/doc/meta_server/client/check_version.odt trunk/doc/meta_server/client/check_version.pdf trunk/doc/meta_server/client/login.odt trunk/doc/meta_server/client/login.pdf trunk/doc/meta_server/client/logout.odt trunk/doc/meta_server/client/logout.pdf trunk/doc/meta_server/game_server/ trunk/doc/meta_server/game_server/add_game_server.odt trunk/doc/meta_server/game_server/add_game_server.pdf trunk/doc/meta_server/game_server/list_game_servers.odt trunk/doc/meta_server/game_server/list_game_servers.pdf trunk/doc/meta_server/game_server/remove_game_server.odt trunk/doc/meta_server/game_server/remove_game_server.pdf Removed Paths: ------------- trunk/doc/meta_server/check_version.odt trunk/doc/meta_server/check_version.pdf trunk/doc/meta_server/login.odt trunk/doc/meta_server/login.pdf trunk/doc/meta_server/logout.odt trunk/doc/meta_server/logout.pdf trunk/doc/meta_server/server_and_metaserver.odt trunk/doc/meta_server/server_and_metaserver.pdf Deleted: trunk/doc/meta_server/check_version.odt =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/check_version.pdf =================================================================== (Binary files differ) Added: trunk/doc/meta_server/client/check_version.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/client/check_version.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/client/check_version.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/client/check_version.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/client/login.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/client/login.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/client/login.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/client/login.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/client/logout.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/client/logout.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/client/logout.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/client/logout.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/game_server/add_game_server.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/game_server/add_game_server.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/game_server/add_game_server.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/game_server/add_game_server.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/game_server/list_game_servers.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/game_server/list_game_servers.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/game_server/list_game_servers.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/game_server/list_game_servers.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/game_server/remove_game_server.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/game_server/remove_game_server.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/game_server/remove_game_server.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/game_server/remove_game_server.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/doc/meta_server/global_error_code_overview.odt =================================================================== (Binary files differ) Modified: trunk/doc/meta_server/global_error_code_overview.pdf =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/login.odt =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/login.pdf =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/logout.odt =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/logout.pdf =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/server_and_metaserver.odt =================================================================== (Binary files differ) Deleted: trunk/doc/meta_server/server_and_metaserver.pdf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-07-05 21:29:48
|
Revision: 619 http://svn.sourceforge.net/opengate/?rev=619&view=rev Author: egore Date: 2007-07-05 14:29:50 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Forgot to commit Added Paths: ----------- branches/ogsector/data/textures/BeamOrange.png Added: branches/ogsector/data/textures/BeamOrange.png =================================================================== (Binary files differ) Property changes on: branches/ogsector/data/textures/BeamOrange.png ___________________________________________________________________ Name: svn:mime-type + image/png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2007-07-05 21:28:11
|
Revision: 618 http://svn.sourceforge.net/opengate/?rev=618&view=rev Author: spom_spom Date: 2007-07-05 14:28:12 -0700 (Thu, 05 Jul 2007) Log Message: ----------- fixed -c flag Modified Paths: -------------- branches/ogsector/src/opengateclient.cpp Modified: branches/ogsector/src/opengateclient.cpp =================================================================== --- branches/ogsector/src/opengateclient.cpp 2007-07-05 21:26:35 UTC (rev 617) +++ branches/ogsector/src/opengateclient.cpp 2007-07-05 21:28:12 UTC (rev 618) @@ -53,6 +53,7 @@ {"no-config", no_argument, &option_dialog, 0}, /* These options don't set a flag. We distinguish them by their indices. */ {"help", no_argument, 0, 'h'}, + {"Metaserver", no_argument, 0, 'M'}, {"username", required_argument, 0, 'u'}, {"password", required_argument, 0, 'p'}, {"server", required_argument, 0, 's'}, @@ -74,6 +75,7 @@ if ( optarg ) printf (" with arg %s", optarg); printf ("\n"); break; + case 'c': option_dialog = true; break; case 'h': #ifdef PACKAGE_NAME std::cout << PACKAGE_NAME << std::endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-07-05 21:26:32
|
Revision: 617 http://svn.sourceforge.net/opengate/?rev=617&view=rev Author: egore Date: 2007-07-05 14:26:35 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Add images and stuff for excavator Modified Paths: -------------- trunk/data/guns/excavator.blend Added Paths: ----------- trunk/data/guns/excavator.xml trunk/data/guns/excavator_290x290.png trunk/data/guns/excavator_76x76.png Modified: trunk/data/guns/excavator.blend =================================================================== (Binary files differ) Added: trunk/data/guns/excavator.xml =================================================================== --- trunk/data/guns/excavator.xml (rev 0) +++ trunk/data/guns/excavator.xml 2007-07-05 21:26:35 UTC (rev 617) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> + +<container> + <object_id>167</object_id> + <name_de>Excavator</name_de> + <name_en>Excavator</name_en> + <category_id>10</category_id> + <faction_id>2</faction_id> + <required_rank>2</required_rank> + <type>mininglaser</type> + <size>1</size> + <mass>1478</mass> + <velocity>60</velocity> + <fire_delay>0.0</fire_delay> + <energy_per_shot>309</energy_per_shot> + <damage>700</damage> + <manufacturer>T&P Systems</manufacturer> + <production_center>Solrain Core</production_center> + <production_center>Solrain Wake</production_center> + <production_center>Solrain Cornea</production_center> + <required_component>titanium</required_component> + <required_component>vanadium</required_component> + <required_component>laser components</required_component> + <required_component>magnetics</required_component> + <life_time>0.1</life_time> +</container> Added: trunk/data/guns/excavator_290x290.png =================================================================== (Binary files differ) Property changes on: trunk/data/guns/excavator_290x290.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/data/guns/excavator_76x76.png =================================================================== (Binary files differ) Property changes on: trunk/data/guns/excavator_76x76.png ___________________________________________________________________ Name: svn:mime-type + image/png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2007-07-05 21:22:42
|
Revision: 616 http://svn.sourceforge.net/opengate/?rev=616&view=rev Author: spom_spom Date: 2007-07-05 14:22:44 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Add flag -M for optional connection to metaserver Modified Paths: -------------- branches/ogsector/src/opengateclient.cpp Modified: branches/ogsector/src/opengateclient.cpp =================================================================== --- branches/ogsector/src/opengateclient.cpp 2007-07-05 21:02:43 UTC (rev 615) +++ branches/ogsector/src/opengateclient.cpp 2007-07-05 21:22:44 UTC (rev 616) @@ -40,6 +40,7 @@ std::string username = "testuser"; std::string hostname = "localhost"; std::string password = "dummy"; + bool withMetaServer = false; OpenGate::LogManager *log = new OpenGate::LogManager(); log->setLogFile( "OpenGate.log" ); @@ -48,57 +49,56 @@ while (1) { static struct option long_options[] = { /* These options set a flag. */ - {"config", no_argument, &option_dialog, 1}, - {"no-config", no_argument, &option_dialog, 0}, + {"config", no_argument, &option_dialog, 1}, + {"no-config", no_argument, &option_dialog, 0}, /* These options don't set a flag. We distinguish them by their indices. */ - {"help", no_argument, 0, 'h'}, - {"username", required_argument, 0, 'u'}, - {"password", required_argument, 0, 'p'}, - {"server", required_argument, 0, 's'}, + {"help", no_argument, 0, 'h'}, + {"username", required_argument, 0, 'u'}, + {"password", required_argument, 0, 'p'}, + {"server", required_argument, 0, 's'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; - int c = getopt_long (argc, argv, "cnh:u:p:", long_options, &option_index); + int c = getopt_long (argc, argv, "cnhMu:p:s:", long_options, &option_index); /* Detect the end of the options. */ - if (c == -1) + if ( c == -1 ) break; + + switch ( c ) { + case 0: // If this option set a flag, do nothing else now + if ( long_options[option_index].flag != 0 ) break; + + printf ("option %s", long_options[option_index].name); + if ( optarg ) printf (" with arg %s", optarg); + printf ("\n"); break; - - switch (c) { - case 0: - // If this option set a flag, do nothing else now - if (long_options[option_index].flag != 0) - break; - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - case 'h': + case 'h': #ifdef PACKAGE_NAME - std::cout << PACKAGE_NAME << std::endl; + std::cout << PACKAGE_NAME << std::endl; #endif - std::cout << std::endl << "Usage instructions" << std::endl; - std::cout << " -h --help Show this information" << std::endl; - std::cout << " -u name --username=name Set username to 'name'" << std::endl; - std::cout << " -p pass --password=pass Set password to 'pass'" << std::endl; - std::cout << " -s server --server=server Set server hostname to 'server'" << std::endl; - std::cout << std::endl; - std::cout << " -c --config Show config dialog" << std::endl; - std::cout << " -n --no-config Disable config dialog, reuse last settings" << std::endl; - delete log; - return EXIT_SUCCESS; - case 'u': - log->debug ( std::string ("Setting username to ") + optarg); - username = optarg; - break; - case 'p': - log->debug ( std::string ("Setting password to ") + optarg); - password = optarg; - break; - case 's': + std::cout << std::endl << "Usage instructions" << std::endl; + std::cout << " -h --help Show this information" << std::endl; + std::cout << " -M --with-metaserver Connect to metaserver" << std::endl; + std::cout << " -u name --username=name Set username to 'name'" << std::endl; + std::cout << " -p pass --password=pass Set password to 'pass'" << std::endl; + std::cout << " -s server --server=server Set server hostname to 'server'" << std::endl; + std::cout << std::endl; + std::cout << " -c --config Show config dialog" << std::endl; + std::cout << " -n --no-config Disable config dialog, reuse last settings" << std::endl; + delete log; + return EXIT_SUCCESS; + case 'M': withMetaServer = true; break; + case 'u': + log->debug ( std::string ("Setting username to ") + optarg); + username = optarg; + break; + case 'p': + log->debug ( std::string ("Setting password to ") + optarg); + password = optarg; + break; + case 's': log->debug ( std::string ("Setting server to ") + optarg); hostname = optarg; break; @@ -117,22 +117,26 @@ log->info(PACKAGE_STRING); #endif - log->info( std::string( "User: " + username + " looking for host: " + hostname ) ); asio::io_service io_service; + + if ( withMetaServer ){ + OpenGate::MetaConnection meta( io_service ); + if ( meta.login( username, password ) > 0) { + } + } + OpenGate::NetworkClient nw( io_service, hostname ); - OpenGate::MetaConnection meta( io_service ); - if (meta.login( username, password ) > 0) { - + if ( nw.online() ){ // //** waiting for userid; asio::thread t( boost::bind( & asio::io_service::run, & io_service ) ); - + while( nw.online() && nw.userID() == 0 ){ myMSleep( 100 ); } - + log->info( std::string( "Userid: " + toStr(nw.userID() ) ) ); log->info( std::string( "Login user: " + username + " to: " + nw.hostname() ) ); nw.login( username ); @@ -156,7 +160,7 @@ #endif } - } + nw.close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-07-05 21:02:42
|
Revision: 615 http://svn.sourceforge.net/opengate/?rev=615&view=rev Author: egore Date: 2007-07-05 14:02:43 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Add a possible server to metaserver interface (not yet final, not yet implemented) Added Paths: ----------- trunk/doc/meta_server/server_and_metaserver.odt trunk/doc/meta_server/server_and_metaserver.pdf Added: trunk/doc/meta_server/server_and_metaserver.odt =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/server_and_metaserver.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/doc/meta_server/server_and_metaserver.pdf =================================================================== (Binary files differ) Property changes on: trunk/doc/meta_server/server_and_metaserver.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-07-05 20:21:15
|
Revision: 614 http://svn.sourceforge.net/opengate/?rev=614&view=rev Author: egore Date: 2007-07-05 13:21:18 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Add .svnignore files to hide stuff from svn that does not belong there. To update these files, go into the directory, edit it to your needs and call "svn propset svn:ignore -F .svnignore ." afterwards Also add authentication against the meta server. Also add improved commandline parsing based on getopt. I guess it's good I have to write C++ at work. This helps a lot :-) Modified Paths: -------------- branches/ogsector/configure.ac branches/ogsector/runClient.sh branches/ogsector/src/Makefile.am branches/ogsector/src/Makefile.in branches/ogsector/src/metaserver.cpp branches/ogsector/src/metaserver.h branches/ogsector/src/networkClient.cpp branches/ogsector/src/networkClient.h branches/ogsector/src/opengateclient.cpp Added Paths: ----------- branches/ogsector/.svnignore branches/ogsector/src/.svnignore Property Changed: ---------------- branches/ogsector/ branches/ogsector/src/ Property changes on: branches/ogsector ___________________________________________________________________ Name: svn:ignore + *.log configure Makefile.in config.h Makefile config.status stamp-h1 opengate.depend autom4te.cache Added: branches/ogsector/.svnignore =================================================================== --- branches/ogsector/.svnignore (rev 0) +++ branches/ogsector/.svnignore 2007-07-05 20:21:18 UTC (rev 614) @@ -0,0 +1,9 @@ +*.log +configure +Makefile.in +config.h +Makefile +config.status +stamp-h1 +opengate.depend +autom4te.cache Modified: branches/ogsector/configure.ac =================================================================== --- branches/ogsector/configure.ac 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/configure.ac 2007-07-05 20:21:18 UTC (rev 614) @@ -54,7 +54,7 @@ AC_SUBST([CXXFLAGS], ["${CXXFLAGS} -Wall -I$OGSECTOR_EXTERNALS_PATH/include"]) AC_SUBST([CXXFLAGS], ["${CXXFLAGS} -I$OGSECTOR_EXTERNALS_PATH/ogreopcode/include"]) AC_SUBST([CXXFLAGS], ["${CXXFLAGS} -I$OGSECTOR_EXTERNALS_PATH/ogreopcode/opcode132"]) -AC_SUBST([LDFLAGS], ["${LDFLAGS} -L$OGSECTOR_EXTERNALS_PATH/lib/ -lOpcode -lOgreOpcode"]) +AC_SUBST([LDFLAGS], ["${LDFLAGS} -L$OGSECTOR_EXTERNALS_PATH/lib/ -lOpcode -lOgreOpcode -lboost_regex"]) #AC_SUBST([CXXFLAGS], ["-g -Wall ${CXXFLAGS}"]) dnl #libopcode Modified: branches/ogsector/runClient.sh =================================================================== --- branches/ogsector/runClient.sh 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/runClient.sh 2007-07-05 20:21:18 UTC (rev 614) @@ -10,6 +10,4 @@ export LD_LIBRARY_PATH=./externals/lib:$LD_LIBRARY_PATH -echo "starting client for user: $USERNAME and looking for host: $HOSTNAME" - -./src/opengateclient $USERNAME $HOSTNAME --ogreconfig=0 +./src/opengateclient --no-config $* Property changes on: branches/ogsector/src ___________________________________________________________________ Name: svn:ignore + opengateserver .deps Makefile testopenalmanager opengateclient Added: branches/ogsector/src/.svnignore =================================================================== --- branches/ogsector/src/.svnignore (rev 0) +++ branches/ogsector/src/.svnignore 2007-07-05 20:21:18 UTC (rev 614) @@ -0,0 +1,5 @@ +opengateserver +.deps +Makefile +testopenalmanager +opengateclient Modified: branches/ogsector/src/Makefile.am =================================================================== --- branches/ogsector/src/Makefile.am 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/Makefile.am 2007-07-05 20:21:18 UTC (rev 614) @@ -56,7 +56,9 @@ Vessel.h \ Vessel.cpp \ VesselManager.h \ - VesselManager.cpp + VesselManager.cpp \ + metaserver.h \ + metaserver.cpp opengateserver_SOURCES = \ opengateserver.cpp \ Modified: branches/ogsector/src/Makefile.in =================================================================== --- branches/ogsector/src/Makefile.in 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/Makefile.in 2007-07-05 20:21:18 UTC (rev 614) @@ -60,7 +60,7 @@ OpcodeWrapper.$(OBJEXT) Projectile.$(OBJEXT) Sector.$(OBJEXT) \ SectorObjects.$(OBJEXT) ShipConfigDialog.$(OBJEXT) \ UnDockedState.$(OBJEXT) Vessel.$(OBJEXT) \ - VesselManager.$(OBJEXT) + VesselManager.$(OBJEXT) metaserver.$(OBJEXT) opengateclient_OBJECTS = $(am_opengateclient_OBJECTS) opengateclient_LDADD = $(LDADD) am_opengateserver_OBJECTS = opengateserver.$(OBJEXT) common.$(OBJEXT) \ @@ -237,7 +237,9 @@ Vessel.h \ Vessel.cpp \ VesselManager.h \ - VesselManager.cpp + VesselManager.cpp \ + metaserver.h \ + metaserver.cpp opengateserver_SOURCES = \ opengateserver.cpp \ @@ -354,6 +356,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vessel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VesselManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaserver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkClient.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkProtocol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkServer.Po@am__quote@ Modified: branches/ogsector/src/metaserver.cpp =================================================================== --- branches/ogsector/src/metaserver.cpp 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/metaserver.cpp 2007-07-05 20:21:18 UTC (rev 614) @@ -19,59 +19,63 @@ ***************************************************************************/ #include "metaserver.h" +#include <boost/regex.hpp> namespace OpenGate{ -MetaConnection::MetaConnection( asio::io_service & io_service, const std::string & hostName ) - : io_service_( io_service ), socket_( io_service ), resolver_( io_service ), - hostname_( hostName ) { +MetaConnection::MetaConnection(asio::io_service & io_service) : + io_service_( io_service ), socket_( io_service ), resolver_( io_service ) { + // Get instance to the log manager log_ = LogManager::getSingletonPtr(); + hostname_ = std::string( "opacma.ontheserver.de" ); - try { - asio::ip::tcp::resolver::query query(hostName.c_str(), "http"); - asio::ip::tcp::resolver::iterator endpoint_iterator = resolver_.resolve(query); - asio::ip::tcp::resolver::iterator end; + log_->info( std::string( "Querying " ) + hostname_); - // Try each endpoint until we successfully establish a connection. - asio::error error = asio::error::host_not_found; - while (error && endpoint_iterator != end) - { + asio::error error = asio::error::host_not_found; + try{ + tcp::resolver::query query(hostname_, "http"); + tcp::resolver::iterator endpoint_iterator = resolver_.resolve(query); + tcp::resolver::iterator end; + + while ( error && endpoint_iterator != end ) { socket_.close(); - socket_.connect(*endpoint_iterator++, asio::assign_error(error)); + socket_.connect( *endpoint_iterator++, asio::assign_error( error ) ); } - if (error) - throw error; - } catch ( asio::error & e) { log_->fatal( e.what() ); + } catch ( std::exception & e) { + log_->fatal( std::string( "Exception: " ) + e.what() ); } catch (...) { log_->fatal( "Unkown exception occured while resolving the metaserver" ); } +} +MetaConnection::~MetaConnection() { + // asio doesn't need a cleanup, right? } -#define SCRIPT_PATH "/script/schnittstelle/" +int MetaConnection::login( const std::string & userName, const std::string & passwd ) { -void MetaConnection::login( const std::string & userName, const std::string & passwd ) { + std::cout << userName << ":" << passwd << std::endl; + try { - // Form the request. We specify the "Connection: close" header so that the // server will close the socket after transmitting the response. This will // allow us to treat all data up until the EOF as the content. asio::streambuf request; std::ostream request_stream(&request); - request_stream << "GET " SCRIPT_PATH << "?action=login&username=" <<userName <<"&password=" << passwd << " HTTP/1.0\r\n"; + request_stream << "GET " << "/script/schnittstelle/?action=login&username=" << userName << "&password=" << passwd << " HTTP/1.0\r\n"; request_stream << "Host: " << hostname_ << "\r\n"; request_stream << "Accept: */*\r\n"; request_stream << "Connection: close\r\n\r\n"; // Send the request. - asio::write(socket, request); + asio::write(socket_, request); // Read the response status line. asio::streambuf response; - asio::read_until(socket, response, boost::regex("\r\n")); + asio::read_until(socket_, response, boost::regex("\r\n")); // Check that response is OK. std::istream response_stream(&response); @@ -81,41 +85,65 @@ response_stream >> status_code; std::string status_message; std::getline(response_stream, status_message); - if (!response_stream || http_version.substr(0, 5) != "HTTP/"){ - log_->fatal( "Invalid response from metaserver " ); - return; + if ( !response_stream || http_version.substr(0, 5) != "HTTP/" ) { + std::cout << "Invalid response\n"; + return -1; } - if (status_code != 200){ - log_->fatal( std::string("Response returned with status code ") /* + status_code FIXME: I suck at CPP streams */ ); - return; + if (status_code != 200) { + std::cout << "Response returned with status code " << status_code << "\n"; + return -2; } // Read the response headers, which are terminated by a blank line. - asio::read_until(socket, response, boost::regex("\r\n\r\n")); + asio::read_until(socket_, response, boost::regex("\r\n\r\n")); - // Process the response headers. + // Process the response headers. (to get the crap of the response before reading the body!) std::string header; - while (std::getline(response_stream, header) && header != "\r") - std::cout << header << "\n"; - std::cout << "\n"; + while (std::getline(response_stream, header) && header != "\r"); - // Write whatever content we already have to output. - if (response.size() > 0) - std::cout << &response; + // We got a usefull body. The body is an int, lets use it. + if (response.size() > 0) { + std::ostringstream stream; + stream << &response; + int returncode = toInt( stream.str() ); + switch (returncode) { + case -101: log_->warn ( std::string ("no action given") ); return -3; + case -102: log_->warn ( std::string ("action given but unknown") ); return -3; + case -103: log_->warn ( std::string ("database is not available") ); return -3; + case -8: log_->warn ( std::string ("no username given") ); return -3; + case -9: log_->warn ( std::string ("no password given") ); return -3; + case -10: log_->warn ( std::string ("username doesn't exist") ); return -3; + case -11: log_->warn ( std::string ("password incorrect") ); return -3; + default: + if (returncode > 0) { + return returncode; + } else { + log_->warn ( std::string ("unkown return code for login ") + toStr( returncode ) ); + return -4; + } + } + } + asio::error error = asio::error::eof; // Read until EOF, writing data to output as we go. - asio::error error = asio::error::eof; - while (asio::read(socket, response, + while (asio::read(socket_, response, asio::transfer_at_least(1), asio::assign_error(error))) std::cout << &response; if (error != asio::error::eof) throw error; + } catch ( asio::error & e) { log_->fatal( e.what() ); + return -5; + } catch ( std::exception & e) { + log_->fatal( std::string( "Exception: " ) + e.what() ); + return -5; } catch (...) { - log_->fatal( "Unkown exception occured while resolving the metaserver" ); + log_->fatal( "Unkown exception occured while resolving the server" ); + return -5; } + return 1; } } // namespace OpenGate Modified: branches/ogsector/src/metaserver.h =================================================================== --- branches/ogsector/src/metaserver.h 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/metaserver.h 2007-07-05 20:21:18 UTC (rev 614) @@ -22,27 +22,27 @@ #define _OPENGATE_METASERVER__H #include <asio.hpp> -#include <boost/bind.hpp> - #include "LogManager.h" +using asio::ip::tcp; + namespace OpenGate{ class MetaConnection { public: - MetaConnection( asio::io_service & io_service, const std::string & hostName ); - + MetaConnection(asio::io_service & io_service); ~MetaConnection(); - void login( const std::string & userName, const std::string & passwd ); + int login( const std::string & userName, const std::string & passwd = "" ); + private: - asio::io_service & io_service_; - asio::ip::tcp::socket socket_; - asio::ip::tcp::resolver resolver_; + LogManager *log_; std::string hostname_; - LogManager *log_; + asio::io_service & io_service_; + tcp::socket socket_; + tcp::resolver resolver_; }; Modified: branches/ogsector/src/networkClient.cpp =================================================================== --- branches/ogsector/src/networkClient.cpp 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/networkClient.cpp 2007-07-05 20:21:18 UTC (rev 614) @@ -35,7 +35,7 @@ pingTime_ = 0; userID_ = 0; - log_->info( std::string( "Connecting to " ) + hostname_ + ":" + toStr( 1234 ) ); + log_->info( std::string( "Connecting to " ) + hostname_ + ":" + toStr( (int)OG_PORT ) ); asio::error error = asio::error::host_not_found; try{ @@ -52,6 +52,7 @@ } catch ( std::exception & e) { log_->fatal( std::string( "Exception: " ) + e.what() ); } catch (...) { + log_->fatal( "Unkown exception occured while resolving the server" ); } if ( !error ){ log_->info( "Connected: waiting for userID. " ); Modified: branches/ogsector/src/networkClient.h =================================================================== --- branches/ogsector/src/networkClient.h 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/networkClient.h 2007-07-05 20:21:18 UTC (rev 614) @@ -87,7 +87,7 @@ asio::io_service & io_service_; tcp::socket socket_; - tcp::resolver resolver_; + tcp::resolver resolver_; std::string hostname_; bool online_; Modified: branches/ogsector/src/opengateclient.cpp =================================================================== --- branches/ogsector/src/opengateclient.cpp 2007-07-05 20:17:15 UTC (rev 613) +++ branches/ogsector/src/opengateclient.cpp 2007-07-05 20:21:18 UTC (rev 614) @@ -31,39 +31,99 @@ #include "GameStateManager.h" #include "DockedState.h" #include "UnDockedState.h" +#include "metaserver.h" +#include <getopt.h> int main( int argc, char * argv[ ] ) { + int option_dialog = 1; + std::string username = "testuser"; + std::string hostname = "localhost"; + std::string password = "dummy"; + OpenGate::LogManager *log = new OpenGate::LogManager(); log->setLogFile( "OpenGate.log" ); log->setChatLogFile( "OpenGateChat.log" ); + + while (1) { + static struct option long_options[] = { + /* These options set a flag. */ + {"config", no_argument, &option_dialog, 1}, + {"no-config", no_argument, &option_dialog, 0}, + /* These options don't set a flag. We distinguish them by their indices. */ + {"help", no_argument, 0, 'h'}, + {"username", required_argument, 0, 'u'}, + {"password", required_argument, 0, 'p'}, + {"server", required_argument, 0, 's'}, + {0, 0, 0, 0} + }; + + /* getopt_long stores the option index here. */ + int option_index = 0; + int c = getopt_long (argc, argv, "cnh:u:p:", long_options, &option_index); + + /* Detect the end of the options. */ + if (c == -1) + break; + + switch (c) { + case 0: + // If this option set a flag, do nothing else now + if (long_options[option_index].flag != 0) + break; + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + case 'h': +#ifdef PACKAGE_NAME + std::cout << PACKAGE_NAME << std::endl; +#endif + std::cout << std::endl << "Usage instructions" << std::endl; + std::cout << " -h --help Show this information" << std::endl; + std::cout << " -u name --username=name Set username to 'name'" << std::endl; + std::cout << " -p pass --password=pass Set password to 'pass'" << std::endl; + std::cout << " -s server --server=server Set server hostname to 'server'" << std::endl; + std::cout << std::endl; + std::cout << " -c --config Show config dialog" << std::endl; + std::cout << " -n --no-config Disable config dialog, reuse last settings" << std::endl; + delete log; + return EXIT_SUCCESS; + case 'u': + log->debug ( std::string ("Setting username to ") + optarg); + username = optarg; + break; + case 'p': + log->debug ( std::string ("Setting password to ") + optarg); + password = optarg; + break; + case 's': + log->debug ( std::string ("Setting server to ") + optarg); + hostname = optarg; + break; + case '?': + // getopt_long already printed an error message. + break; + default: + // Fail on unkown options + abort(); + } + } + log->info("Starting up"); #ifdef PACKAGE_STRING log->info(PACKAGE_STRING); #endif - std::string username = "testuser"; - std::string hostname = "localhost"; - std::string password = ""; - bool dialog = true; - if ( argc > 1 ){ - username = argv[ 1 ]; - } - if ( argc > 2 ){ - username = argv[ 1 ]; - hostname = argv[ 2 ]; - } - if ( argc > 3 ){ - std::string dialogStr( argv[ 3 ] ); - if ( dialogStr.find( "--ogreconfig=0", 0 ) != std::string::npos ) dialog = false; - } - log->info( std::string( "User: " + username + " looking for host: " + hostname ) ); asio::io_service io_service; OpenGate::NetworkClient nw( io_service, hostname ); + OpenGate::MetaConnection meta( io_service ); + if (meta.login( username, password ) > 0) { if ( nw.online() ){ // //** waiting for userid; @@ -82,7 +142,7 @@ } try { - OpenGate::GameStateManager gameStateMgr( nw, dialog ); + OpenGate::GameStateManager gameStateMgr( nw, option_dialog ); OpenGate::DockedState::create( &gameStateMgr, "DockedState" ); OpenGate::UnDockedState::create( &gameStateMgr, "UnDockedState" ); gameStateMgr.start( gameStateMgr.findByName( "DockedState" ) ); @@ -95,6 +155,9 @@ log->fatal( std::string("An exception has occured: ") + e.getFullDescription().c_str() ); #endif } + + } + nw.close(); delete log; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2007-07-05 20:17:13
|
Revision: 613 http://svn.sourceforge.net/opengate/?rev=613&view=rev Author: spom_spom Date: 2007-07-05 13:17:15 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Minor laser related fix Modified Paths: -------------- branches/ogsector/src/Projectile.cpp branches/ogsector/src/Sector.cpp Modified: branches/ogsector/src/Projectile.cpp =================================================================== --- branches/ogsector/src/Projectile.cpp 2007-07-05 20:16:17 UTC (rev 612) +++ branches/ogsector/src/Projectile.cpp 2007-07-05 20:17:15 UTC (rev 613) @@ -194,8 +194,13 @@ } } else { if ( beam_ ){ - shape_->scale( 1.0, 1.0, max( 1.0f, ( shape_->getScale()[2]-(vel_ * elapsedTime).length()) ) - /shape_->getScale()[2] ); + Ogre::Real beamLength = min( (vel_ * lifeTime_).length(), 300.0f ); + beamLength -= ( parent_->mainNode()->getWorldPosition() + ( vel_ * lifeTime_ ) - + mainNode_->getWorldPosition() ).length(); + + if ( beamLength > 0 ){ + shape_->scale( 1.0, 1.0, beamLength / shape_->getScale()[ 2 ] ); + } } } } Modified: branches/ogsector/src/Sector.cpp =================================================================== --- branches/ogsector/src/Sector.cpp 2007-07-05 20:16:17 UTC (rev 612) +++ branches/ogsector/src/Sector.cpp 2007-07-05 20:17:15 UTC (rev 613) @@ -148,10 +148,6 @@ populate( "testsector.xml" ); // createCircle(); - SectorObject *obj = createStaticObject( "lady_kickstart.mesh", "lady_kickstart", Ogre::Vector3( 0,0,450) ); - obj->setBaseRot( -90, -90, 0 ); - obj->setBaseSize( Ogre::Vector3( 10, 3.4, 10.9 ) ); - itTarget_ = sectorObjects_.begin(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-07-05 20:16:15
|
Revision: 612 http://svn.sourceforge.net/opengate/?rev=612&view=rev Author: egore Date: 2007-07-05 13:16:17 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Add file for doxygen to generate API docs Added Paths: ----------- branches/ogsector/Doxyfile Added: branches/ogsector/Doxyfile =================================================================== --- branches/ogsector/Doxyfile (rev 0) +++ branches/ogsector/Doxyfile 2007-07-05 20:16:17 UTC (rev 612) @@ -0,0 +1,277 @@ +# Doxyfile 1.5.2 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = opengate +PROJECT_NUMBER = 0.0.1 +OUTPUT_DIRECTORY = /home/cbrill/source/opengate/branches/ogsector/doc/ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /home/cbrill/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/cbrill/source/opengate/branches/ogsector/src/ +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.C \ + *.CC \ + *.C++ \ + *.II \ + *.I++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS \ + *.PHP \ + *.PHP3 \ + *.M \ + *.MM \ + *.PY +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2007-07-05 19:32:38
|
Revision: 611 http://svn.sourceforge.net/opengate/?rev=611&view=rev Author: spom_spom Date: 2007-07-05 12:32:38 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Adapt engine- and gun mointpoints from xml-file. Add laser as default gun. Improved chase camera (keys: 1--6) Modified Paths: -------------- branches/ogsector/ToDo branches/ogsector/data/gui/layouts/dialogs/MarketDialog.layout branches/ogsector/data/materials/ammo.material branches/ogsector/resources.cfg branches/ogsector/src/Avatar.cpp branches/ogsector/src/DeviceManager.cpp branches/ogsector/src/DeviceManager.h branches/ogsector/src/Entity.h branches/ogsector/src/EntityManager.cpp branches/ogsector/src/EntityManager.h branches/ogsector/src/GameStateManager.cpp branches/ogsector/src/MarketDialog.cpp branches/ogsector/src/Projectile.cpp branches/ogsector/src/Projectile.h branches/ogsector/src/Sector.cpp branches/ogsector/src/SectorObjects.cpp branches/ogsector/src/SectorObjects.h branches/ogsector/src/ShipConfigDialog.cpp branches/ogsector/src/ShipConfigDialog.h branches/ogsector/src/UnDockedState.cpp branches/ogsector/src/UnDockedState.h branches/ogsector/src/Vessel.cpp branches/ogsector/src/Vessel.h branches/ogsector/src/VesselManager.cpp branches/ogsector/src/common.cpp branches/ogsector/win32/ogsectorclient/resources.cfg trunk/data/guns/bender.xml trunk/data/misc/ids.xml trunk/data/ships/octavius/apteryx/apteryx.xml trunk/data/ships/quantar/storm/storm.xml trunk/data/ships/squadrok/squid/squid.xml trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml Added Paths: ----------- branches/ogsector/data/textures/BeamGreen.png Modified: branches/ogsector/ToDo =================================================================== --- branches/ogsector/ToDo 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/ToDo 2007-07-05 19:32:38 UTC (rev 611) @@ -164,3 +164,5 @@ -Fire: "Spark, " Funke, Brand, Leuchtfeuer, Phoenix, Fl\xE4chenbrand, Feuerball, Hephaistos, Vulkanus, Hitze, Flamme, Sonne, Plasma, Hestia = (griech.) G\xF6ttin des Herdfeuers, Loki = (germ.) Gott des Feuers, Pele = (polyn.) G\xF6ttin der Vulkane und des Feuers, Asche, irrlicht -Wave: "Frizzle, " Brandung,Tsunami,Kr\xE4usel, Rayleigh waves, Love wave, Gicht, Monsterwelle, Aegir = (germ.) Gott des Meeres,Poseidon = (griech.) Gott des Wassers und Meeres, Sedna = (innuit) G\xF6ttin des Meeres, Woge, Brecher, D\xFCnung, Seegang, See, Wellenschlag, Ebbe, Flut, Str\xF6mung, leises Pl\xE4tschern, crystal + + -Guns: Dazzler \ No newline at end of file Modified: branches/ogsector/data/gui/layouts/dialogs/MarketDialog.layout =================================================================== --- branches/ogsector/data/gui/layouts/dialogs/MarketDialog.layout 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/data/gui/layouts/dialogs/MarketDialog.layout 2007-07-05 19:32:38 UTC (rev 611) @@ -120,6 +120,15 @@ <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 60}}" /> <Property Name="UnifiedSize" Value="{{0.0, 50},{0.0, 20}}" /> </Window> + + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs5a"> + <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 80}}" /> + <Property Name="UnifiedSize" Value="{{0.0, 100},{0.0, 20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs5b"> + <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 80}}" /> + <Property Name="UnifiedSize" Value="{{0.0, 50},{0.0, 20}}" /> + </Window> </Window> <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Amount"> <Property Name="UnifiedPosition" Value="{{0.0, 0},{1.0, -60}}" /> Modified: branches/ogsector/data/materials/ammo.material =================================================================== --- branches/ogsector/data/materials/ammo.material 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/data/materials/ammo.material 2007-07-05 19:32:38 UTC (rev 611) @@ -17,3 +17,23 @@ } } } + +material BeamGreen +{ + technique + { + pass + { + depth_check on + depth_write off + lighting off +// scene_blend add + scene_blend alpha_blend + + texture_unit + { + texture BeamGreen.png + } + } + } +} Added: branches/ogsector/data/textures/BeamGreen.png =================================================================== (Binary files differ) Property changes on: branches/ogsector/data/textures/BeamGreen.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: branches/ogsector/resources.cfg =================================================================== --- branches/ogsector/resources.cfg 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/resources.cfg 2007-07-05 19:32:38 UTC (rev 611) @@ -12,6 +12,7 @@ FileSystem=../../trunk/data/shields FileSystem=../../trunk/data/ECMs FileSystem=../../trunk/data/power_plants +FileSystem=../../trunk/data/guns FileSystem=../../trunk/data/ships/octavius/apteryx FileSystem=../../trunk/data/ships/quantar/storm FileSystem=../../trunk/data/ships/tauseti/lady_kickstart Modified: branches/ogsector/src/Avatar.cpp =================================================================== --- branches/ogsector/src/Avatar.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/Avatar.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -113,24 +113,44 @@ bool Avatar::unLoadItem( Entity * item ){ - switch( item->entityType() ){ - case POWERPLANT: vessel_->setPowerPlant( NULL ); - break; - case ENGINE: vessel_->setEngine( NULL ); - break; - case RADAR: vessel_->setRadar( NULL ); - break; - case ECM: vessel_->setEcm( NULL ); - break; - case SHIELD: vessel_->setShield( NULL ); - break; - case CAPACITOR: vessel_->setCapacitor( NULL ); - break; - default: break; + if ( item ){ + std::vector < Entity * > items; items.push_back( item ); + + switch( item->entityType() ){ + case POWERPLANT: + if ( vessel_->powerPlant() != NULL ){ + addCargoToFloor( items ); + vessel_->setPowerPlant( NULL ); + } break; + case ENGINE: + if ( vessel_->engine() != NULL ){ + addCargoToFloor( items ); + vessel_->setEngine( NULL ); + } break; + case RADAR: + if ( vessel_->radar() != NULL ){ + addCargoToFloor( items ); + vessel_->setRadar( NULL ); + } break; + case ECM: + if ( vessel_->ecm() != NULL ){ + addCargoToFloor( items ); + vessel_->setEcm( NULL ); + } break; + case SHIELD: + if ( vessel_->shield() != NULL ){ + addCargoToFloor( items ); + vessel_->setShield( NULL ); + } break; + case CAPACITOR: + if ( vessel_->capacitor() != NULL ){ + addCargoToFloor( items ); + vessel_->setCapacitor( NULL ); + } break; + default: break; + } } - std::vector < Entity * > items; items.push_back( item ); - addCargoToFloor( items ); return true; } Modified: branches/ogsector/src/DeviceManager.cpp =================================================================== --- branches/ogsector/src/DeviceManager.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/DeviceManager.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -93,7 +93,7 @@ return; } - for ( pElem = hRoot.FirstChild( "faction" ).Element(); pElem != 0; pElem = pElem->NextSiblingElement() ) { + for ( pElem = hRoot.FirstChild( "faction" ).Element(); pElem != 0; pElem = pElem->NextSiblingElement("faction") ) { pElemId = pElem->FirstChildElement( "faction_id" ); pElemName = pElem->FirstChildElement( "name_en" ); if ( pElemId && pElemName ) { Modified: branches/ogsector/src/DeviceManager.h =================================================================== --- branches/ogsector/src/DeviceManager.h 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/DeviceManager.h 2007-07-05 19:32:38 UTC (rev 611) @@ -31,11 +31,13 @@ namespace OpenGate{ enum EntityType{NONE,ENTITY,VESSEL,COMMODITY,POWERPLANT,ENGINE,RADAR,ECM,CAPACITOR,SHIELD,GUN,MISSILE,MODX}; +enum GunType{LASER,BULLET}; /*! * \brief This is a storage to handle current status of several things * * \todo Describe what it is used for, I don't really get it. + * The class holds all global information about games devices and ids * \author Carsten <spo...@us...> */ Modified: branches/ogsector/src/Entity.h =================================================================== --- branches/ogsector/src/Entity.h 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/Entity.h 2007-07-05 19:32:38 UTC (rev 611) @@ -337,7 +337,44 @@ Uint32 capacity_; }; +class Gun : public Equipment{ +public: + Gun(): Equipment(){ + rtti_ = GUN; + type_ = LASER; + } + void setType( GunType type ) { type_ = type; } + GunType type() const { return type_; } + + void setEnergy( Uint32 energy ){ powerConsumption_ = energy; + if ( powerConsumption_ < 1e4 ) powerConsumption_ *= 1000; } + + void setDamage( Uint32 damage ) { damage_ = damage; + if ( damage_ < 1e4 ) damage_ *= 1000; } + Uint32 damage( ) const { return damage_; } + + void setSpeed( Uint32 speed ) { + std::cout << "setSpeed: " << speed << std::endl; + speed_ = speed; + } + Uint32 speed() const { return speed_; } + + void setLifeTime( Ogre::Real lifeTime ) { lifeTime_ = lifeTime; } + Ogre::Real lifeTime() const { return lifeTime_; }; + + void setFireDelay( Ogre::Real fireDelay ) { fireDelay_ = fireDelay; } + Ogre::Real fireDelay() const { return fireDelay_; } + +protected: + GunType type_; + Uint32 damage_; + Uint32 speed_; + Ogre::Real lifeTime_; + Ogre::Real fireDelay_; +}; + + /*! * \brief This class defines a commodity (goods, ore, etc. to build stuff from) * Modified: branches/ogsector/src/EntityManager.cpp =================================================================== --- branches/ogsector/src/EntityManager.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/EntityManager.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -128,6 +128,18 @@ return NULL; } +Gun * EquipmentManager::gun( const std::string & name ){ + Entity * item = entity( name ); + if ( !item ) return NULL; + + if ( item->entityType() == GUN ) { + return dynamic_cast< Gun * >(item); + } else { + LogManager::getSingleton().warn( name + " is no gun." ); + } + return NULL; +} + Entity * EquipmentManager::loadAndCreate( const std::string & fileName ){ log_->info( "Read equipment: " + fileName ); @@ -182,12 +194,13 @@ int category = toInt( pElem->FirstChild()->Value() ); switch( category ){ - case 1: entity = new Commodity(); break; - case 2: entity = new PowerPlant(); break; - case 4: entity = new Capacitor(); break; - case 6: entity = new Engine(); break; - case 7: entity = new Shield(); break; - case 8: entity = new Radar(); break; + case 1: entity = new Commodity(); break; + case 2: entity = new PowerPlant(); break; + case 4: entity = new Capacitor(); break; + case 6: entity = new Engine(); break; + case 7: entity = new Shield(); break; + case 8: entity = new Radar(); break; + case 10: entity = new Gun(); break; default: log_->fatal( fileName + " category_id " + toStr( category ) + " unknown." ); return NULL; @@ -314,6 +327,20 @@ break; case GUN: + pElem = hRoot.ChildElement( "velocity", 0 ).Element(); + if ( pElem ) dynamic_cast< Gun * >( entity )->setSpeed( toInt( pElem->FirstChild()->Value() ) ); + + pElem = hRoot.ChildElement( "life_time", 0 ).Element(); + if ( pElem ) dynamic_cast< Gun * >( entity )->setLifeTime( toDouble( pElem->FirstChild()->Value() ) ); + + pElem = hRoot.ChildElement( "fire_delay", 0 ).Element(); + if ( pElem ) dynamic_cast< Gun * >( entity )->setFireDelay( toDouble( pElem->FirstChild()->Value() ) ); + + pElem = hRoot.ChildElement( "energy_per_shot", 0 ).Element(); + if ( pElem ) dynamic_cast< Gun * >( entity )->setEnergy( toInt( pElem->FirstChild()->Value() ) ); + + pElem = hRoot.ChildElement( "damage", 0 ).Element(); + if ( pElem ) dynamic_cast< Gun * >( entity )->setDamage( toInt( pElem->FirstChild()->Value() ) ); break; case MISSILE: break; Modified: branches/ogsector/src/EntityManager.h =================================================================== --- branches/ogsector/src/EntityManager.h 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/EntityManager.h 2007-07-05 19:32:38 UTC (rev 611) @@ -147,6 +147,7 @@ Radar * radar( const std::string & name ); Shield * shield( const std::string & name ); Capacitor * capacitor( const std::string & name ); + Gun * gun( const std::string & name ); }; Modified: branches/ogsector/src/GameStateManager.cpp =================================================================== --- branches/ogsector/src/GameStateManager.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/GameStateManager.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -334,6 +334,7 @@ equipmentManager_->load( devices_.resourcePaths(), "radars" ); equipmentManager_->load( devices_.resourcePaths(), "shields" ); equipmentManager_->load( devices_.resourcePaths(), "power_plants" ); + equipmentManager_->load( devices_.resourcePaths(), "guns" ); devices_.gameStateRoot = this; Modified: branches/ogsector/src/MarketDialog.cpp =================================================================== --- branches/ogsector/src/MarketDialog.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/MarketDialog.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -545,14 +545,8 @@ CEGUI::WindowManager::getSingleton().getWindow( "MarketItemDetailedView/TextFrame/Rank" ) ->setProperty("Text", CEGUI::String("Required rank:" + toStr( item->techLevel() ) ) ); - CEGUI::String str1a(""); - CEGUI::String str1b(""); - CEGUI::String str2a(""); - CEGUI::String str2b(""); - CEGUI::String str3a(""); - CEGUI::String str3b(""); - CEGUI::String str4a(""); - CEGUI::String str4b(""); + CEGUI::String str1a(""), str1b(""), str2a(""), str2b(""), str3a(""), str3b(""); + CEGUI::String str4a(""), str4b(""), str5a(""), str5b(""); switch( item->entityType() ){ case POWERPLANT: @@ -578,6 +572,13 @@ str1a = "Efficiency:" ; str1b = toStr( dynamic_cast< Capacitor *>( item )->efficiency() ); str2a = "Max. Power:" ; str2b = toStr( dynamic_cast< Capacitor *>( item )->capacity()/1000 ) + "K"; break; + case GUN: + str1a = "Damage:" ; str1b = toStr( dynamic_cast< Gun *>( item )->damage() / 1000 ) + "K"; + str2a = "Speed:" ; str2b = toStr( dynamic_cast< Gun *>( item )->speed() ); + str3a = "Life time:" ; str3b = toStr( dynamic_cast< Gun *>( item )->lifeTime() ); + str4a = "Fire delay:" ; str4b = toStr( dynamic_cast< Gun *>( item )->fireDelay() ); + str5a = "Energy:" ; str5b = toStr( dynamic_cast< Gun *>( item )->powerConsumption() / 1000) + "K"; + break; default: break; } @@ -590,6 +591,8 @@ CEGUI::WindowManager::getSingleton().getWindow( "MarketItemDetailedView/EquipmentSpecs3b" )->setProperty( "Text", str3b ); CEGUI::WindowManager::getSingleton().getWindow( "MarketItemDetailedView/EquipmentSpecs4a" )->setProperty( "Text", str4a ); CEGUI::WindowManager::getSingleton().getWindow( "MarketItemDetailedView/EquipmentSpecs4b" )->setProperty( "Text", str4b ); + CEGUI::WindowManager::getSingleton().getWindow( "MarketItemDetailedView/EquipmentSpecs5a" )->setProperty( "Text", str5a ); + CEGUI::WindowManager::getSingleton().getWindow( "MarketItemDetailedView/EquipmentSpecs5b" )->setProperty( "Text", str5b ); } } Modified: branches/ogsector/src/Projectile.cpp =================================================================== --- branches/ogsector/src/Projectile.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/Projectile.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -29,9 +29,9 @@ namespace OpenGate{ -Projectile::Projectile( BaseObject * parent, long shotCounter, Ogre::Real speed, Uint32 damage, Ogre::Real liveTime ) +Projectile::Projectile( BaseObject * parent, long shotCounter, const GunObject & gun, const Ogre::Vector3 & mountPoint ) : BaseObject( parent->name() + "_" + toStr( shotCounter ), parent->sector() ), parent_( parent ), - shotCount_( shotCounter), damage_( damage ), maxLiveTime_( liveTime ){ + shotCount_( shotCounter), damage_( gun.gun()->damage() ), maxLifeTime_( gun.gun()->lifeTime() ){ selectable_ = false; Ogre::String bulletName( name_ + "_" + toStr( shotCounter ) ); @@ -40,11 +40,15 @@ bullet_ = NULL; shape_ = NULL; - Ogre::Vector3 position( parent_->mainNode()->getPosition() ); - Ogre::Quaternion direction( parent_->mainNode()->getOrientation() ); - bool bullet = true; + switch ( gun.gun()->type() ){ + case LASER: bullet = false; break; + case BULLET: bullet = true; break; + } + Ogre::Quaternion direction( parent_->mainNode()->getOrientation() ); + Ogre::Vector3 relGunPos( ( gun.sceneNode().getParentSceneNode()->getOrientation() * gun.sceneNode().getPosition() ) * + gun.sceneNode().getParentSceneNode()->getParentSceneNode()->getScale() ); if ( bullet ){ int maxBB = 20; bullet_ = sceneMgr_->createBillboardSet( bulletName + "_BBS", maxBB ); @@ -64,26 +68,27 @@ mainNode_->attachObject( bullet_ ); } else { - beam_ = sceneMgr_->createManualObject( bulletName + "_MObj" ); - beam_->begin( "WhiteNoBackground", Ogre::RenderOperation::OT_TRIANGLE_LIST); - -// beam_->position( direction.xAxis().normalisedCopy() * -0.2 ); -// beam_->position( direction.xAxis().normalisedCopy() * 0.2 ); -// beam_->position( direction.xAxis().normalisedCopy() * 0.2 + direction.zAxis().normalisedCopy() * 1.0 ); -// beam_->position( direction.xAxis().normalisedCopy() * -0.2 + direction.zAxis().normalisedCopy() * 1.0 ); + beam_ = sceneMgr_->createManualObject( bulletName + "_ManualObj" ); - beam_->position( -0.2, 0, 0 ); - beam_->position( 0.2, 0, 0 ); - beam_->position( 0.2, 0, 1.0 ); - beam_->position( -0.2, 0, 1.0 ); - + Ogre::Real width = 0.25; + beam_->begin( "BeamGreen", Ogre::RenderOperation::OT_TRIANGLE_LIST); + beam_->position( 0.0, -width, 0.0 ); beam_->textureCoord( 0, 0 ); + beam_->position( 0.0, width, 0.0 ); beam_->textureCoord( 1, 0 ); + beam_->position( 0.0, width, 1.0 ); beam_->textureCoord( 1, 1 ); + beam_->position( 0.0, -width, 1.0 ); beam_->textureCoord( 0, 1 ); beam_->quad( 0, 1, 2, 3 ); beam_->quad( 0, 3, 2, 1 ); beam_->end(); - + shape_ = mainNode_->createChildSceneNode( bulletName + "_transform" ); shape_->attachObject( beam_ ); + if ( fabs( relGunPos[ 0 ] ) > 1e-3 ){ + shape_->roll( Ogre::Degree( 0.0 ) ); + } else { + shape_->roll( Ogre::Radian( atan( relGunPos[ 1 ] / relGunPos[ 0 ] ) ) ); + } + mainNode_->setOrientation( direction ); } @@ -120,16 +125,13 @@ // mainNode_->attachObject( bullet_ ); - mainNode_->setPosition( position ); - mainNode_->setPosition( position + - direction.zAxis().normalisedCopy() * -6.2 + - direction.xAxis().normalisedCopy() * 1.5 + - direction.yAxis().normalisedCopy() * -0.2 ); + mainNode_->setPosition( gun.sceneNode().getWorldPosition() - direction.zAxis() * relGunPos[ 2 ] ); lifeTime_ = 0.0; oldTime_ = 0.0; - vel_ = speed * -direction.zAxis().normalisedCopy() + parent->velocity(); + vel_ = gun.gun()->speed() * -direction.zAxis().normalisedCopy() + parent->velocity(); + ammoHit_ = false; } Projectile::~Projectile() { @@ -152,19 +154,16 @@ void Projectile::collide( BaseObject * object ){ if ( name_ != object->name() ){ - vel_ *= 0.0; //** show us a small visible feedback; if ( bullet_ ){ + vel_ *= 0.0; bullet_->getBillboard( 0 )->setColour( Ogre::ColourValue(0.0, 1.0, 0.0) ); bullet_->getBillboard( 0 )->setDimensions( 5, 5 ); + lifeTime_ = max( lifeTime_, maxLifeTime_ - 0.1f ); } - lifeTime_ = max( lifeTime_, maxLiveTime_ - 0.1f ); - -// sector_->collisionContext()->removeObject( collObj_ ); -// OgreOpcode::CollisionManager::getSingletonPtr()->detachShape( collObj_->getShape() ); } - + ammoHit_ = true; sector_->sendVesselAmmoHit( *this, object ); } @@ -172,20 +171,32 @@ if ( elapsedTime < 0.001 ) return true; lifeTime_ += elapsedTime; - if ( lifeTime_ >= maxLiveTime_ ) return false; + if ( lifeTime_ >= maxLifeTime_ ) return false; if ( vel_.length() > 0.1 ){ - Ogre::Ray bulletRay( mainNode_->getPosition(), vel_.normalisedCopy() ); + if ( !ammoHit_ ){ - if ( !OpcodeCollisionDetection::getSingleton().checkCollideRay( this, bulletRay, (vel_ * elapsedTime).length() ) ){ - if ( bullet_ ){ - mainNode_->translate( vel_ * elapsedTime ); - } else if ( beam_ ){ - mainNode_->translate( vel_ * elapsedTime ); - shape_->setScale( 1.0, 1.0, (vel_ * lifeTime_).length() ); - // mainNode_->translate( 0.0, 0.0, - (vel_ * elapsedTime ).length()/2.0 ); + Ogre::Ray bulletRay( mainNode_->getPosition(), vel_.normalisedCopy() ); + + if ( !OpcodeCollisionDetection::getSingleton().checkCollideRay( this, bulletRay, (vel_ * elapsedTime).length() ) ){ + if ( bullet_ ){ + mainNode_->translate( vel_ * elapsedTime ); + } else if ( beam_ ){ + mainNode_->translate( vel_ * elapsedTime ); + Ogre::Real beamLength = min( (vel_ * lifeTime_).length(), 300.0f ); + + Ogre::Real beamWidthScale = 1.0; +// if ( beamLength > 299.0f ) beamWidthScale = 1; + + shape_->scale( 1.0, beamWidthScale, beamLength / shape_->getScale()[2] ); + } } + } else { + if ( beam_ ){ + shape_->scale( 1.0, 1.0, max( 1.0f, ( shape_->getScale()[2]-(vel_ * elapsedTime).length()) ) + /shape_->getScale()[2] ); + } } } return true; Modified: branches/ogsector/src/Projectile.h =================================================================== --- branches/ogsector/src/Projectile.h 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/Projectile.h 2007-07-05 19:32:38 UTC (rev 611) @@ -28,7 +28,7 @@ class Projectile : public BaseObject { public: - Projectile( BaseObject * parent, long shotCount, Ogre::Real speed, Uint32 damage, Ogre::Real liveTime ); + Projectile( BaseObject * parent, long shotCount, const GunObject & gun, const Ogre::Vector3 & mountPoint ); virtual ~Projectile(); @@ -46,7 +46,7 @@ Ogre::Vector3 velocity() const { return vel_; } - Ogre::Real liveTime() const { return maxLiveTime_; } + Ogre::Real lifeTime() const { return maxLifeTime_; } Uint16 shotCount() const { return shotCount_; } @@ -62,8 +62,9 @@ Ogre::SceneNode * shape_; - Ogre::Real maxLiveTime_; + Ogre::Real maxLifeTime_; Ogre::Real oldTime_; + bool ammoHit_; }; Modified: branches/ogsector/src/Sector.cpp =================================================================== --- branches/ogsector/src/Sector.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/Sector.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -148,9 +148,9 @@ populate( "testsector.xml" ); // createCircle(); -// SectorObject *obj = createStaticObject( "lady_kickstart.mesh", "lady_kickstart", Ogre::Vector3( 0,0,450) ); -// obj->setBaseRot( -90, -90, 0 ); -// obj->setBaseSize( Ogre::Vector3( 10, 3.4, 10.9 ) ); + SectorObject *obj = createStaticObject( "lady_kickstart.mesh", "lady_kickstart", Ogre::Vector3( 0,0,450) ); + obj->setBaseRot( -90, -90, 0 ); + obj->setBaseSize( Ogre::Vector3( 10, 3.4, 10.9 ) ); itTarget_ = sectorObjects_.begin(); } @@ -239,6 +239,7 @@ (*it)->factionName() + "/" + (*it)->name(), Ogre::Vector3( -1000.0, 50 * factionCounter, -100.0 + 100 * vesselCounter ) ); + obj->setBaseRot( (*it)->baseYaw(), (*it)->basePitch(), (*it)->baseRoll() ); obj->setBaseSize( (*it)->baseSize() ); vesselCounter++; @@ -249,7 +250,8 @@ } - for ( pElem = hRoot.FirstChild( "sectorobject" ).Element(); pElem != 0; pElem = pElem->NextSiblingElement() ) { + for ( pElem = hRoot.FirstChild( "sectorobject" ).Element(); pElem != 0; + pElem = pElem->NextSiblingElement("sectorobject") ) { std::string name; pSubElem = pElem->FirstChildElement( "name" ); if ( pSubElem ){ @@ -535,7 +537,7 @@ avatar_->reset(); avatar_->mainNode()->setPosition( 0.0, 0.0, 500.0 ); avatar_->mainNode()->setOrientation( Ogre::Quaternion( 1.0, 0.0, 0.0, 0.0 ) ); - avatar_->setVelocity( Ogre::Vector3( 0.0, 0.0, -20.0 ) ); + // avatar_->setVelocity( Ogre::Vector3( 0.0, 0.0, -20.0 ) ); avatar_->setVisible( false ); sendVesselRegister( avatar_ ); @@ -918,7 +920,7 @@ if ( network_->online() ){ MessageBodyShipProjectileFired msg( projectile.parent().childID(), projectile.shotCount(), projectile.position(), projectile.velocity(), - projectile.damage(), projectile.liveTime() ); + projectile.damage(), projectile.lifeTime() ); network_->send( msg ); } } @@ -928,8 +930,8 @@ std::map< long, SectorObjectMoveable * >::iterator it; if ( ( it = movableObjects_.find( createGlobalID( msg.senderID(), msg.childID() ) ) ) != movableObjects_.end() ){ - Projectile * pro = new Projectile( it->second, msg.shotCount(), msg.velocity().length(), msg.damage(), msg.liveTime() ); - it->second->addProjectile( pro ); +// Projectile * pro = new Projectile( it->second, msg.shotCount(), msg.velocity().length(), msg.damage(), msg.liveTime() ); +// it->second->addProjectile( pro ); } else { log_->warn( "Unknown shooter" ); } Modified: branches/ogsector/src/SectorObjects.cpp =================================================================== --- branches/ogsector/src/SectorObjects.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/SectorObjects.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -102,6 +102,12 @@ collObj_ = OpcodeCollisionDetection::getSingleton().createObject( this ); } +void SectorObject::setBaseRot( const Ogre::Real & yaw, const Ogre::Real & pitch, const Ogre::Real & roll ){ + mainNodeEntityRot_->yaw( Ogre::Degree( yaw ) ); + mainNodeEntityRot_->pitch( Ogre::Degree( pitch ) ); + mainNodeEntityRot_->roll( Ogre::Degree( roll ) ); +} + void SectorObject::scale( const Ogre::Vector3 & scale ){ baseSize_ = scale * ( entity_->getBoundingBox().getMaximum() - entity_->getBoundingBox().getMinimum() ); mainNodeEntityScale_->scale( scale ); @@ -137,14 +143,9 @@ mainNodeEntityScale_->scale( scale ); baseSize_ = size; + baseScale_ = scale; } -void SectorObject::setBaseRot( const Ogre::Real & yaw, const Ogre::Real & pitch, const Ogre::Real & roll ){ - mainNodeEntityRot_->yaw( Ogre::Degree( yaw ) ); - mainNodeEntityRot_->pitch( Ogre::Degree( pitch ) ); - mainNodeEntityRot_->roll( Ogre::Degree( roll ) ); -} - SectorObjectMoveable::SectorObjectMoveable( const Ogre::String & name, Sector * sector, int userID, int childID, Vessel * vessel ) : SectorObject( name, sector, userID, childID ), vessel_( vessel ) { @@ -154,12 +155,28 @@ LogManager::getSingleton().info( "Create " + name + " with " + vessel_->name() ); + std::map < int, std::vector < Ogre::Vector3 > > gunMountPoints( vessel_->gunMountPoints() ); + + for ( std::map < int, std::vector < Ogre::Vector3 > >::iterator it = gunMountPoints.begin(); + it != gunMountPoints.end(); it ++ ){ + for ( uint i = 0; i < it->second.size(); i ++ ){ + + Ogre::SceneNode * mountPoint = mainNodeEntityRot_->createChildSceneNode( name_ + "_GunMountPoint" + toStr( i ) ); + + GunObject *gun = new GunObject( EquipmentManager::getSingleton().gun( "Bender" ), mountPoint, capacity_ ); + + mountPoint->setPosition( it->second[ i ] ); + activeGuns_.push_back( gun ); + } + } + + setBaseRot( vessel_->baseYaw(), vessel_->basePitch(), vessel_->baseRoll() ); setBaseSize( vessel_->baseSize() ); if ( vessel_->factionID() == 4 ){ thrusterParticles_ = NULL; - + thrusterBbs_ = sceneMgr_->createBillboardSet( name_ + "thrust_BBS" ); thrusterBbs_->setMaterialName("squadrok/thrusterLight"); Ogre::Billboard *bb = thrusterBbs_->createBillboard( mainNode_->getOrientation().zAxis().normalisedCopy() * 10.0 ); @@ -167,14 +184,18 @@ mainNode_->attachObject( thrusterBbs_ ); } else { thrusterBbs_ = NULL; - + thrusterParticles_ = sceneMgr_->createParticleSystem( name_ + "Thruster" ); thrusterParticles_->setMaterialName( "Examples/Flare" ); thrusterParticles_->setDefaultDimensions( 2, 1 ); - Ogre::ParticleEmitter *pEmit1 = thrusterParticles_->addEmitter( "Point" ); - pEmit1->setDirection( mainNode_->getOrientation().zAxis() ); - pEmit1->setPosition( Ogre::Vector3( 0.0f, 0.5f, 5.0f ) ); - pEmit1->setColour( Ogre::ColourValue::Blue, Ogre::ColourValue::Green); + + std::vector < Ogre::Vector3 > engineMountPoints( vessel_->engineMountPoints() ); + for ( uint i = 0; i < engineMountPoints.size(); i ++ ){ + Ogre::ParticleEmitter *pEmit = thrusterParticles_->addEmitter( "Point" ); + pEmit->setDirection( mainNode_->getOrientation().zAxis() ); + pEmit->setPosition( ( mainNodeEntityRot_->getOrientation() * engineMountPoints[ i ] ) * mainNodeEntityScale_->getScale() ); + pEmit->setColour( Ogre::ColourValue::Blue, Ogre::ColourValue::Green ); + } mainNode_->attachObject( thrusterParticles_ ); } @@ -184,24 +205,34 @@ } SectorObjectMoveable::~SectorObjectMoveable() { + if ( explosion_ ){ + mainNode_->detachObject( explosion_ ); + sceneMgr_->destroyParticleSystem( explosion_ ); + } + if ( thrusterParticles_ ){ mainNode_->detachObject( thrusterParticles_ ); sceneMgr_->destroyParticleSystem( thrusterParticles_ ); } - if ( explosion_ ){ - mainNode_->detachObject( explosion_ ); - sceneMgr_->destroyParticleSystem( explosion_ ); - } if ( thrusterBbs_ ){ mainNode_->detachObject( thrusterBbs_ ); sceneMgr_->destroyBillboardSet( thrusterBbs_ ); } + // Projectile globalisieren. + for ( std::set < Projectile * >::iterator it = projectiles_.begin(); it != projectiles_.end(); ){ delete *it; projectiles_.erase( it++ ); } - // Projectile globalisieren. + + for ( std::list < GunObject * >::iterator it = activeGuns_.begin(); it != activeGuns_.end(); ){ + GunObject *gun = (*it); + activeGuns_.remove( *(it++) ); + mainNodeEntityRot_->removeAndDestroyChild( gun->sceneNode()->getName() ); + delete gun; + } + } bool SectorObjectMoveable::update( Ogre::Real elapsedTime ){ @@ -430,7 +461,7 @@ if ( thrusterParticles_ ){ int nEmits = thrusterParticles_->getNumEmitters( ); Ogre::Real thrustRate = 0; - if ( maxThrust() > 0 ) thrustRate = (float)thrust_ / maxThrust_ * 100; + if ( maxThrust() > 0 ) thrustRate = (float)thrust_ / maxThrust_ * 100.0; for ( int i = 0; i < nEmits; i ++ ){ Ogre::ParticleEmitter * pEmit; @@ -512,47 +543,24 @@ lastShieldSend_ = shield_; }; + for ( std::list < GunObject * >::iterator it = activeGuns_.begin(); it!= activeGuns_.end(); it++){ + (*it)->update( elapsedTime ); + } + fire( elapsedTime ); return true; } void SectorObjectMoveableLocal::fire( Ogre::Real elapsedTime ){ - - Ogre::Real delayTime = 0.2; - - fireDelay_ -= elapsedTime; - - if ( fireDelay_ <= 0 ){ - - Uint32 damage = 1000000; -// Ogre::Real liveTime = 0.14; -// ammoSpeed_ = 10000; - - Ogre::Real liveTime = 1.4; - ammoSpeed_ = 1000; - - if ( firePressed_ ){ - if ( capacity_ > damage ){ - Projectile * pro = new Projectile( this, shotsFired_, ammoSpeed_, damage, liveTime ); + if ( firePressed_ ){ + for ( std::list< GunObject * >::iterator it = activeGuns_.begin(); it != activeGuns_.end(); it++ ){ + if ( (*it)->fire() ){ + Projectile * pro = new Projectile( this, shotsFired_, *(*it), (*it)->mountPosition() ); addProjectile( pro ); sector_->sendProjectile( *pro ); - - fireDelay_ = delayTime; shotsFired_++; - capacity_ -= damage; - } + } } -// int nEmits = fireParticles_->getNumEmitters( ); - -// for ( int i = 0; i < nEmits; i ++ ){ -// Ogre::ParticleEmitter * pEmit; pEmit = fireParticles_->getEmitter( i ); -// pEmit->setEnabled( true ); -// pEmit->setTimeToLive( 1.8 ); -// pEmit->setEmissionRate( 1000.0 ); -// pEmit->setParticleVelocity( 1000.0 ); -// pEmit->setDuration( 0.2 ); -// } - } } @@ -666,8 +674,43 @@ if ( vessel_->capacitor() ) maxCapacity_ = vessel_->capacitor()->capacity(); capacity_ = maxCapacity_; - fireDelay_ = 0; +// std::map < int, std::vector < Ogre::Vector3 > > gunMountPoints( vessel_->gunMountPoints() ); +// for ( std::map < int, std::vector < Ogre::Vector3 > >::iterator it = gunMountPoints.begin(); +// it != gunMountPoints.end(); it ++ ){ +// for ( uint i = 0; i < it->second.size(); i ++ ){ + +// Ogre::SceneNode * mountPoint = mainNode_->createChildSceneNode( name_ + "_mountPoint" + toStr( i ) ); + +// GunObject *gun = new GunObject( EquipmentManager::getSingleton().gun( "Bender" ), mountPoint, capacity_ ); + +// // gun->setMountPosition( baseScale_ * it->second[ i ] ); + + +// mountPoint->setPosition( it->second[ i ] ); +// std::cout << mountPoint->getPosition() << std::endl; + +// // mountPoint->yaw( Ogre::Degree( vessel_->baseYaw() ),Ogre::Node::TS_PARENT ); +// mountPoint->yaw( Ogre::Degree( vessel_->baseYaw() ) ); +// mountPoint->_update(false, false); + +// std::cout << mountPoint->getPosition() << std::endl; + +// // mountPoint->pitch( Ogre::Degree( vessel_->basePitch() ) ); +// // mountPoint->roll( Ogre::Degree( vessel_->baseRoll() ) ); +// mountPoint->scale( baseScale_ ); +// mountPoint->_update( false, false); + +// std::cout << mountPoint->getPosition() << std::endl; + +// // direction.zAxis().normalisedCopy() * -6.2 + +// // direction.xAxis().normalisedCopy() * 1.5 + +// // direction.yAxis().normalisedCopy() * -0.2 ); + +// activeGuns_.push_back( gun ); +// } +// } + targetArrow_ = NULL; flightArrow_ = NULL; forceMovement_ = false; Modified: branches/ogsector/src/SectorObjects.h =================================================================== --- branches/ogsector/src/SectorObjects.h 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/SectorObjects.h 2007-07-05 19:32:38 UTC (rev 611) @@ -22,6 +22,7 @@ #define PLAYERSHIP__H #include <OgrePrerequisites.h> +#include <OgreSceneNode.h> #include "common.h" #include "networkProtocol.h" @@ -43,6 +44,47 @@ class Projectile; class OpcodeCollisionDetection; +class GunObject{ +public: + GunObject( Gun * gun, Ogre::SceneNode * mountPoint, Uint32 & capacity ) + : gun_( gun ), mountPoint_( mountPoint ), capacity_( &capacity ) { + delayTime_ = 0; + } + ~GunObject( ) { } + + void update( const Ogre::Real elapsedTime ){ + delayTime_ -= elapsedTime; + } + + bool fire(){ + if ( delayTime_ < 0 ){ + if ( *capacity_ > gun_->powerConsumption() ){ + *capacity_ -= gun_->powerConsumption(); + delayTime_ = gun_->fireDelay(); + return true; + } + } + return false; + } + + Gun * gun(){ return gun_;} + + Gun * gun() const { return gun_;} + + // void setMountPosition( const Ogre::Vector3 & mountPosition ) { mountPosition_ = mountPosition; } + Ogre::Vector3 mountPosition() const { return mountPoint_->getWorldPosition(); } + + Ogre::SceneNode * sceneNode() { return mountPoint_; } + Ogre::SceneNode & sceneNode() const { return *mountPoint_; } + +protected: + Gun * gun_; + Ogre::SceneNode * mountPoint_; + Uint32 * capacity_; + Ogre::Real delayTime_; + Ogre::Vector3 mountPosition_; +}; + class BaseObject{ public: BaseObject( const Ogre::String & name, Sector * sector, int userId = 0, int childId = 0 ); @@ -140,6 +182,7 @@ bool isOnRadar_; Ogre::Vector3 baseSize_; + Ogre::Vector3 baseScale_; }; /*! Base class for movable objects, instances are only used for foreign player objects. */ @@ -320,8 +363,13 @@ int lastFrameCount_; bool statusChanged_; + + Uint32 capacity_; + std::list < GunObject * > activeGuns_; }; + + /*! Movable sector objets which is controled by the client */ class SectorObjectMoveableLocal : public SectorObjectMoveable { public: @@ -349,13 +397,9 @@ virtual void hitByAmmo( Uint32 damage ); protected: - Ogre::Real ammoSpeed_; - Ogre::Real fireDelay_; - Uint32 capacity_; Uint32 maxCapacity_; Uint32 lastShieldSend_; Ogre::Real thrustRate_; - }; class SectorObjectMoveableAi : public SectorObjectMoveableLocal { @@ -398,7 +442,10 @@ } inline bool firePressed( ) const { return firePressed_; } - inline Ogre::Real ammoSpeed() const { return ammoSpeed_; } + inline Ogre::Real ammoSpeed() const { + if ( activeGuns_.size() > 0) return (*activeGuns_.begin() )->gun()->speed(); + return 0.0; + } virtual bool deathSequence( Ogre::Real elapsedTime ); Modified: branches/ogsector/src/ShipConfigDialog.cpp =================================================================== --- branches/ogsector/src/ShipConfigDialog.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/ShipConfigDialog.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -215,36 +215,6 @@ } } -bool ShipConfigDialog::handleSelectShipButton( const CEGUI::EventArgs & e ){ - devices_->avatar->setVessel( *(*itVessel_) ); - LogManager::getSingleton().info( std::string( "Select vessel: " ) + devices_->avatar->vessel()->name() + " id:" + toStr( devices_->avatar->vessel()->id() ) ); - updateEquipmentView(); - return true; -} - -bool ShipConfigDialog::handleCloseButton( const CEGUI::EventArgs & e ){ - hide(); - return true; -} - -bool ShipConfigDialog::handleNextShipButton( const CEGUI::EventArgs & e ){ - if ( vessels_.size() > 0 ){ - itVessel_++; - if ( itVessel_ == vessels_.end() ) itVessel_ = vessels_.begin(); - updateShipView(); - } - return true; -} - -bool ShipConfigDialog::handlePrevShipButton( const CEGUI::EventArgs & e ){ - if ( vessels_.size() > 0 ){ - if ( itVessel_ == vessels_.begin() ) itVessel_ = vessels_.end(); - itVessel_--; - updateShipView(); - } - return true; -} - void ShipConfigDialog::updateEquipmentView(){ std::list< std::deque < Entity * > > * floorCargo = DeviceManager::getSingleton().avatar->floorCargo(); @@ -269,57 +239,33 @@ } if ( DeviceManager::getSingleton().avatar->vessel()->powerPlant() ){ - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 0 ]->getName() + "ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 0 ]->getName() + "ShipConfigEquipmentItem/UnLoad" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 0 ]->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 0 ]->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); powerGridEngineThrust_ = 100; - fillShipConfigButton( equipmentButtons_[ 0 ], POWERPLANT, DeviceManager::getSingleton().avatar->vessel()->powerPlant() ); + fillShipConfigButton( equipmentButtons_[ 0 ], POWERPLANT, DeviceManager::getSingleton().avatar->vessel()->powerPlant(), true ); } else { fillShipConfigButton( equipmentButtons_[ 0 ], POWERPLANT, pplants ); } if ( DeviceManager::getSingleton().avatar->vessel()->engine() ){ - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 1 ]->getName() + "ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 1 ]->getName() + "ShipConfigEquipmentItem/UnLoad" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 1 ]->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 1 ]->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); - fillShipConfigButton( equipmentButtons_[ 1 ], ENGINE, DeviceManager::getSingleton().avatar->vessel()->engine() ); + fillShipConfigButton( equipmentButtons_[ 1 ], ENGINE, DeviceManager::getSingleton().avatar->vessel()->engine(), true ); } else { fillShipConfigButton( equipmentButtons_[ 1 ], ENGINE, engines ); } if ( DeviceManager::getSingleton().avatar->vessel()->radar() ){ - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 2 ]->getName() + "ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 2 ]->getName() + "ShipConfigEquipmentItem/UnLoad" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 2 ]->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 2 ]->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); - fillShipConfigButton( equipmentButtons_[ 2 ], RADAR, DeviceManager::getSingleton().avatar->vessel()->radar() ); + fillShipConfigButton( equipmentButtons_[ 2 ], RADAR, DeviceManager::getSingleton().avatar->vessel()->radar(), true ); } else { fillShipConfigButton( equipmentButtons_[ 2 ], RADAR, radars ); } if ( DeviceManager::getSingleton().avatar->vessel()->ecm() ){ - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 3 ]->getName() + "ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 3 ]->getName() + "ShipConfigEquipmentItem/UnLoad" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 3 ]->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 3 ]->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); - fillShipConfigButton( equipmentButtons_[ 3 ], ECM, DeviceManager::getSingleton().avatar->vessel()->ecm() ); + fillShipConfigButton( equipmentButtons_[ 3 ], ECM, DeviceManager::getSingleton().avatar->vessel()->ecm(), true ); } else { fillShipConfigButton( equipmentButtons_[ 3 ], ECM, ecms ); } if ( DeviceManager::getSingleton().avatar->vessel()->shield() ){ - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 4 ]->getName() + "ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 4 ]->getName() + "ShipConfigEquipmentItem/UnLoad" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 4 ]->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 4 ]->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); - fillShipConfigButton( equipmentButtons_[ 4 ], SHIELD, DeviceManager::getSingleton().avatar->vessel()->shield() ); + fillShipConfigButton( equipmentButtons_[ 4 ], SHIELD, DeviceManager::getSingleton().avatar->vessel()->shield(), true ); } else { fillShipConfigButton( equipmentButtons_[ 4 ], SHIELD, shields ); } if ( DeviceManager::getSingleton().avatar->vessel()->capacitor() ){ - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 5 ]->getName() + "ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 5 ]->getName() + "ShipConfigEquipmentItem/UnLoad" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 5 ]->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ 5 ]->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); - fillShipConfigButton( equipmentButtons_[ 5 ], CAPACITOR, DeviceManager::getSingleton().avatar->vessel()->capacitor() ); + fillShipConfigButton( equipmentButtons_[ 5 ], CAPACITOR, DeviceManager::getSingleton().avatar->vessel()->capacitor(), true ); } else { fillShipConfigButton( equipmentButtons_[ 5 ], CAPACITOR, capacitors ); } @@ -345,13 +291,14 @@ fillShipConfigButton( window, entity, (*(items)[ 0 ])[ 0 ] ); } else { CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/Load")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/UnLoad")->hide(); CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); fillShipConfigButton( window, entity, NULL ); } } -void ShipConfigDialog::fillShipConfigButton( CEGUI::Window * window, EntityType entity, Entity * item ){ +void ShipConfigDialog::fillShipConfigButton( CEGUI::Window * window, EntityType entity, Entity * item, bool mounted ){ CEGUI::String labelName( DeviceManager::getSingleton().categoryName( entity ) ); if ( labelName == "unknown" ) labelName = ""; @@ -362,16 +309,22 @@ itemName = item->name(); imageName = item->ceguiSmallImageName(); window->setUserData( item ); + if ( mounted ){ + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/Load")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/UnLoad")->show(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); + } } else{ window->setUserData( NULL ); - CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/Load")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/Load")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/PrevItem")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/NextItem")->hide(); } if ( DeviceManager::getSingleton().avatar->vessel()->fixEquipment() ){ - CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/Load")->hide(); - CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/UnLoad")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/Load")->hide(); + CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentItem/UnLoad")->hide(); } CEGUI::WindowManager::getSingleton().getWindow( window->getName() + "ShipConfigEquipmentButton/Label" )-> @@ -407,41 +360,6 @@ } } -bool ShipConfigDialog::handeMainWindowShown( const CEGUI::EventArgs & e ){ - updateEquipmentView(); - return true; -} - -bool ShipConfigDialog::handleLoadItem( const CEGUI::EventArgs & e ){ - const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); - CEGUI::Window * itemWindow = we.window->getParent(); - Entity *item = (Entity *)itemWindow->getUserData(); - - if ( item ){ - if ( item->entityType() == POWERPLANT ) powerGridEngineThrust_ = 100; - - if ( DeviceManager::getSingleton().avatar->loadItem( item ) ){ - CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/Load" )->hide(); - CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/UnLoad" )->show(); - } - } - return updatePowerGrid( ); -} - -bool ShipConfigDialog::handleUnLoadItem( const CEGUI::EventArgs & e ){ - const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); - CEGUI::Window * itemWindow = we.window->getParent(); - Entity *item = (Entity *)itemWindow->getUserData(); - - if ( item ){ - if ( DeviceManager::getSingleton().avatar->unLoadItem( item ) ){ - CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/Load" )->show(); - CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/UnLoad" )->hide(); - } - } - return updatePowerGrid( ); -} - bool ShipConfigDialog::updatePowerGrid( ){ double powerLine = 0; double powerOut = 0; @@ -522,6 +440,92 @@ return true; } +bool ShipConfigDialog::handleSelectShipButton( const CEGUI::EventArgs & e ){ + if ( (*itVessel_)->name() != devices_->avatar->vessel()->name() + && (*itVessel_)->factionID() != 4 ){ + for ( unsigned int i = 0; i < equipmentButtons_.size(); i ++ ){ + Entity *item = (Entity *)equipmentButtons_[ i ]->getUserData(); + if ( item ){ + if ( DeviceManager::getSingleton().avatar->unLoadItem( item ) ){ + CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ i ]->getName() + + "ShipConfigEquipmentItem/Load" )->show(); + CEGUI::WindowManager::getSingleton().getWindow( equipmentButtons_[ i ]->getName() + + "ShipConfigEquipmentItem/UnLoad" )->hide(); + } + } + } + + LogManager::getSingleton().info( std::string( "Select vessel: " ) + devices_->avatar->vessel()->name() + + " id:" + toStr( devices_->avatar->vessel()->id() ) ); + + devices_->avatar->setVessel( *(*itVessel_) ); + updatePowerGrid(); + updateEquipmentView(); + } + return true; +} + +bool ShipConfigDialog::handleCloseButton( const CEGUI::EventArgs & e ){ + hide(); + return true; +} + +bool ShipConfigDialog::handleNextShipButton( const CEGUI::EventArgs & e ){ + if ( vessels_.size() > 0 ){ + itVessel_++; + if ( itVessel_ == vessels_.end() ) itVessel_ = vessels_.begin(); + updateShipView(); + } + return true; +} + +bool ShipConfigDialog::handlePrevShipButton( const CEGUI::EventArgs & e ){ + if ( vessels_.size() > 0 ){ + if ( itVessel_ == vessels_.begin() ) itVessel_ = vessels_.end(); + itVessel_--; + updateShipView(); + } + return true; +} + +bool ShipConfigDialog::handeMainWindowShown( const CEGUI::EventArgs & e ){ + updateEquipmentView(); + return true; +} + +bool ShipConfigDialog::handleLoadItem( const CEGUI::EventArgs & e ){ + const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); + CEGUI::Window * itemWindow = we.window->getParent(); + Entity *item = (Entity *)itemWindow->getUserData(); + + if ( item ){ + if ( item->entityType() == POWERPLANT ) powerGridEngineThrust_ = 100; + + if ( DeviceManager::getSingleton().avatar->loadItem( item ) ){ + CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/Load" )->hide(); + CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/UnLoad" )->show(); + } + } + return updatePowerGrid( ); +} + +bool ShipConfigDialog::handleUnLoadItem( const CEGUI::EventArgs & e ){ + const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); + CEGUI::Window * itemWindow = we.window->getParent(); + Entity *item = (Entity *)itemWindow->getUserData(); + + if ( item ){ + if ( DeviceManager::getSingleton().avatar->unLoadItem( item ) ){ + CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/Load" )->show(); + CEGUI::WindowManager::getSingleton().getWindow( itemWindow->getName()+"ShipConfigEquipmentItem/UnLoad" )->hide(); + } + } + return updatePowerGrid( ); +} + + + + } // namespace OpenGate Modified: branches/ogsector/src/ShipConfigDialog.h =================================================================== --- branches/ogsector/src/ShipConfigDialog.h 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/ShipConfigDialog.h 2007-07-05 19:32:38 UTC (rev 611) @@ -52,7 +52,7 @@ void populateEquipmentButtons( ); void updateEquipmentView(); void fillShipConfigButton( CEGUI::Window *, EntityType entity, std::vector < std::deque< Entity * > * > & items ); - void fillShipConfigButton( CEGUI::Window * window, EntityType entity, Entity * item ); + void fillShipConfigButton( CEGUI::Window * window, EntityType entity, Entity * item, bool mounted = false); bool updatePowerGrid( ); /*! This changes the ship rendered to the texture rttTex_. It is called by handleNextShipButton() or handlePrevShipButton(). */ Modified: branches/ogsector/src/UnDockedState.cpp =================================================================== --- branches/ogsector/src/UnDockedState.cpp 2007-07-04 21:32:38 UTC (rev 610) +++ branches/ogsector/src/UnDockedState.cpp 2007-07-05 19:32:38 UTC (rev 611) @@ -54,15 +54,13 @@ network_ = devices_->network; overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateUnDocked.layout"); + hudIsVisible_ = true; + cameraViewKey_ = 1; mainCamera_ = sceneMgr_->createCamera( "MainCamera" ); -// mainCamera_->setPosition( Ogre::Vector3( 0, 0, 500 ) ); -// mainCamera_->lookAt( Ogre::Vector3( 0, 0, 0 ) ); mainCamera_->setNearClipDistance( 1 ); secondCamera_ = sceneMgr_->createCamera( "SecondCamera" ); -// secondCamera_->setPosition( Ogre::Vector3( 0, 0, 500 ) ); -// secondCamera_->lookAt( Ogre::Vector3( 0, 0, 0 ) ); secondCamera_->setNearClipDistance( 1 ); windowsWidth_ = window_->getWidth( ); @@ -150,7 +148,7 @@ try{ sector_ = new Sector( sceneMgr_, network_ ); } catch( Ogre::Exception& e ) { - std::cout << e.getFullDescription().c_str() << std::endl; + log_->fatal( e.getFullDescription().c_str() ); } sector_->setListener( this ); @@ -198,10 +196,12 @@ duelistPilot_ = false; duelistTarget_ = false; - timeSinceLastSectorUpdate_ = 0.0; + timeSinceLastSectorUpdate_ = 0.0; timeSinceLastNetworkUpdate_ = 0.0; + timeSinceLastHudUpdate_ = 0.0; -// cameraRotateSpeed_ = 36; + cameraRotateX_ = 0; + cameraRotateY_ = 0; // cameraRotateScale_ = 0.0f; // cameraMoveSpeed_ = 100; // cameraMoveScale_ = 0.0f; @@ -253,7 +253,7 @@ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/BackButton" )->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&UnDockedState::handleConfigBackButton, this ) ) ; - toggleNextCamera_( 1 ); + toggleNextCamera_( 0 ); //** start update SceneManager, if not set this leeds to strange behaviour by switching states //** opengateclient: OgreRenderQueueSortingGrouping.cpp:355: void Ogre::QueuedRenderableCollection::addRenderable(Ogre::Pass*, Ogre::Renderable*): Assertion `retPair.second && "Error inserting new pass entry into PassGroupRenderableMap"' failed. @@ -311,6 +311,7 @@ configMode_ = devices_->gameStateRoot->configDialog()->isVisible(); if ( configMode_ ){ + overlayRootWindow_->show(); hudOverlay_->hide( ); Ogre::OverlayManager::getSingleton().getByName( "Radar" )->hide(); CEGUI::MouseCursor::getSingleton().show(); @@ -318,6 +319,7 @@ CEGUI::MouseCursor::getSingleton().hide(); hudOverlay_->show( ); Ogre::OverlayManager::getSingleton().getByName( "Radar" )->show(); + if ( cameraViewKey_ != 1 ) hideHud(); } return true; } @@ -354,8 +356,8 @@ } //** update my camera; - updateCamera_(); - updateHUD_(); + updateCamera_( evt.timeSinceLastFrame ); + updateHUD_( evt.timeSinceLastFrame ); // renderSpaceDust(); return true; @@ -439,6 +441,12 @@ //** prev Target; if ( e.key == OIS::KC_P ) { setTarget( sector_->prevTarget() ); } + if ( e.key == OIS::KC_1 ) { if ( cameraMode_ == 0 ) showHud(); cameraViewKey_ = 1; } + if ( e.key == OIS::KC_2 ) { hideHud(); cameraViewKey_ = 2; } + if ( e.key == OIS::KC_3 ) { hideHud(); cameraViewKey_ = 3; } + if ( e.key == OIS::KC_4 ) { hideHud(); cameraViewKey_ = 4; } + if ( e.key == OIS::KC_5 ) { hideHud(); cameraViewKey_ = 5; } + //** Toggle through camera modes; if ( e.key == OIS::KC_6 ) { toggleNextCamera_(); } @@ -695,7 +703,7 @@ } void UnDockedState::toggleNextCamera_( int mode ){ - int maxCameraModes = 4; + int maxCameraModes = 2; //** circle through cameraModes; if ( mode == -1 ){ @@ -705,35 +713,35 @@ } switch ( cameraMode_ ){ - case 0: //** free camera at orign - mainCamera_->setPosition( Ogre::Vector3( 0, 0, 500 ) ); + case 0: //** first person avatar camera + showHud(); + mainCamera_->setOrientation( sector_->avatarObject()->mainNode()->getOrientation() ); if ( sector_->avatarObject() != NULL ){ - mainCamera_->setAutoTracking( false, sector_->avatarObject()->mainNode() ); - sector_->avatarObject()->setVisible( true ); - } - break; - case 1: //** first person avatar camera - if ( sector_->avatarObject() != NULL ){ sector_->avatarObject()->setVisible( false ); break; } - case 2: //** avatar chase camera; + case 1: //** avatar chase camera; + hideHud(); + cameraRotateX_ = 0; + cameraRotateY_ = 0; + cameraViewKey_ = 1; if ( sector_->avatarObject() != NULL ){ sector_->avatarObject()->setVisible( true ); break; } - case 3: //** free avatar tracking-camera at orign - mainCamera_->setPosition( Ogre::Vector3( 0, 0, 500 ) ); - mainCamera_->lookAt( Ogre::Vector3( 0, 0, -300 ) ); - if ( sector_->avatarObject() != NULL ){ - mainCamera_->setAutoTracking( true, sector_->avatarObject()->mainNode() ); - sector_->avatarObject()->setVisible( true ); - } - break; +// case 2: //** free avatar tracking-camera at orign; +// hideHud(); +// mainCamera_->setPosition( Ogre::Vector3( 0, 0, 500 ) ); +// mainCamera_->lookAt( Ogre::Vector3( 0, 0, -300 ) ); +// if ( sector_->avatarObject() != NULL ){ +// // mainCamera_->setAutoTracking( true, sector_->avatarObject()->mainNode() ); +// sector_->avatarObject()->setVisible( true ); +// } +// break; } } -void UnDockedState::updateCamera_(){ +void UnDockedState::updateCamera_( Ogre::Real elapsedTime ){ if ( sector_->avatarObject() != NULL ){ Ogre::Vector3 avatarPos( sector_->avatarObject()->mainNode()->getPosition() ); @@ -758,21 +766,59 @@ if ( target_ != NULL ) secondCamera_->setPosition( avatarPos + distNorm * ( dist.length() - 2.0 * target_->maxBaseSize() ) ); switch ( cameraMode_ ){ - case 0: //** free camera at orign - mainCamera_->lookAt( sector_->avatarObject()->mainNode()->getPosition( ) ); - break; - case 1: //** first person avatar camera - mainCamera_->setPosition( avatarPos ); + case 0: //** first person avatar camera; + sector_->avatarObject()->setVisible( false ); + mainCamera_->setPosition( avatarPos ); mainCamera_->setOrientation( avatarOrient ); - sector_->avatarObject()->setVisible( false ); + switch( cameraViewKey_ ){ + case 1: + mainCamera_->setOrientation( avatarOrient ); + break; + case 2: // look left + mainCamera_->yaw( Ogre::Degree( 90 ) ); + break; + case 3: // look right + mainCamera_->yaw( Ogre::Degree( -90 ) ); + break; + case 4: // look up + mainCamera_->pitch( Ogre::Degree( 90 ) ); + break; + case 5: // look back; + mainCamera_->yaw( Ogre::Degree( 180 ) ); + break; + } break; - case 2: //** avatar chase camera - mainCamera_->setPosition( avatarPos + avatarOrient.zAxis() * 100 ); - mainCamera_->setOrientation( avatarOrient ); + case 1: { //** avatar chase camera; + switch( cameraViewKey_ ){ + case 1: + break; + case 2: + cameraRotateX_ -= Ogre::Degree( ( 30.0 * elapsedTime ) ); + break; + ca... [truncated message content] |
From: <eg...@us...> - 2007-07-04 21:32:38
|
Revision: 610 http://svn.sourceforge.net/opengate/?rev=610&view=rev Author: egore Date: 2007-07-04 14:32:38 -0700 (Wed, 04 Jul 2007) Log Message: ----------- Add crappy excavator Added Paths: ----------- trunk/data/guns/excavator.blend Added: trunk/data/guns/excavator.blend =================================================================== (Binary files differ) Property changes on: trunk/data/guns/excavator.blend ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-01 19:27:58
|
Revision: 609 http://svn.sourceforge.net/opengate/?rev=609&view=rev Author: ultrasick Date: 2007-07-01 12:27:59 -0700 (Sun, 01 Jul 2007) Log Message: ----------- uploading gun: bender + adding "life time" to the xml Modified Paths: -------------- trunk/data/guns/bender.xml Added Paths: ----------- trunk/data/guns/bender.blend trunk/data/guns/bender_290x290.png trunk/data/guns/bender_76x76.png Added: trunk/data/guns/bender.blend =================================================================== (Binary files differ) Property changes on: trunk/data/guns/bender.blend ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/data/guns/bender.xml =================================================================== (Binary files differ) Added: trunk/data/guns/bender_290x290.png =================================================================== (Binary files differ) Property changes on: trunk/data/guns/bender_290x290.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/data/guns/bender_76x76.png =================================================================== (Binary files differ) Property changes on: trunk/data/guns/bender_76x76.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-01 14:54:48
|
Revision: 608 http://svn.sourceforge.net/opengate/?rev=608&view=rev Author: ultrasick Date: 2007-07-01 07:54:50 -0700 (Sun, 01 Jul 2007) Log Message: ----------- uploading xml file for the bender gun Added Paths: ----------- trunk/data/guns/ trunk/data/guns/bender.xml Added: trunk/data/guns/bender.xml =================================================================== (Binary files differ) Property changes on: trunk/data/guns/bender.xml ___________________________________________________________________ Name: svn:mime-type + application/xml Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-07-01 14:11:57
|
Revision: 607 http://svn.sourceforge.net/opengate/?rev=607&view=rev Author: ultrasick Date: 2007-07-01 07:11:59 -0700 (Sun, 01 Jul 2007) Log Message: ----------- added category "guns" Modified Paths: -------------- trunk/data/misc/ids.xml Modified: trunk/data/misc/ids.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-06-30 15:26:39
|
Revision: 606 http://svn.sourceforge.net/opengate/?rev=606&view=rev Author: ultrasick Date: 2007-06-30 08:26:41 -0700 (Sat, 30 Jun 2007) Log Message: ----------- added a missing blank in the second engine slot coordinates Modified Paths: -------------- trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml Modified: trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-06-29 09:36:12
|
Revision: 605 http://svn.sourceforge.net/opengate/?rev=605&view=rev Author: ultrasick Date: 2007-06-29 02:36:13 -0700 (Fri, 29 Jun 2007) Log Message: ----------- based on "squid attempt 2", only very slight changes in the mesh. mainly adding the fading material and the white material at the end Added Paths: ----------- trunk/data/ships/squadrok/squid/squid_attempt3.blend Added: trunk/data/ships/squadrok/squid/squid_attempt3.blend =================================================================== (Binary files differ) Property changes on: trunk/data/ships/squadrok/squid/squid_attempt3.blend ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ult...@us...> - 2007-06-28 23:15:16
|
Revision: 604 http://svn.sourceforge.net/opengate/?rev=604&view=rev Author: ultrasick Date: 2007-06-28 16:10:32 -0700 (Thu, 28 Jun 2007) Log Message: ----------- moving gun points from the blender file into the xml file Modified Paths: -------------- trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.blend trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml Modified: trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.blend =================================================================== (Binary files differ) Modified: trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2007-06-28 17:33:52
|
Revision: 603 http://svn.sourceforge.net/opengate/?rev=603&view=rev Author: spom_spom Date: 2007-06-28 10:33:52 -0700 (Thu, 28 Jun 2007) Log Message: ----------- win compatibility commit, upgrade to ogre-1.4.2 Modified Paths: -------------- branches/ogsector/win32/ogsectorclient/OgreGUIRenderer.dll branches/ogsector/win32/ogsectorclient/OgreMain.dll branches/ogsector/win32/ogsectorclient/Plugin_BSPSceneManager.dll branches/ogsector/win32/ogsectorclient/Plugin_CgProgramManager.dll branches/ogsector/win32/ogsectorclient/Plugin_OctreeSceneManager.dll branches/ogsector/win32/ogsectorclient/Plugin_ParticleFX.dll branches/ogsector/win32/ogsectorclient/RenderSystem_Direct3D9.dll branches/ogsector/win32/ogsectorclient/RenderSystem_GL.dll branches/ogsector/win32/ogsectorclient/ogsectorclient.cbp branches/ogsector/win32/ogsectorclient/ogsectorclient.exe branches/ogsector/win32/ogsectorclient/resources.cfg Added Paths: ----------- branches/ogsector/win32/ogsectorclient/d3dx9_33.dll Modified: branches/ogsector/win32/ogsectorclient/OgreGUIRenderer.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/OgreMain.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/Plugin_BSPSceneManager.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/Plugin_CgProgramManager.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/Plugin_OctreeSceneManager.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/Plugin_ParticleFX.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/RenderSystem_Direct3D9.dll =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/RenderSystem_GL.dll =================================================================== (Binary files differ) Added: branches/ogsector/win32/ogsectorclient/d3dx9_33.dll =================================================================== (Binary files differ) Property changes on: branches/ogsector/win32/ogsectorclient/d3dx9_33.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: branches/ogsector/win32/ogsectorclient/ogsectorclient.cbp =================================================================== --- branches/ogsector/win32/ogsectorclient/ogsectorclient.cbp 2007-06-28 16:05:43 UTC (rev 602) +++ branches/ogsector/win32/ogsectorclient/ogsectorclient.cbp 2007-06-28 17:33:52 UTC (rev 603) @@ -83,6 +83,8 @@ <Unit filename="..\..\src\MarketDialog.h" /> <Unit filename="..\..\src\OpcodeWrapper.cpp" /> <Unit filename="..\..\src\OpcodeWrapper.h" /> + <Unit filename="..\..\src\Projectile.cpp" /> + <Unit filename="..\..\src\Projectile.h" /> <Unit filename="..\..\src\Sector.cpp" /> <Unit filename="..\..\src\Sector.h" /> <Unit filename="..\..\src\SectorObjects.cpp" /> @@ -99,6 +101,7 @@ <Unit filename="..\..\src\common.h" /> <Unit filename="..\..\src\networkClient.cpp" /> <Unit filename="..\..\src\networkClient.h" /> + <Unit filename="..\..\src\networkProtocol.cpp" /> <Unit filename="..\..\src\networkProtocol.h" /> <Unit filename="..\..\src\opengateclient.cpp" /> <Unit filename="..\..\src\tinyxml\tinyxml.cpp" /> Modified: branches/ogsector/win32/ogsectorclient/ogsectorclient.exe =================================================================== (Binary files differ) Modified: branches/ogsector/win32/ogsectorclient/resources.cfg =================================================================== --- branches/ogsector/win32/ogsectorclient/resources.cfg 2007-06-28 16:05:43 UTC (rev 602) +++ branches/ogsector/win32/ogsectorclient/resources.cfg 2007-06-28 17:33:52 UTC (rev 603) @@ -23,6 +23,7 @@ FileSystem=../../../../trunk/data/ships/octavius/apteryx FileSystem=../../../../trunk/data/ships/quantar/storm FileSystem=../../../../trunk/data/ships/tauseti/lady_kickstart +FileSystem=../../../../trunk/data/ships/squadrok/squid FileSystem=../../../../trunk/data/engines FileSystem=../../../../trunk/data/capacitors FileSystem=../../../../trunk/data/radars This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2007-06-28 16:05:55
|
Revision: 602 http://svn.sourceforge.net/opengate/?rev=602&view=rev Author: spom_spom Date: 2007-06-28 09:05:43 -0700 (Thu, 28 Jun 2007) Log Message: ----------- read the xml files for the vessels. Scale and rotate the vessels in game. Fixed some some small issues. Modified Paths: -------------- branches/ogsector/ToDo branches/ogsector/aclocal.m4 branches/ogsector/resources.cfg branches/ogsector/src/Console.h branches/ogsector/src/DockedState.cpp branches/ogsector/src/DockedState.h branches/ogsector/src/EntityManager.cpp branches/ogsector/src/GameStateManager.cpp branches/ogsector/src/LogManager.cpp branches/ogsector/src/LogManager.h branches/ogsector/src/Makefile.am branches/ogsector/src/Makefile.in branches/ogsector/src/MarketDialog.cpp branches/ogsector/src/OpcodeWrapper.cpp branches/ogsector/src/OpcodeWrapper.h branches/ogsector/src/Sector.cpp branches/ogsector/src/Sector.h branches/ogsector/src/SectorObjects.cpp branches/ogsector/src/SectorObjects.h branches/ogsector/src/ShipConfigDialog.cpp branches/ogsector/src/ShipConfigDialog.h branches/ogsector/src/UnDockedState.cpp branches/ogsector/src/UnDockedState.h branches/ogsector/src/Vessel.cpp branches/ogsector/src/Vessel.h branches/ogsector/src/VesselManager.cpp branches/ogsector/src/common.cpp branches/ogsector/src/common.h branches/ogsector/src/networkProtocol.h branches/ogsector/src/opengateclient.cpp trunk/data/misc/testsector.xml trunk/data/ships/octavius/apteryx/apteryx.xml trunk/data/ships/quantar/storm/storm.xml trunk/data/ships/tauseti/lady_kickstart/lady_kickstart.xml Added Paths: ----------- branches/ogsector/data/materials/gradientshader.cg branches/ogsector/data/materials/gradientshader.material branches/ogsector/src/Projectile.cpp branches/ogsector/src/Projectile.h branches/ogsector/src/networkProtocol.cpp Modified: branches/ogsector/ToDo =================================================================== --- branches/ogsector/ToDo 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/ToDo 2007-06-28 16:05:43 UTC (rev 602) @@ -6,6 +6,7 @@ - Class: Sector - enth\xE4llt alle Informationen des Sector (noMovable, movable und avatar) - add/new/remove/update aller Objecte erfolgt \xFCber den Sector + - setor content by xml-file - Class: SectorClient (Verwaltung) - HauptKlasse enth\xE4llt Sector und SectorCientFrameListener @@ -45,7 +46,7 @@ - global/code - cleaning / refaktoring - integrate in currect OpenGate framework - - add licence header +# - add licence header - mark third persons thingies (mousecurser, skybox) #ALT-TAB - free mousepointer from widget contents - fullscreen switch (probably not supported by ogre) @@ -62,15 +63,16 @@ - cheatprotection - testsector - - show all shipmodels +# - show all shipmodels - show all objects - skybox with higher resolution - stars # - planet - xml-read - - read playership data - - read nonmovable objects +# - read playership data +# - read nonmovable objects +# - read equipment and commodities - global config - openal @@ -92,6 +94,7 @@ - toggle Astro/Stations/Friends/Enemies/All - nearest Enemy/Friend - last Enemy/Friend + - proper radar rotation instead of 0.5 scaling - HUD # - targetarrow @@ -99,11 +102,19 @@ # - duellist # - bullseye/VCR (??) # - flydirection arrow - - colorindex for break/AB/FF +# - colorindex for break/AB/FF # - shield/ammo - selected rockets +- GUI +# - market dialog + - ship config dialog + - global config dialog + - mision dialog + - private trade dialog + - moving + - flyindicator particle - fire! @@ -122,6 +133,8 @@ # - simple follow - calculate fireing solution - rockets + - pathfinding + - genetic learning For the talented: - particle for thrust Modified: branches/ogsector/aclocal.m4 =================================================================== --- branches/ogsector/aclocal.m4 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/aclocal.m4 2007-06-28 16:05:43 UTC (rev 602) @@ -149,7 +149,8 @@ _PKG_TEXT ])], - [$4]) + [AC_MSG_RESULT([no]) + $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it Added: branches/ogsector/data/materials/gradientshader.cg =================================================================== --- branches/ogsector/data/materials/gradientshader.cg (rev 0) +++ branches/ogsector/data/materials/gradientshader.cg 2007-06-28 16:05:43 UTC (rev 602) @@ -0,0 +1,39 @@ +// -------------------------------------------------------------------- +// Gradient shader : vertex program +// Author : David de Lorenzo +// ----------------------------------------------------------------- +void gradient_vp( in float4 position : POSITION, + uniform float4x4 worldViewProj, + uniform float3 camera_position_object_space, + uniform float4 customParamColour, + uniform float4 customParamRadius, + out float4 oPosition : POSITION, + out float4 oColor : COLOR + ) +{ + // Get the custom parameters + float objectradius = customParamRadius.x; + + // calculate output position + oPosition = mul(worldViewProj, position); + + // Calculate the color value, depending on the position + float3 vect_center_to_cam = camera_position_object_space; + float3 position_closest = normalize(vect_center_to_cam) * objectradius; + + float Rc = (position_closest.z * position.z ) + (position_closest.x * position.x); // Ratio on Center-to-Cam axis + Rc = Rc / (objectradius * objectradius); // recalibrate (-1..1) + float ratio = (1+Rc); // recalibrate ( 0..2) - (x2 to emphasis the color) + + oColor= ratio * customParamColour; +} + + +// ----------------------------------------------------------------- +// Gradient shader : fragment program +// Author : David de Lorenzo +// ----------------------------------------------------------------- +float4 main_fp(in float4 color : COLOR) : COLOR0 +{ + return (color); +} Added: branches/ogsector/data/materials/gradientshader.material =================================================================== --- branches/ogsector/data/materials/gradientshader.material (rev 0) +++ branches/ogsector/data/materials/gradientshader.material 2007-06-28 16:05:43 UTC (rev 602) @@ -0,0 +1,39 @@ +vertex_program shader/gradientVP cg +{ + source gradientshader.cg + entry_point gradient_vp + profiles vs_1_1 arbvp1 + + default_params + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto camera_position_object_space camera_position_object_space + } +} + +fragment_program shader/gradientFP cg +{ + source gradientshader.cg + entry_point main_fp + profiles vs_1_1 arbfp1 +} + +material shader/gradient +{ + technique + { + pass + { + scene_blend alpha_blend + depth_write off + vertex_program_ref shader/gradientVP + { + param_named_auto customParamColour custom 0 + param_named_auto customParamRadius custom 1 + } + fragment_program_ref shader/gradientFP + { + } + } + } +} \ No newline at end of file Modified: branches/ogsector/resources.cfg =================================================================== --- branches/ogsector/resources.cfg 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/resources.cfg 2007-06-28 16:05:43 UTC (rev 602) @@ -15,6 +15,7 @@ FileSystem=../../trunk/data/ships/octavius/apteryx FileSystem=../../trunk/data/ships/quantar/storm FileSystem=../../trunk/data/ships/tauseti/lady_kickstart +FileSystem=../../trunk/data/ships/squadrok/squid FileSystem=../../trunk/data/stations/tauseti FileSystem=../../trunk/data/misc/asteroids Modified: branches/ogsector/src/Console.h =================================================================== --- branches/ogsector/src/Console.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Console.h 2007-06-28 16:05:43 UTC (rev 602) @@ -21,7 +21,7 @@ #ifndef CONSOLE__H #define CONSOLE__H -#include <Ogre.h> +#include <OgrePrerequisites.h> #include <list> #include <vector> #include "GameState.h" Modified: branches/ogsector/src/DockedState.cpp =================================================================== --- branches/ogsector/src/DockedState.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/DockedState.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -23,10 +23,12 @@ #include "Avatar.h" #include "Vessel.h" +#include <OgreRoot.h> +#include <OgreRenderWindow.h> +#include <OgreManualObject.h> #include <OgreCEGUITexture.h> #include <CEGUI/elements/CEGUIPushButton.h> -#include <Ogre.h> namespace OpenGate{ Modified: branches/ogsector/src/DockedState.h =================================================================== --- branches/ogsector/src/DockedState.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/DockedState.h 2007-06-28 16:05:43 UTC (rev 602) @@ -21,14 +21,13 @@ #ifndef _OPENGATE_DOCKEDSTATELISTENER__H #define _OPENGATE_DOCKEDSTATELISTENER__H -#include <OgreCamera.h> +#include <OgrePrerequisites.h> #include "LogManager.h" #include "GameState.h" #include "ShipConfigDialog.h" #include "MarketDialog.h" - namespace OpenGate{ Modified: branches/ogsector/src/EntityManager.cpp =================================================================== --- branches/ogsector/src/EntityManager.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/EntityManager.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -41,7 +41,7 @@ Ogre::StringVectorPtr files = pArch->find( "*.xml", true, false); for ( unsigned int i = 0; i < (*files).size(); i ++ ){ - log_->info( std::string( "Found ressource: " ) + (*files)[ i ] ); + log_->fout( std::string( "Found ressource: " ) + (*files)[ i ] ); loadAndCreate( (*resourcePaths.begin()) + "/" + resourceName + "/" + (*files)[ i ] ); } Modified: branches/ogsector/src/GameStateManager.cpp =================================================================== --- branches/ogsector/src/GameStateManager.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/GameStateManager.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -22,6 +22,7 @@ #include <OgreRoot.h> #include <OgreRenderWindow.h> +#include <OgreConfigFile.h> #include <OgreWindowEventUtilities.h> #include "LogManager.h" #include "Console.h" Modified: branches/ogsector/src/LogManager.cpp =================================================================== --- branches/ogsector/src/LogManager.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/LogManager.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -106,6 +106,10 @@ std::cout << msg << std::endl; } +void LogManager::fout( const std::string & msg ){ + write_( msg ); +} + void LogManager::writeToConsole_( const std::string & msg ){ if ( haveConsole_ ) console_->print( msg ); } Modified: branches/ogsector/src/LogManager.h =================================================================== --- branches/ogsector/src/LogManager.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/LogManager.h 2007-06-28 16:05:43 UTC (rev 602) @@ -96,9 +96,12 @@ /*! Protocol a message with fatal-level importance */ void fatal( const std::string & msg ); - /*! TODO: Do we really need that? All messages should go into a logfile. */ + /*! Write to std::out only. For debug purposes only.*/ void cout( const std::string & msg ); + /*! Write to logfile only. */ + void fout( const std::string & msg ); + /*! This method returns the single instance of the LogManager */ static LogManager & getSingleton( void ); Modified: branches/ogsector/src/Makefile.am =================================================================== --- branches/ogsector/src/Makefile.am 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Makefile.am 2007-06-28 16:05:43 UTC (rev 602) @@ -8,6 +8,7 @@ common.h \ common.cpp \ networkProtocol.h \ + networkProtocol.cpp \ networkClient.h \ networkClient.cpp \ tinyxml/tinyxml.h \ @@ -42,6 +43,8 @@ MarketDialog.cpp \ OpcodeWrapper.h \ OpcodeWrapper.cpp \ + Projectile.h \ + Projectile.cpp \ Sector.h \ Sector.cpp \ SectorObjects.h \ @@ -65,6 +68,7 @@ InputManager.h \ InputManager.cpp \ networkProtocol.h \ + networkProtocol.cpp \ networkServer.h \ networkServer.cpp \ networkServerUser.h \ Modified: branches/ogsector/src/Makefile.in =================================================================== --- branches/ogsector/src/Makefile.in 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Makefile.in 2007-06-28 16:05:43 UTC (rev 602) @@ -49,22 +49,24 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_opengateclient_OBJECTS = opengateclient.$(OBJEXT) common.$(OBJEXT) \ - networkClient.$(OBJEXT) tinyxml.$(OBJEXT) \ - tinyxmlerror.$(OBJEXT) tinyxmlparser.$(OBJEXT) \ - Avatar.$(OBJEXT) BaseDialog.$(OBJEXT) ConfigDialog.$(OBJEXT) \ - Console.$(OBJEXT) DeviceManager.$(OBJEXT) \ - DockedState.$(OBJEXT) Entity.$(OBJEXT) EntityManager.$(OBJEXT) \ - GameState.$(OBJEXT) GameStateManager.$(OBJEXT) \ - InputManager.$(OBJEXT) LogManager.$(OBJEXT) \ - MarketDialog.$(OBJEXT) OpcodeWrapper.$(OBJEXT) \ - Sector.$(OBJEXT) SectorObjects.$(OBJEXT) \ - ShipConfigDialog.$(OBJEXT) UnDockedState.$(OBJEXT) \ - Vessel.$(OBJEXT) VesselManager.$(OBJEXT) + networkProtocol.$(OBJEXT) networkClient.$(OBJEXT) \ + tinyxml.$(OBJEXT) tinyxmlerror.$(OBJEXT) \ + tinyxmlparser.$(OBJEXT) Avatar.$(OBJEXT) BaseDialog.$(OBJEXT) \ + ConfigDialog.$(OBJEXT) Console.$(OBJEXT) \ + DeviceManager.$(OBJEXT) DockedState.$(OBJEXT) Entity.$(OBJEXT) \ + EntityManager.$(OBJEXT) GameState.$(OBJEXT) \ + GameStateManager.$(OBJEXT) InputManager.$(OBJEXT) \ + LogManager.$(OBJEXT) MarketDialog.$(OBJEXT) \ + OpcodeWrapper.$(OBJEXT) Projectile.$(OBJEXT) Sector.$(OBJEXT) \ + SectorObjects.$(OBJEXT) ShipConfigDialog.$(OBJEXT) \ + UnDockedState.$(OBJEXT) Vessel.$(OBJEXT) \ + VesselManager.$(OBJEXT) opengateclient_OBJECTS = $(am_opengateclient_OBJECTS) opengateclient_LDADD = $(LDADD) am_opengateserver_OBJECTS = opengateserver.$(OBJEXT) common.$(OBJEXT) \ LogManager.$(OBJEXT) InputManager.$(OBJEXT) \ - networkServer.$(OBJEXT) networkServerUser.$(OBJEXT) + networkProtocol.$(OBJEXT) networkServer.$(OBJEXT) \ + networkServerUser.$(OBJEXT) opengateserver_OBJECTS = $(am_opengateserver_OBJECTS) opengateserver_LDADD = $(LDADD) am_testopenalmanager_OBJECTS = testopenalmanager.$(OBJEXT) \ @@ -187,6 +189,7 @@ common.h \ common.cpp \ networkProtocol.h \ + networkProtocol.cpp \ networkClient.h \ networkClient.cpp \ tinyxml/tinyxml.h \ @@ -221,6 +224,8 @@ MarketDialog.cpp \ OpcodeWrapper.h \ OpcodeWrapper.cpp \ + Projectile.h \ + Projectile.cpp \ Sector.h \ Sector.cpp \ SectorObjects.h \ @@ -244,6 +249,7 @@ InputManager.h \ InputManager.cpp \ networkProtocol.h \ + networkProtocol.cpp \ networkServer.h \ networkServer.cpp \ networkServerUser.h \ @@ -340,6 +346,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MarketDialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OpcodeWrapper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Projectile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SectorObjects.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShipConfigDialog.Po@am__quote@ @@ -348,6 +355,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VesselManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkClient.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkProtocol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkServer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkServerUser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openALSoundManager.Po@am__quote@ Modified: branches/ogsector/src/MarketDialog.cpp =================================================================== --- branches/ogsector/src/MarketDialog.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/MarketDialog.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -151,8 +151,10 @@ bool lesserMass( const Entity * l, const Entity * r ) { return ( l->mass() < r->mass() ); } bool greaterMass( const Entity * l, const Entity * r ) { return ( l->mass() > r->mass() ); } -bool lesserName( const Entity * l, const Entity * r ) { return ( l->name() < r->name() ); } -bool greaterName( const Entity * l, const Entity * r ) { return ( l->name() > r->name() ); } +bool lesserName( const Entity * l, const Entity * r ) { return ( strCopyToLowerCase( l->name() ) < + strCopyToLowerCase( r->name() ) ); } +bool greaterName( const Entity * l, const Entity * r ) { return ( strCopyToLowerCase( l->name() ) > + strCopyToLowerCase( r->name() ) ); } bool lesserSize( const Entity * l, const Entity * r ) { return ( l->size() < r->size() ); } bool greaterSize( const Entity * l, const Entity * r ) { return ( l->size() > r->size() ); } Modified: branches/ogsector/src/OpcodeWrapper.cpp =================================================================== --- branches/ogsector/src/OpcodeWrapper.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/OpcodeWrapper.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -21,9 +21,13 @@ #include "OpcodeWrapper.h" #include "SectorObjects.h" +#include "Projectile.h" #include <OgreOpcode.h> +#include <OgreSceneManager.h> +#include <OgreRay.h> + namespace OpenGate{ template<> OpcodeCollisionDetection * Ogre::Singleton< OpcodeCollisionDetection >::ms_Singleton = 0; @@ -106,7 +110,7 @@ OgreOpcode::CollisionObject* col1 = rayPickReport[ 0 ]->this_object; OgreOpcode::CollisionObject* col2 = rayPickReport[ 0 ]->other_object; - if ( ammo->name() != static_cast< BaseObject * >( col1->getClientData() )->name() ){ + if ( ammo->parent()->name() != static_cast< BaseObject * >( col1->getClientData() )->name() ){ ammo->mainNode()->setPosition( rayPickReport[ 0 ]->contact ); Modified: branches/ogsector/src/OpcodeWrapper.h =================================================================== --- branches/ogsector/src/OpcodeWrapper.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/OpcodeWrapper.h 2007-06-28 16:05:43 UTC (rev 602) @@ -21,10 +21,8 @@ #ifndef _OPENGATE_OPCODEWRAPPER__H #define _OPENGATE_OPCODEWRAPPER__H -#include <OgreSceneManager.h> - #include <OgreSingleton.h> -#include <OgreRay.h> +#include <OgrePrerequisites.h> namespace OgreOpcode{ class CollisionContext; @@ -53,6 +51,7 @@ OgreOpcode::CollisionContext * collideInSectorContext(){ return collideInSectorContext_; } static OpcodeCollisionDetection & getSingleton( ); + static OpcodeCollisionDetection * getSingletonPtr( ); protected: Added: branches/ogsector/src/Projectile.cpp =================================================================== --- branches/ogsector/src/Projectile.cpp (rev 0) +++ branches/ogsector/src/Projectile.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -0,0 +1,194 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * spo...@us... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "Projectile.h" +#include "Sector.h" +#include "OpcodeWrapper.h" + +#include <OgreVector3.h> +#include <OgreManualObject.h> +#include <OgreBillboard.h> +#include <OgreBillboardSet.h> + +namespace OpenGate{ + +Projectile::Projectile( BaseObject * parent, long shotCounter, Ogre::Real speed, Uint32 damage, Ogre::Real liveTime ) + : BaseObject( parent->name() + "_" + toStr( shotCounter ), parent->sector() ), parent_( parent ), + shotCount_( shotCounter), damage_( damage ), maxLiveTime_( liveTime ){ + selectable_ = false; + + Ogre::String bulletName( name_ + "_" + toStr( shotCounter ) ); + + beam_ = NULL; + bullet_ = NULL; + shape_ = NULL; + + Ogre::Vector3 position( parent_->mainNode()->getPosition() ); + Ogre::Quaternion direction( parent_->mainNode()->getOrientation() ); + + bool bullet = true; + + if ( bullet ){ + int maxBB = 20; + bullet_ = sceneMgr_->createBillboardSet( bulletName + "_BBS", maxBB ); + bullet_->setMaterialName("Bullet"); + + Ogre::Billboard *bb; +// bb = bullet_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 1.0f, 1.0f) ); +// bb->setDimensions( 1.0, 0.2 ); +// bb->setRotation ( Ogre::Radian( 0 ) ); + + for ( int i = 0; i < maxBB; i ++ ){ + bb = bullet_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 0.5f, 0.5f, 0.5f) ); + bb->setDimensions( 1.0 - i * 1.0/maxBB* 0.5 , 1.0 - i * 1.0/maxBB * 0.5 ); + bb->setRotation ( Ogre::Radian( i*10.0 ) ); + bb->setPosition( direction.zAxis().normalisedCopy() * i * 0.5 ); + } + mainNode_->attachObject( bullet_ ); + + } else { + beam_ = sceneMgr_->createManualObject( bulletName + "_MObj" ); + beam_->begin( "WhiteNoBackground", Ogre::RenderOperation::OT_TRIANGLE_LIST); + +// beam_->position( direction.xAxis().normalisedCopy() * -0.2 ); +// beam_->position( direction.xAxis().normalisedCopy() * 0.2 ); +// beam_->position( direction.xAxis().normalisedCopy() * 0.2 + direction.zAxis().normalisedCopy() * 1.0 ); +// beam_->position( direction.xAxis().normalisedCopy() * -0.2 + direction.zAxis().normalisedCopy() * 1.0 ); + + beam_->position( -0.2, 0, 0 ); + beam_->position( 0.2, 0, 0 ); + beam_->position( 0.2, 0, 1.0 ); + beam_->position( -0.2, 0, 1.0 ); + + beam_->quad( 0, 1, 2, 3 ); + beam_->quad( 0, 3, 2, 1 ); + beam_->end(); + + shape_ = mainNode_->createChildSceneNode( bulletName + "_transform" ); + shape_->attachObject( beam_ ); + + mainNode_->setOrientation( direction ); + } + +// chain_ = sceneMgr_->createBillboardChain( name_ + "_" + toStr( shotCounter ) + "_ProjectileBBC" ); +// chain_->setMaxChainElements( 10 ); +// chain_->setMaterialName("BulletWhite"); + +// for ( int i = 0; i < 10; i ++ ){ +// chain_->addChainElement(0, Ogre::BillboardChain::Element( Ogre::Vector3( 0.0, 0.0, Ogre::Real( i * 0.01 ) ), +// 0.2, 0.1, Ogre::ColourValue(0.0f, 0.0f, 0.0f) ) ); +// // chain_->addChainElement(0, Ogre::BillboardChain::Element( Ogre::Vector3( 0.0, -0.1, Ogre::Real( i * 0.01 ) ), +// // 0.2, 0.1, Ogre::ColourValue(1.0f, 1.0f, 1.0f) ) ); +// } +// mainNode_->attachObject( chain_ ); +// chain_->setVisible( true ); + +// bullet_ = sceneMgr_->createManualObject( bulletName + "_BulletShape" ); +// bullet_->begin("Bullet1", Ogre::RenderOperation::OT_TRIANGLE_LIST); +// Ogre::Real scale = 0.1; +// unsigned point_index = 0; +// bullet_->position( -scale, -scale, 0 ); +// bullet_->position( scale, -scale, 0 ); +// bullet_->position( scale, scale, 0 ); +// bullet_->position( -scale, -scale, 0 ); +// bullet_->quad(point_index, point_index + 1, point_index + 2, point_index + 3); +// point_index += 4; +// bullet_->position( -scale, -scale, 0 ); +// bullet_->position( scale, scale, 0 ); +// bullet_->position( -scale, scale, 0 ); +// bullet_->position( -scale, -scale, 0 ); +// bullet_->quad(point_index, point_index + 1, point_index + 2, point_index + 3); +// point_index += 4; +// bullet_->end(); +// mainNode_->attachObject( bullet_ ); + + + mainNode_->setPosition( position ); + mainNode_->setPosition( position + + direction.zAxis().normalisedCopy() * -6.2 + + direction.xAxis().normalisedCopy() * 1.5 + + direction.yAxis().normalisedCopy() * -0.2 ); + + lifeTime_ = 0.0; + oldTime_ = 0.0; + + vel_ = speed * -direction.zAxis().normalisedCopy() + parent->velocity(); +} + +Projectile::~Projectile() { + if ( bullet_ ){ + mainNode_->detachObject( bullet_ ); + sceneMgr_->destroyBillboardSet( bullet_ ); + } + + if ( beam_ ){ + if ( shape_ ) { + shape_->detachObject( beam_ ); + mainNode_->removeAndDestroyChild( shape_->getName() ); + // sceneMgr_->destroySceneNode( shape_ ); + } + sceneMgr_->destroyManualObject( beam_ ); + } + // mainNode_->detachObject( chain_ ); + // sceneMgr_->destroyBillboardChain( chain_ ); +} + +void Projectile::collide( BaseObject * object ){ + if ( name_ != object->name() ){ + vel_ *= 0.0; + + //** show us a small visible feedback; + if ( bullet_ ){ + bullet_->getBillboard( 0 )->setColour( Ogre::ColourValue(0.0, 1.0, 0.0) ); + bullet_->getBillboard( 0 )->setDimensions( 5, 5 ); + } + lifeTime_ = max( lifeTime_, maxLiveTime_ - 0.1f ); + +// sector_->collisionContext()->removeObject( collObj_ ); +// OgreOpcode::CollisionManager::getSingletonPtr()->detachShape( collObj_->getShape() ); + } + + sector_->sendVesselAmmoHit( *this, object ); +} + +bool Projectile::update( Ogre::Real elapsedTime ){ + if ( elapsedTime < 0.001 ) return true; + + lifeTime_ += elapsedTime; + if ( lifeTime_ >= maxLiveTime_ ) return false; + + if ( vel_.length() > 0.1 ){ + + Ogre::Ray bulletRay( mainNode_->getPosition(), vel_.normalisedCopy() ); + + if ( !OpcodeCollisionDetection::getSingleton().checkCollideRay( this, bulletRay, (vel_ * elapsedTime).length() ) ){ + if ( bullet_ ){ + mainNode_->translate( vel_ * elapsedTime ); + } else if ( beam_ ){ + mainNode_->translate( vel_ * elapsedTime ); + shape_->setScale( 1.0, 1.0, (vel_ * lifeTime_).length() ); + // mainNode_->translate( 0.0, 0.0, - (vel_ * elapsedTime ).length()/2.0 ); + } + } + } + return true; +} + +} //namespace OpenGate{ Added: branches/ogsector/src/Projectile.h =================================================================== --- branches/ogsector/src/Projectile.h (rev 0) +++ branches/ogsector/src/Projectile.h 2007-06-28 16:05:43 UTC (rev 602) @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * spo...@us... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _OPENGATE_PROJECTILE__H +#define _OPENGATE_PROJECTILE__H + +#include "SectorObjects.h" +#include <OgrePrerequisites.h> + +namespace OpenGate{ + +class Projectile : public BaseObject { +public: + Projectile( BaseObject * parent, long shotCount, Ogre::Real speed, Uint32 damage, Ogre::Real liveTime ); + + virtual ~Projectile(); + + inline virtual long getTypeID() const { return PROJECTILE_RTTI; } + + virtual void collide( BaseObject * object ); + + inline Uint32 damage( ) const { return damage_; } + + virtual bool update( Ogre::Real elapsedTime ); + + BaseObject * parent( ) { return parent_; } + + BaseObject & parent( ) const { return *parent_; } + + Ogre::Vector3 velocity() const { return vel_; } + + Ogre::Real liveTime() const { return maxLiveTime_; } + + Uint16 shotCount() const { return shotCount_; } + +protected: + + BaseObject * parent_; + Uint16 shotCount_; + Uint32 damage_; + // Ogre::BillboardChain * chain_; + Ogre::BillboardSet * bullet_; + Ogre::ManualObject * beam_; + Ogre::Vector3 vel_; + + Ogre::SceneNode * shape_; + + Ogre::Real maxLiveTime_; + Ogre::Real oldTime_; +}; + + +} // namespace OpenGate + + +#endif // _OPENGATE_PROJECTILE__H Modified: branches/ogsector/src/Sector.cpp =================================================================== --- branches/ogsector/src/Sector.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Sector.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -23,7 +23,12 @@ #include "OpcodeWrapper.h" #include "tinyxml/tinyxml.h" #include "DeviceManager.h" +#include "Projectile.h" +#include <OgreManualObject.h> +#include <OgreOverlayManager.h> +#include <OgreOverlayContainer.h> + namespace OpenGate{ // class StarField : public Ogre::SimpleRenderable { @@ -140,8 +145,13 @@ // entity->setMaterialName("Examples/OffsetMapping/Specular"); // entity->setVisible( true ); + populate( "testsector.xml" ); +// createCircle(); - populate( "testsector.xml" ); +// SectorObject *obj = createStaticObject( "lady_kickstart.mesh", "lady_kickstart", Ogre::Vector3( 0,0,450) ); +// obj->setBaseRot( -90, -90, 0 ); +// obj->setBaseSize( Ogre::Vector3( 10, 3.4, 10.9 ) ); + itTarget_ = sectorObjects_.begin(); } @@ -225,9 +235,12 @@ std::set < Vessel * > vessels( VesselManager::getSingleton().factionVessels( (*factIt) ) ); int vesselCounter = 0; for ( std::set < Vessel * >::iterator it = vessels.begin(); it != vessels.end(); it ++ ){ - createStaticObject( (*it)->meshPtr().get()->getName(), (*it)->factionName() + "/" + (*it)->name(), - Ogre::Vector3( -1000.0, 50 * factionCounter, -100.0 + 100 * vesselCounter ), - Ogre::Real( (*it)->baseSize() ), Ogre::Degree( (*it)->baseYaw() ) ); + SectorObject * obj = createStaticObject( (*it)->meshPtr().get()->getName(), + (*it)->factionName() + "/" + (*it)->name(), + Ogre::Vector3( -1000.0, 50 * factionCounter, + -100.0 + 100 * vesselCounter ) ); + obj->setBaseRot( (*it)->baseYaw(), (*it)->basePitch(), (*it)->baseRoll() ); + obj->setBaseSize( (*it)->baseSize() ); vesselCounter++; } factionCounter++; @@ -338,22 +351,26 @@ Ogre::Quaternion q; q.FromAngleAxis( -avatar_->mainNode()->getOrientation( ).getYaw(), Ogre::Vector3::UNIT_Y); relativPosition = q * relativPosition; - + +// Ogre::Quaternion r( Ogre::Degree(20), Ogre::Vector3::UNIT_Z); +// relativPosition = r * relativPosition; + // std::cout << relativPosition << std::endl; + Ogre::Plane viewPlane( avatar_->mainNode()->getOrientation().yAxis().normalisedCopy(), avatar_->mainNode()->getPosition() ); float distToPlane = viewPlane.getDistance( (*it)->mainNode()->getPosition( ) ) / yScale; - dotB->setHeight( fabs( distToPlane ) ); - dotA->setPosition( radarWidth / 2.0 + relativPosition[ 0 ] / xScale - dotAWidth / 2, - - distToPlane - dotAHeight / 2 + radarHeight / 2.0 + relativPosition[ 2 ] / yScale ); + radarHeight / 2.0 + relativPosition[ 2 ] / yScale - dotAHeight / 2 - distToPlane ); if ( distToPlane < 0 ) distToPlane = 0; + dotB->setHeight( fabs( distToPlane ) ); dotB->setPosition( radarWidth / 2.0 + relativPosition[ 0 ] / xScale, - distToPlane + radarHeight / 2.0 + relativPosition[ 2 ] / yScale ); + if ( (*it)->isOnRadar() == false ){ radarMap->addChild( dotA ); radarMap->addChild( dotB ); @@ -457,12 +474,13 @@ } SectorObject * Sector::createStaticObject( const Ogre::String & meshname, const Ogre::String & objectname, - const Ogre::Vector3 & pos, Ogre::Real targetSize, Ogre::Degree yaw ){ + const Ogre::Vector3 & pos, const Ogre::Vector3 & targetSize, Ogre::Degree yaw ){ SectorObject * obj = new SectorObject( objectname, this ); - obj->baseYaw( yaw ); + obj->mainNode()->yaw( yaw ); obj->setShape( meshname ); + obj->setBaseSize( targetSize ); obj->mainNode()->setPosition( pos ); @@ -594,39 +612,90 @@ return NULL; } -void Sector::createCircle(){ - +void Sector::createCircle( ){ Ogre::String name = "testcircle"; Ogre::SceneNode * object = sceneMgr_->getRootSceneNode()->createChildSceneNode( name ); Ogre::ManualObject * circle = sceneMgr_->createManualObject( name + "shape" ); - float const radius = 50; - float const thickness = 3; // Of course this must be less than the radius value. - float const accuracy = 5; + Ogre::Real radius = 200; + Ogre::Real thickness = 200.0; // Of course this must be less than the radius value. + Ogre::Real nSegments = 96; + Ogre::Real dPhi = 2.0 * 3.141592 / nSegments; + + circle->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + circle->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 23./255, 118./255, 9./255, 0.1 ) ); + circle->getSection( 0 )->setCustomParameter( 1, Ogre::Vector4( radius, 0, 0, 0 ) ); + + unsigned point_index = 0; - circle->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST); + for ( int segment = 0; segment < nSegments; segment++ ) { + Ogre::Real theta = segment * dPhi; + circle->position( radius * cos( theta ), + 0, + radius * sin( theta ) ); + circle->position( (radius - thickness) * cos( theta ), + 0, + (radius - thickness) * sin( theta ) ); + + if ( segment > 0 ){ + point_index = (segment+1)*2-1; + circle->quad( point_index, point_index-1, point_index-3, point_index-2 ); + circle->quad( point_index, point_index-2, point_index-3, point_index-1 ); + } + } + circle->quad( 1, 0, (uint)nSegments*2-2, (uint)nSegments*2-1 ); + circle->quad( 1, (uint)nSegments*2-1, (uint)nSegments*2-2, 0 ); + circle->end(); + object->translate( 0, 0, 50); + object->pitch( Ogre::Degree( 10 ) ); + object->attachObject( circle ); + +} + +void Sector::createRings( ){ + + Ogre::String name = "rings"; + + Ogre::SceneNode * object = sceneMgr_->getRootSceneNode()->createChildSceneNode( name ); + Ogre::ManualObject * circle = sceneMgr_->createManualObject( name + "shape" ); + + Ogre::Real radius = 50; + Ogre::Real thickness = 4; // Of course this must be less than the radius value. + Ogre::Real nSegments = 32; + Ogre::Real dPhi = 2.0 * 3.141592 / nSegments; + unsigned point_index = 0; - for( float theta = 0; - theta <= 2.0 * 3.141592; // Ogre::Math::PI collide ;) with some stuff from opcode - theta += 3.141592 / (radius * accuracy) ) { - circle->position(radius * cos(theta), radius * sin(theta), -50 ); - circle->position(radius * cos(theta - 3.141592 / (radius * accuracy)), - radius * sin(theta - 3.141592 / (radius * accuracy)), -50); + int nRings = 10; + for ( int i = 0; i < nRings; i ++ ){ - circle->position((radius - thickness) * cos(theta - 3.141592 / (radius * accuracy)), - (radius - thickness) * sin(theta - 3.141592 / (radius * accuracy)), -50); + circle->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + circle->getSection( i )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0-i*0.1, i*0.1, 0.4 ) ); + circle->getSection( i )->setCustomParameter( 1, Ogre::Vector4( radius, 0, 0, 0 ) ); - circle->position((radius - thickness) * cos(theta), (radius - thickness) * sin(theta), -50); - // Join the 4 vertices created above to form a quad. - circle->quad(point_index, point_index + 3, point_index + 2, point_index + 1); - point_index += 4; + for ( int segment = 0; segment < nSegments; segment++ ) { + Ogre::Real theta = segment * dPhi; + circle->position( radius * cos( theta ), + -radius + i * radius /( nRings / 2.0 ), + radius * sin( theta ) ); + circle->position( (radius - thickness) * cos( theta ), + -radius + i * radius / ( nRings / 2.0 ), + (radius - thickness) * sin( theta ) ); + + if ( segment > 0 ){ + point_index = (segment+1)*2-1; + circle->quad( point_index, point_index-1, point_index-3, point_index-2 ); + circle->quad( point_index, point_index-2, point_index-3, point_index-1 ); + } + } + circle->quad( 1, 0, (uint)nSegments*2-2, (uint)nSegments*2-1 ); + circle->quad( 1, (uint)nSegments*2-1, (uint)nSegments*2-2, 0 ); + circle->end(); } - circle->end(); - - object->translate( 500, 0, -200); + + object->translate( -2000, -200, -300); object->attachObject( circle ); } Modified: branches/ogsector/src/Sector.h =================================================================== --- branches/ogsector/src/Sector.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Sector.h 2007-06-28 16:05:43 UTC (rev 602) @@ -21,7 +21,7 @@ #ifndef _OPENGATE_SECTOR__H #define _OPENGATE_SECTOR__H -#include <Ogre.h> +#include <OgrePrerequisites.h> #include "UnDockedState.h" #include "SectorObjects.h" @@ -51,7 +51,7 @@ SectorObject * createStaticObject( const Ogre::String & meshname, const Ogre::String & objectname, const Ogre::Vector3 & pos ); SectorObject * createStaticObject( const Ogre::String & meshname, const Ogre::String & objectname, - const Ogre::Vector3 & pos, Ogre::Real targetSize, Ogre::Degree yaw ); + const Ogre::Vector3 & pos, const Ogre::Vector3 & targetSize, Ogre::Degree yaw ); SectorObjectMoveable * createMoveableObject( const Ogre::String & name, int userId, int childId, Vessel & vessel ); @@ -70,6 +70,8 @@ void spawnAiObject( const std::string & vesselName ); void createCircle( ); + void createRings( ); + void selectNextTarget( SectorObject * obj = NULL ); Modified: branches/ogsector/src/SectorObjects.cpp =================================================================== --- branches/ogsector/src/SectorObjects.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/SectorObjects.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -18,12 +18,19 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "common.h" #include "Sector.h" #include "SectorObjects.h" -#include "common.h" +#include "Projectile.h" #include "OpcodeWrapper.h" -//#include <OgreOpcode.h> +#include <OgreOverlayManager.h> +#include <OgreOverlayElement.h> +#include <OgreEntity.h> +#include <OgreParticleSystem.h> +#include <OgreParticleEmitter.h> +#include <OgreBillboardSet.h> + #include <string> namespace OpenGate{ @@ -48,147 +55,16 @@ sceneMgr_->getRootSceneNode()->removeAndDestroyChild( mainNode_->getName() ); } -Projectile::Projectile( BaseObject * parent, long shotCounter, Ogre::Real speed, Uint32 damage, Ogre::Real liveTime ) - : BaseObject( parent->name() + "_" + toStr( shotCounter ), parent->sector() ), parent_( parent ), - shotCount_( shotCounter), damage_( damage ), maxLiveTime_( liveTime ){ - selectable_ = false; +Ogre::Vector3 BaseObject::position() const { return mainNode_->getPosition(); } - Ogre::String bulletName( name_ + "_" + toStr( shotCounter ) ); - -// chain_ = sceneMgr_->createBillboardChain( name_ + "_" + toStr( shotCounter ) + "_ProjectileBBC" ); -// chain_->setMaxChainElements( 10 ); -// chain_->setMaterialName("BulletWhite"); - -// for ( int i = 0; i < 10; i ++ ){ -// chain_->addChainElement(0, Ogre::BillboardChain::Element( Ogre::Vector3( 0.0, 0.0, Ogre::Real( i * 0.01 ) ), -// 0.2, 0.1, Ogre::ColourValue(0.0f, 0.0f, 0.0f) ) ); -// // chain_->addChainElement(0, Ogre::BillboardChain::Element( Ogre::Vector3( 0.0, -0.1, Ogre::Real( i * 0.01 ) ), -// // 0.2, 0.1, Ogre::ColourValue(1.0f, 1.0f, 1.0f) ) ); -// } -// mainNode_->attachObject( chain_ ); -// chain_->setVisible( true ); - - Ogre::Vector3 position( parent_->mainNode()->getPosition() ); - Ogre::Quaternion direction( parent_->mainNode()->getOrientation() ); - - int maxBB = 20; - bbs_ = sceneMgr_->createBillboardSet( bulletName + "_BBS", maxBB ); - bbs_->setMaterialName("Bullet"); - - Ogre::Billboard *bb; -// bb = bbs_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 1.0f, 1.0f) ); -// bb->setDimensions( 1.0, 0.2 ); -// bb->setRotation ( Ogre::Radian( 0 ) ); - - for ( int i = 0; i < maxBB; i ++ ){ - bb = bbs_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 0.5f, 0.5f, 0.5f) ); - bb->setDimensions( 1.0 - i * 1.0/maxBB* 0.5 , 1.0 - i * 1.0/maxBB * 0.5 ); - bb->setRotation ( Ogre::Radian( i*10.0 ) ); - bb->setPosition( direction.zAxis().normalisedCopy() * i * 0.5 ); - } - - mainNode_->attachObject( bbs_ ); - -// bullet_ = sceneMgr_->createManualObject( bulletName + "_BulletShape" ); -// bullet_->begin("Bullet1", Ogre::RenderOperation::OT_TRIANGLE_LIST); -// Ogre::Real scale = 0.1; -// unsigned point_index = 0; -// bullet_->position( -scale, -scale, 0 ); -// bullet_->position( scale, -scale, 0 ); -// bullet_->position( scale, scale, 0 ); -// bullet_->position( -scale, -scale, 0 ); -// bullet_->quad(point_index, point_index + 1, point_index + 2, point_index + 3); -// point_index += 4; -// bullet_->position( -scale, -scale, 0 ); -// bullet_->position( scale, scale, 0 ); -// bullet_->position( -scale, scale, 0 ); -// bullet_->position( -scale, -scale, 0 ); -// bullet_->quad(point_index, point_index + 1, point_index + 2, point_index + 3); -// point_index += 4; -// bullet_->end(); -// mainNode_->attachObject( bullet_ ); - - mainNode_->setPosition( position ); - mainNode_->setPosition( position + - direction.zAxis().normalisedCopy() * -6.2 + - direction.xAxis().normalisedCopy() * 1.5 + - direction.yAxis().normalisedCopy() * -0.2 ); - - // mainNode_->setOrientation( direction ); - - lifeTime_ = 0.0; - oldTime_ = 0.0; - - vel_ = speed * -direction.zAxis().normalisedCopy() + parent->velocity(); -} - -Projectile::~Projectile() { - mainNode_->detachObject( bbs_ ); - sceneMgr_->destroyBillboardSet( bbs_ ); - // mainNode_->detachObject( chain_ ); - // sceneMgr_->destroyBillboardChain( chain_ ); -} - -void Projectile::collide( BaseObject * object ){ - if ( name_ != object->name() ){ - vel_ *= 0.0; - - //** show us a small visible feedback - bbs_->getBillboard( 0 )->setColour( Ogre::ColourValue(0.0, 1.0, 0.0) ); - bbs_->getBillboard( 0 )->setDimensions( 5, 5 ); - lifeTime_ = max( lifeTime_, maxLiveTime_ - 0.1f ); - -// sector_->collisionContext()->removeObject( collObj_ ); -// OgreOpcode::CollisionManager::getSingletonPtr()->detachShape( collObj_->getShape() ); - } - - sector_->sendVesselAmmoHit( *this, object ); -} - -bool Projectile::update( Ogre::Real elapsedTime ){ - if ( elapsedTime < 0.001 ) return true; - - lifeTime_ += elapsedTime; - if ( lifeTime_ >= maxLiveTime_ ) return false; - - if ( vel_.length() > 0.1 ){ - - Ogre::Ray bulletRay( mainNode_->getPosition(), vel_.normalisedCopy() ); - - if ( !OpcodeCollisionDetection::getSingleton().checkCollideRay( this, bulletRay, (vel_ * elapsedTime).length() ) ){ - mainNode_->translate( vel_ * elapsedTime ); - } - -// OgreOpcode::CollisionPair ** rayPickReport; -// int nColl = OgreOpcode::CollisionManager::getSingletonPtr() -// ->getDefaultContext()->rayCheck( bulletRay, (vel_ * elapsedTime).length(), -// OgreOpcode::COLLTYPE_EXACT, -// OgreOpcode::COLLTYPE_ALWAYS_EXACT, rayPickReport ); - -// if ( nColl > 0 ){ -// OgreOpcode::CollisionObject* col1 = rayPickReport[ 0 ]->this_object; -// OgreOpcode::CollisionObject* col2 = rayPickReport[ 0 ]->other_object; - -// if ( this->name() != static_cast< BaseObject * >( col1->getClientData() )->name() ){ - -// mainNode_->setPosition( rayPickReport[ 0 ]->contact ); - -// this->collide( static_cast< BaseObject * >( col2->getClientData() ) ); -// static_cast< BaseObject * >( col1->getClientData() )->collide( this ); -// return true; -// } -// } - } - return true; -} - - SectorObject::SectorObject( const Ogre::String & name, Sector * sector, int userID, int childID ) : BaseObject( name, sector, userID, childID ) { isOnRadar_ = false; - mainNodeEntity_ = mainNode_->createChildSceneNode( name_ + "_transform" ); - baseSize_ = 0.0; + mainNodeEntityScale_ = mainNode_->createChildSceneNode( name_ + "_baseScale" ); + mainNodeEntityRot_ = mainNodeEntityScale_->createChildSceneNode( name_ + "_baseRot" ); + + baseSize_ = Ogre::Vector3::ZERO; selectable_ = true; int dotAWidth = 4; @@ -214,42 +90,61 @@ OpcodeCollisionDetection::getSingleton().destroyObject( collObj_ ); - mainNodeEntity_->detachObject( entity_ ); + mainNodeEntityRot_->detachObject( entity_ ); sceneMgr_->destroyEntity( entity_ ); - mainNode_->removeAndDestroyChild( mainNodeEntity_->getName() ); + mainNodeEntityScale_->removeAndDestroyChild( mainNodeEntityRot_->getName() ); + mainNode_->removeAndDestroyChild( mainNodeEntityScale_->getName() ); } void SectorObject::setShape( const Ogre::String & meshname ){ entity_ = sceneMgr_->createEntity( name_ + "_shape", meshname ); - mainNodeEntity_->attachObject( entity_ ); + mainNodeEntityRot_->attachObject( entity_ ); collObj_ = OpcodeCollisionDetection::getSingleton().createObject( this ); } void SectorObject::scale( const Ogre::Vector3 & scale ){ - baseSize_ = scale[ 0 ] * ( entity_->getBoundingBox().getMaximum()[ 0 ] - - entity_->getBoundingBox().getMinimum()[ 0 ] ); - mainNodeEntity_->scale( scale ); + baseSize_ = scale * ( entity_->getBoundingBox().getMaximum() - entity_->getBoundingBox().getMinimum() ); + mainNodeEntityScale_->scale( scale ); } void SectorObject::setBaseSize( const Ogre::Vector3 & size ){ - Ogre::Real scaleX = size[ 0 ] / ( entity_->getBoundingBox().getMaximum()[ 0 ] - - entity_->getBoundingBox().getMinimum()[ 0 ] ); - Ogre::Real scaleY = size[ 1 ] / ( entity_->getBoundingBox().getMaximum()[ 1 ] - - entity_->getBoundingBox().getMinimum()[ 1 ] ); - Ogre::Real scaleZ = size[ 2 ] / ( entity_->getBoundingBox().getMaximum()[ 2 ] - - entity_->getBoundingBox().getMinimum()[ 2 ] ); - mainNodeEntity_->scale( scaleX, scaleY, scaleZ ); - baseSize_ = size[ 0 ]; -} + Ogre::Vector3 scale( size / ( mainNodeEntityRot_->getOrientation() * ( mainNodeEntityRot_->_getWorldAABB().getMaximum()- + mainNodeEntityRot_->_getWorldAABB().getMinimum() ) ) ); -void SectorObject::setBaseSize( Ogre::Real targetSize ){ + scale[0]= fabs(scale[0]); + scale[1]= fabs(scale[1]); + scale[2]= fabs(scale[2]); - Ogre::Real scale = targetSize / ( entity_->getBoundingBox().getMaximum()[ 0 ] - - entity_->getBoundingBox().getMinimum()[ 0 ] ); - mainNodeEntity_->scale( scale, scale, scale ); - baseSize_ = targetSize; + if ( scale[ 0 ] == 0.0 && scale[ 1 ] == 0.0 && scale[ 2 ] != 0.0) { + scale[ 0 ] = scale[ 2 ]; scale[ 1 ] = scale[ 2 ]; + } + if ( scale[ 0 ] == 0.0 && scale[ 1 ] != 0.0 && scale[ 2 ] == 0.0) { + scale[ 0 ] = scale[ 1 ]; scale[ 2 ] = scale[ 1 ]; + } + if ( scale[ 0 ] != 0.0 && scale[ 1 ] == 0.0 && scale[ 2 ] == 0.0) { + scale[ 2 ] = scale[ 0 ]; scale[ 1 ] = scale[ 0 ]; + } + +// std::cout << name_ << std::endl; +// std::cout << size << std::endl; +// std::cout << scale << std::endl; +// std::cout << entity_->getBoundingBox().getMaximum()- entity_->getBoundingBox().getMinimum() << std::endl; +// std::cout << mainNodeEntityRot_->getOrientation() * (entity_->getBoundingBox().getMaximum()- entity_->getBoundingBox().getMinimum()) << std::endl; +// std::cout << mainNode_->_getWorldAABB().getMaximum()- +// mainNode_->_getWorldAABB().getMinimum() << std::endl; +// std::cout << mainNode_->_getDerivedScale() << std::endl; + + mainNodeEntityScale_->scale( scale ); + + baseSize_ = size; } +void SectorObject::setBaseRot( const Ogre::Real & yaw, const Ogre::Real & pitch, const Ogre::Real & roll ){ + mainNodeEntityRot_->yaw( Ogre::Degree( yaw ) ); + mainNodeEntityRot_->pitch( Ogre::Degree( pitch ) ); + mainNodeEntityRot_->roll( Ogre::Degree( roll ) ); +} + SectorObjectMoveable::SectorObjectMoveable( const Ogre::String & name, Sector * sector, int userID, int childID, Vessel * vessel ) : SectorObject( name, sector, userID, childID ), vessel_( vessel ) { @@ -259,7 +154,7 @@ LogManager::getSingleton().info( "Create " + name + " with " + vessel_->name() ); - baseYaw( Ogre::Degree( vessel_->baseYaw() ) ); + setBaseRot( vessel_->baseYaw(), vessel_->basePitch(), vessel_->baseRoll() ); setBaseSize( vessel_->baseSize() ); if ( vessel_->factionID() == 4 ){ @@ -365,6 +260,8 @@ return true; } +void SectorObjectMoveable::setVisible( bool visible ) { mainNode_->setVisible( visible ); } + void SectorObjectMoveable::setFlightProperties( const MessageBodyShipMovement & msg ){ if ( forceMovement_ ){ mainNode_->setPosition( msg.position() ); @@ -628,7 +525,12 @@ if ( fireDelay_ <= 0 ){ Uint32 damage = 1000000; +// Ogre::Real liveTime = 0.14; +// ammoSpeed_ = 10000; + Ogre::Real liveTime = 1.4; + ammoSpeed_ = 1000; + if ( firePressed_ ){ if ( capacity_ > damage ){ Projectile * pro = new Projectile( this, shotsFired_, ammoSpeed_, damage, liveTime ); @@ -758,8 +660,6 @@ SectorObjectAvatar::SectorObjectAvatar( const Ogre::String & name, Sector * sector, long userID, Vessel * vessel ) : SectorObjectMoveableLocal( name, sector, userID, 0, vessel ) { - ammoSpeed_ = 1000; - thrustRate_ = 0; maxCapacity_ = 0; Modified: branches/ogsector/src/SectorObjects.h =================================================================== --- branches/ogsector/src/SectorObjects.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/SectorObjects.h 2007-06-28 16:05:43 UTC (rev 602) @@ -21,7 +21,7 @@ #ifndef PLAYERSHIP__H #define PLAYERSHIP__H -#include <Ogre.h> +#include <OgrePrerequisites.h> #include "common.h" #include "networkProtocol.h" @@ -40,13 +40,14 @@ #define AVATAR_RTTI 100005 class Sector; +class Projectile; class OpcodeCollisionDetection; -class BaseObject : public Ogre::UserDefinedObject{ +class BaseObject{ public: BaseObject( const Ogre::String & name, Sector * sector, int userId = 0, int childId = 0 ); - ~BaseObject(); + virtual ~BaseObject(); virtual long getTypeID() const = 0; @@ -76,6 +77,8 @@ void setSelectable( bool selectable ) { selectable_ = selectable; } + Ogre::Vector3 position() const; + protected: Ogre::String name_; Sector * sector_; @@ -90,44 +93,6 @@ Ogre::Real lifeTime_; }; -class Projectile : public BaseObject { -public: - Projectile( BaseObject * parent, long shotCount, Ogre::Real speed, Uint32 damage, Ogre::Real liveTime ); - - virtual ~Projectile(); - - inline virtual long getTypeID() const { return PROJECTILE_RTTI; } - - virtual void collide( BaseObject * object ); - - inline Uint32 damage( ) const { return damage_; } - - virtual bool update( Ogre::Real elapsedTime ); - - BaseObject * parent( ) { return parent_; } - - BaseObject & parent( ) const { return *parent_; } - - Ogre::Vector3 velocity() const { return vel_; } - Ogre::Vector3 position() const { return Ogre::Vector3( mainNode_->getPosition() ); } - - Ogre::Real liveTime() const { return maxLiveTime_; } - - Uint16 shotCount() const { return shotCount_; } - -protected: - BaseObject * parent_; - Uint16 shotCount_; - Uint32 damage_; - // Ogre::BillboardChain * chain_; - Ogre::BillboardSet * bbs_; - // Ogre::ManualObject * bullet_; - Ogre::Vector3 vel_; - - Ogre::Real maxLiveTime_; - Ogre::Real oldTime_; -}; - class SectorObject : public BaseObject { public: SectorObject( const Ogre::String & name, Sector * sector, int userID = 0, int childID = 0 ); @@ -142,22 +107,20 @@ virtual bool update( Ogre::Real elapsedTime ){ return true; } - void baseYaw( Ogre::Degree yaw ) { mainNodeEntity_->yaw( yaw ); } - void setShape( const Ogre::String & meshname ); - void setShape( Ogre::MeshPtr & mesh ); - Ogre::Entity * shape(){ return entity_; } void scale( const Ogre::Vector3 & scale ); void setBaseSize( const Ogre::Vector3 & targetSize ); + void setBaseRot( const Ogre::Real & yaw, const Ogre::Real & pitch = 0, const Ogre::Real & roll = 0 ); - void setBaseSize( Ogre::Real targetSize ); + Ogre::Vector3 baseSize( ) const { return baseSize_; } + Ogre::Real maxBaseSize( ) const { + return max( max( baseSize_[0],baseSize_[1] ), baseSize_[2] ); + } - Ogre::Real baseSize( ) const { return baseSize_; } - bool isOnRadar() const { return isOnRadar_; } void onRadar( bool onradar ) { isOnRadar_ = onradar; } @@ -168,14 +131,15 @@ protected: - Ogre::SceneNode * mainNodeEntity_; // Main character node + Ogre::SceneNode * mainNodeEntityRot_; // Main character node for base rotation + Ogre::SceneNode * mainNodeEntityScale_; // Main character node for base size Ogre::Entity * entity_; Ogre::OverlayElement * dotA_; Ogre::OverlayElement * dotB_; bool isOnRadar_; - double baseSize_; + Ogre::Vector3 baseSize_; }; /*! Base class for movable objects, instances are only used for foreign player objects. */ @@ -194,7 +158,7 @@ virtual bool update( Ogre::Real elapsedTime ); /*! Change visibility - Useful for 1st person view and death sequence */ - inline void setVisible( bool visible ) { mainNodeEntity_->setVisible( visible ); } + void setVisible( bool visible ); /*! Apply movement from net.*/ void setFlightProperties( const MessageBodyShipMovement & msg ); Modified: branches/ogsector/src/ShipConfigDialog.cpp =================================================================== --- branches/ogsector/src/ShipConfigDialog.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/ShipConfigDialog.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -24,6 +24,9 @@ #include <OgreEntity.h> #include <OgreRoot.h> #include <OgreRenderSystem.h> +#include <OgreRenderTargetListener.h> +#include <OgreRenderTexture.h> +#include <OgreCEGUITexture.h> #include <CEGUIWindow.h> #include <CEGUI/elements/CEGUIPushButton.h> @@ -35,7 +38,7 @@ #include "VesselManager.h" namespace CEGUI{ - //** dont know why, but these to functions are not defined in libCEUGUOgreRenderer.so ?????? +//** dont know why, but these two functions are not defined in libCEUGUOgreRenderer.so ?????? void OgreCEGUITexture::freeOgreTexture(void){ if ((!d_ogre_texture.isNull()) && !d_isLinked) { Ogre::TextureManager::getSingleton().remove(d_ogre_texture->getHandle()); Modified: branches/ogsector/src/ShipConfigDialog.h =================================================================== --- branches/ogsector/src/ShipConfigDialog.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/ShipConfigDialog.h 2007-06-28 16:05:43 UTC (rev 602) @@ -23,9 +23,8 @@ #include "BaseDialog.h" +#include <OgrePrerequisites.h> #include <OgreRenderTargetListener.h> -#include <OgreRenderTexture.h> -#include <OgreCEGUITexture.h> namespace OpenGate{ Modified: branches/ogsector/src/UnDockedState.cpp =================================================================== --- branches/ogsector/src/UnDockedState.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/UnDockedState.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -31,6 +31,11 @@ #include <OgreTextAreaOverlayElement.h> #include <OgreFontManager.h> +#include <OgreRoot.h> +#include <OgreRenderWindow.h> +#include <OgreViewport.h> +#include <OgreOverlayManager.h> +#include <OgreStringConverter.h> #include <CEGUI/elements/CEGUIPushButton.h> @@ -750,7 +755,7 @@ secondCamera_->rotate( rot ); // } - if ( target_ != NULL ) secondCamera_->setPosition( avatarPos + distNorm * ( dist.length() - 2.0 * target_->baseSize() ) ); + if ( target_ != NULL ) secondCamera_->setPosition( avatarPos + distNorm * ( dist.length() - 2.0 * target_->maxBaseSize() ) ); switch ( cameraMode_ ){ case 0: //** free camera at orign Modified: branches/ogsector/src/UnDockedState.h =================================================================== --- branches/ogsector/src/UnDockedState.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/UnDockedState.h 2007-06-28 16:05:43 UTC (rev 602) @@ -20,7 +20,7 @@ #ifndef UNDOCKEDSTATE__H #define UNDOCKEDSTATE__H -#include <Ogre.h> +#include <OgrePrerequisites.h> #include "GameState.h" #include "InputManager.h" Modified: branches/ogsector/src/Vessel.cpp =================================================================== --- branches/ogsector/src/Vessel.cpp 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Vessel.cpp 2007-06-28 16:05:43 UTC (rev 602) @@ -18,15 +18,18 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "common.h" #include "Vessel.h" +#include <OgreMeshManager.h> + namespace OpenGate{ Vessel::Vessel( ) : Entity() { - vesselSize_ = 10.0; + vesselSize_ = Ogre::Vector3::ZERO; vesselArmor_ = 1; - vesselYaw_ = 0; + baseYaw_ = 0; + basePitch_ = 0; + baseRoll_ = 0; yaw_ = 1.0; pitch_ = 1.0; Modified: branches/ogsector/src/Vessel.h =================================================================== --- branches/ogsector/src/Vessel.h 2007-06-27 03:26:07 UTC (rev 601) +++ branches/ogsector/src/Vessel.h 2007-06-28 16:05:43 UTC (rev 602) @@ -21,13 +21,10 @@ #ifndef _OPENGATE_VESSEL__H #define _OPENGATE_VESSEL__H -#include <OgreMesh.h> -#include <OgreMeshManager.h> #include "common.h" - #include "Entity.h" +#include <OgreMesh.h> - namespace OpenGate{ /*! @@ -57,12 +54,27 @@ /*! Desctructor */ ~Vessel(){} - inline void setBaseSize( float vesselSize ){ vesselSize_ = vesselSize; } - inline float baseSize( ) const { return vesselSize_; } + inline void setBaseSize( float length, float width, float height ){ + vesselSize_[ 0 ] = length; + vesselSize_[ 1 ] = width; + vesselSize_[ 2 ] = height; + } - inline void setBaseYaw( float vesselYaw ){ vesselYaw_ = vesselYaw; } - inline float baseYaw( ) const { return vesselYaw_; } + /*! If size is a scalar value, the length of the vessel is given. */ + inline void setBaseSize( float vesselSize ){ + vesselSize_[ 2 ] = vesselSize; + } + inline Ogre::Vector3 baseSize( ) const { return vesselSize_; } + inline void setBaseYaw... [truncated message content] |