From: <spo...@us...> - 2009-02-15 14:10:50
|
Revision: 1039 http://opengate.svn.sourceforge.net/opengate/?rev=1039&view=rev Author: spom_spom Date: 2009-02-15 14:10:46 +0000 (Sun, 15 Feb 2009) Log Message: ----------- add temporary DEV key G/Shift-G that de/increase the size of planet cloud Modified Paths: -------------- trunk/src/GameStateManager.cpp trunk/src/KeyMap.cpp trunk/src/Sector.h trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/SectorMissileObject.cpp trunk/src/UnDockedState.cpp trunk/src/UnDockedState.h Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/GameStateManager.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -420,7 +420,7 @@ shutdownRequest_ = false; changeGameState( state ); } - +//mRoot->startRendering(); while ( !shutdownRequest_ ){ if ( resources_.inputManager ) resources_.inputManager->capture(); @@ -440,7 +440,7 @@ } } } -#endif +#endif resources_.ogreRoot()->renderOneFrame( ); } } Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/KeyMap.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -93,6 +93,9 @@ unDockedActionMap_[ keycode( OIS::KC_F7 ) ] = &UnDockedState::keyActionSpawnAi_DEV; unDockedActionMap_[ keycode( OIS::KC_I, KEY_CONTROL ) ] = &UnDockedState::keyActionShowInfos_DEV; unDockedActionMap_[ keycode( OIS::KC_E, KEY_SHIFT ) ] = &UnDockedState::keyActionShowEcliptic_DEV; + + unDockedActionMap_[ keycode( OIS::KC_G, KEY_SHIFT ) ] = &UnDockedState::keyActionTmpUp_DEV; + unDockedActionMap_[ keycode( OIS::KC_G ) ] = &UnDockedState::keyActionTmpDown_DEV; } bool(UnDockedState::*KeyMap::unDockedKeyAction( const OIS::KeyEvent & e ))(bool) { Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/Sector.h 2009-02-15 14:10:46 UTC (rev 1039) @@ -57,6 +57,8 @@ const std::set< SectorMeshObject * > & sectorMeshObjects() const { return sectorMeshObjects_; } const std::set< SectorStationObject * > & sectorStationObjects() const { return sectorStations_; } + + const std::set< SectorEnvironmentObject * > & sectorEnvironment() const { return sectorEnvironment_; } /*! Return handle to the avatarObject */ inline SectorAvatarObject * avatarObject() { return avatar_; } Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/SectorEnvironmentObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -49,8 +49,6 @@ } - - SectorPlanetObject::SectorPlanetObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) : SectorEnvironmentObject( name, sector, parentNode ){ Modified: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/SectorEnvironmentObject.h 2009-02-15 14:10:46 UTC (rev 1039) @@ -51,6 +51,8 @@ /*! Update loop for the environment */ virtual bool update( Ogre::Real elapsedTime ); + inline Ogre::SceneNode * cloudNode() { return cloudNode_; } + protected: //** taken from ogre wiki: http://www.ogre3d.org/wiki/index.php/ManualSphereMeshes void createSphere_( const std::string & name, const float r, const int nRings, const int nSegments ); Modified: trunk/src/SectorMissileObject.cpp =================================================================== --- trunk/src/SectorMissileObject.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/SectorMissileObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -34,12 +34,46 @@ SectorMissileObject::SectorMissileObject( const std::string & name, Sector * sector, Missile * missile ) : SectorMovableObject( name, sector, missile ), thrustTrailNode_( NULL ) { reset(); + + thrustTrailNode_ = sector_->sceneManager()->getRootSceneNode()->createChildSceneNode(); + thrustTrail_ = sector_->sceneManager()->createRibbonTrail( name_ + "_RibbonTrail" ); + thrustTrail_->setMaterialName( "BeamGreen" ); + thrustTrail_->setNumberOfChains( 1 ); + thrustTrail_->setMaxChainElements( 200 ); + thrustTrail_->setTrailLength( 1000 ); + thrustTrail_->setColourChange( 0, Ogre::ColourValue( 0.0, 0.0, 0.0, 0.3 ) ); + thrustTrail_->setInitialWidth( 0, 1.0 ); + thrustTrail_->setWidthChange( 0, 0.3 ); + thrustTrail_->addNode( mainNode_ ); } SectorMissileObject::~SectorMissileObject( ){ + if ( thrustTrailNode_ ){ + thrustTrail_->removeNode( mainNode_ ); + sector_->sceneManager()->destroyRibbonTrail( thrustTrail_ ); + sector_->sceneManager()->getRootSceneNode()->removeAndDestroyChild( thrustTrailNode_->getName() ); + thrustTrailNode_ = NULL; + thrustTrail_ = NULL; + } } -Missile * SectorMissileObject::missile() { +void SectorMissileObject::activate_(){ + if ( thrustTrailNode_ ){ + thrustTrailNode_->attachObject( thrustTrail_ ); + thrustTrailNode_->setPosition( mainNode_->getPosition() ); + thrustTrailNode_->setVisible( true ); + } +} + +void SectorMissileObject::deactivate_(){ + if ( thrustTrailNode_ ) { + std::cout << "SectorMissileObject::deactivate_ " << name_ << std::endl; + thrustTrailNode_->setVisible( false ); + thrustTrailNode_->detachObject( thrustTrail_ ); +// thrustTrail_->clearAllChains( ); + } +} + Missile * SectorMissileObject::missile() { return dynamic_cast < Missile * > ( movable_ ); } @@ -123,41 +157,6 @@ return SectorMovableObject::update( elapsedTime ); } -void SectorMissileObject::activate_(){ - if ( !thrustTrailNode_ ){ - thrustTrailNode_ = sector_->sceneManager()->getRootSceneNode()->createChildSceneNode(); - thrustTrail_ = sector_->sceneManager()->createRibbonTrail( name_ + "_RibbonTrail" ); - thrustTrail_->setMaterialName( "BeamGreen" ); - thrustTrail_->setNumberOfChains( 1 ); - thrustTrail_->setMaxChainElements( 200 ); - thrustTrail_->setTrailLength( 1000 ); - thrustTrail_->setColourChange( 0, Ogre::ColourValue( 0.0, 0.0, 0.0, 0.3 ) ); - thrustTrail_->setInitialWidth( 0, 1.0 ); - thrustTrail_->setWidthChange( 0, 0.3 ); - thrustTrail_->addNode( mainNode_ ); - } - thrustTrailNode_->attachObject( thrustTrail_ ); - thrustTrailNode_->setPosition( mainNode_->getPosition() ); - thrustTrailNode_->setVisible( true ); -} - -void SectorMissileObject::deactivate_(){ - if ( thrustTrailNode_ ) { -/* std::cout << "SectorMissileObject::deactivate_ " << name_ << std::endl; - thrustTrail_->removeNode( mainNode_ ); - thrustTrailNode_->detachObject( thrustTrail_ ); - sector_->sceneManager()->getRootSceneNode()->removeAndDestroyChild( thrustTrailNode_->getName() ); - sector_->sceneManager()->destroyRibbonTrail( thrustTrail_ ); - thrustTrailNode_ = NULL; - thrustTrail_ = NULL;*/ - thrustTrailNode_->setVisible( false ); - thrustTrailNode_->detachObject( thrustTrail_ ); - thrustTrail_->clearAllChains( ); - //thrustTrail_->removeNode( mainNode_ ); - - } -} - void SectorMissileObject::launch(){ //maxLifetime_ = 1.0; Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/UnDockedState.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -37,6 +37,7 @@ #include "OpenALSoundManager.h" #include "RadarObject.h" #include "SectorAvatarObject.h" +#include "SectorEnvironmentObject.h" #include "SectorStationObject.h" #include "EntityManager.h" @@ -44,6 +45,8 @@ #include "OpcodeWrapper.h" #include <iostream> +#include <functional> +#include <boost/bind.hpp> #include <OgreEntity.h> #include <OgreFontManager.h> @@ -1100,6 +1103,49 @@ return true; } +bool UnDockedState::keyActionTmpUp_DEV( bool pressed ){ + if ( pressed ){ + std::set< SectorEnvironmentObject * > se( sector_->sectorEnvironment() ); + std::set< SectorEnvironmentObject * >::iterator it= se.begin(), itmax=se.end(); + for ( ; it != itmax; it ++ ){ + std::cout << " found " << (*it)->name() << std::endl; + } + //std::find( se.begin(), se.end(), ( std::mem_fun( &SectorEnvironmentObject::name ) == "Planet" ) ); +// boost::bind( std::equal_to< std::string >(), +// Login->Token.c_str(), +// boost::bind( &Player::mGetToken, _1 ) ) ); + + it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); + std::cout << "search planet" << std::endl; + if ( it != itmax ){ + std::cout << " scale cloud 1.005 " << std::endl; + dynamic_cast< SectorPlanetObject * >(*it)->cloudNode()->scale( 1.005, 1.005, 1.005 ) ; + } + //std::equal_to< std::string >( "a" ); +// find_if(v.begin(), v.end(), +// compose1(bind2nd(equal_to<int>(),42),mem_fun_ref(&Event::getType))); + } + return true; +} + +bool UnDockedState::keyActionTmpDown_DEV( bool pressed ){ + if ( pressed ){ + std::set< SectorEnvironmentObject * > se( sector_->sectorEnvironment() ); + std::set< SectorEnvironmentObject * >::iterator it= se.begin(), itmax=se.end(); + for ( ; it != itmax; it ++ ){ + std::cout << " found " << (*it)->name() << std::endl; + } + it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); + std::cout << "search planet" << std::endl; + if ( it != itmax ){ + std::cout << " scale cloud 1/1.005 " << std::endl; + dynamic_cast< SectorPlanetObject * >(*it)->cloudNode()->scale( 1./ 1.005, 1./1.005, 1./1.005 ) ; + } + + } + return true; +} + bool UnDockedState::maximiseConsole( ){ if ( overlayRootWindow_ ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"UnDocked/MainWindow/ConsoleFrame")-> Modified: trunk/src/UnDockedState.h =================================================================== --- trunk/src/UnDockedState.h 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/UnDockedState.h 2009-02-15 14:10:46 UTC (rev 1039) @@ -136,6 +136,8 @@ bool keyActionShowInfos_DEV( bool pressed = true ); bool keyActionShowEcliptic_DEV( bool pressed = true ); + bool keyActionTmpUp_DEV( bool pressed = true ); + bool keyActionTmpDown_DEV( bool pressed = true ); protected: UnDockedState( ); virtual ~UnDockedState( ){} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |