Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
main_loop.h File Reference
#include "in.h"
#include "cmd/unit_generic.h"

Go to the source code of this file.

Namespaces

 CockpitKeys
 

Constant Groups

 CockpitKeys
 

Functions

void bootstrap_draw (const std::string &message, Animation *SplashScreen=NULL)
 
void CockpitKeys::SkipMusicTrack (const KBData &, KBSTATE newState)
 
void CockpitKeys::PitchDown (const KBData &, KBSTATE newState)
 
void CockpitKeys::PitchUp (const KBData &, KBSTATE newState)
 
void CockpitKeys::YawLeft (const KBData &, KBSTATE newState)
 
void CockpitKeys::YawRight (const KBData &, KBSTATE newState)
 
void CockpitKeys::LookDown (const KBData &kbdata, KBSTATE newState)
 
void CockpitKeys::LookUp (const KBData &kbdata, KBSTATE newState)
 
void CockpitKeys::LookLeft (const KBData &kbdata, KBSTATE newState)
 
void CockpitKeys::LookRight (const KBData &kbdata, KBSTATE newState)
 
void CockpitKeys::Inside (const KBData &, KBSTATE newState)
 
void CockpitKeys::ZoomOut (const KBData &, KBSTATE newState)
 
void CockpitKeys::ZoomIn (const KBData &, KBSTATE newState)
 
void CockpitKeys::ZoomReset (const KBData &, KBSTATE newState)
 
void CockpitKeys::InsideLeft (const KBData &, KBSTATE newState)
 
void CockpitKeys::InsideRight (const KBData &, KBSTATE newState)
 
void CockpitKeys::InsideBack (const KBData &, KBSTATE newState)
 
void CockpitKeys::SwitchLVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::SwitchRVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::SwitchMVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::SwitchULVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::SwitchURVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::SwitchUMVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::CommModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::ObjectiveModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::TargetModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::ManifestModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::DamageModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::GunModeVDU (const KBData &s, KBSTATE newState)
 
void CockpitKeys::MissileModeVDU (const KBData &s, KBSTATE newState)
 
void CockpitKeys::ScanningModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::ReverseGunModeVDU (const KBData &s, KBSTATE newState)
 
void CockpitKeys::ReverseMissileModeVDU (const KBData &s, KBSTATE newState)
 
void CockpitKeys::ViewModeVDU (const KBData &, KBSTATE newState)
 
void CockpitKeys::ScrollUp (const KBData &, KBSTATE newState)
 
void CockpitKeys::ScrollDown (const KBData &, KBSTATE newState)
 
void CockpitKeys::Behind (const KBData &, KBSTATE newState)
 
void CockpitKeys::Pan (const KBData &, KBSTATE newState)
 
void CockpitKeys::PanTarget (const KBData &, KBSTATE newState)
 
void CockpitKeys::ViewTarget (const KBData &, KBSTATE newState)
 
void CockpitKeys::OutsideTarget (const KBData &, KBSTATE newState)
 
void CockpitKeys::Quit (const KBData &, KBSTATE newState)
 
void CockpitKeys::TextMessageKey (const KBData &, KBSTATE newState)
 
void CockpitKeys::QuitNow ()
 
void AddUnitToSystem (const SavedUnits *su)
 
void createObjects (std::vector< std::string > &playersaveunit, std::vector< StarSystem * > &ssys, std::vector< QVector > &savedloc, vector< vector< string > > &savefiles)
 
void destroyObjects ()
 
void InitializeInput ()
 
void main_loop ()
 
void restore_main_loop ()
 

Function Documentation

void AddUnitToSystem ( const SavedUnits su)

Definition at line 954 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), Universe::activeStarSystem(), StarSystem::AddUnit(), UnitFactory::createEnhancement(), UnitFactory::createUnit(), ENHANCEMENTPTR, Unit::EnqueueAI(), SavedUnits::faction, SavedUnits::filename, FactionUtil::GetFactionIndex(), Cockpit::GetParent(), Unit::Position(), QVector, Unit::SetPosition(), Unit::SetTurretAI(), SavedUnits::type, and UNITPTR.

Referenced by bootstrap_main_loop().

955 {
956  Unit *un = NULL;
957  switch (su->type)
958  {
959  case ENHANCEMENTPTR:
960  un =
961  UnitFactory::createEnhancement( su->filename.get().c_str(), FactionUtil::GetFactionIndex( su->faction ), string( "" ) );
962  un->SetPosition( QVector( 0, 0, 0 ) );
963  break;
964  case UNITPTR:
965  default:
966  un = UnitFactory::createUnit( su->filename.get().c_str(), false, FactionUtil::GetFactionIndex( su->faction ) );
967  un->EnqueueAI( new Orders::AggressiveAI( "default.agg.xml" ) );
968  un->SetTurretAI();
969  if ( _Universe->AccessCockpit()->GetParent() )
971  +QVector( rand()*10000./RAND_MAX-5000, rand()*10000./RAND_MAX-5000, rand()*10000./RAND_MAX-5000 ) );
972  break;
973  }
975 }
void bootstrap_draw ( const std::string &  message,
Animation SplashScreen = NULL 
)

Definition at line 21 of file libserver.cpp.

21 {}
void createObjects ( std::vector< std::string > &  playersaveunit,
std::vector< StarSystem * > &  ssys,
std::vector< QVector > &  savedloc,
vector< vector< string > > &  savefiles 
)

Definition at line 22 of file libserver.cpp.

Referenced by bootstrap_main_loop(), and NetClient::startGame().

25  {}
void destroyObjects ( )

Definition at line 977 of file main_loop.cpp.

References Terrain::DeleteAll(), fighters, locSel, myterrain, and tmpcockpittexture.

978 {
979  if (myterrain)
980  delete myterrain;
982  delete tmpcockpittexture;
983  delete[] fighters;
984  delete locSel;
985 }
void InitializeInput ( )

Definition at line 715 of file main_loop.cpp.

References BindKey(), and CockpitKeys::Quit().

Referenced by bootstrap_main_loop().

716 {
717  BindKey( 27, 0, 0, Quit, KBData() ); //always have quit on esc
718 }
void main_loop ( )

Definition at line 999 of file main_loop.cpp.

References _Universe, Universe::activeStarSystem(), ContinuousTerrain::AdjustTerrain(), avg_loop, cur_check, g_game, getNewTime(), Singleton< SceneManager >::getSingleton(), gl_batches_this_frame, gl_vertices_this_frame, last_check, loop_count, Music::MuzakCycle(), nb_checks, Network, Universe::numPlayers(), game_data_t::sound_enabled, Universe::StartDraw(), and VSFileSystem::vs_dprintf().

Referenced by bootstrap_main_loop(), GFXLoop(), GameUniverse::Loop(), restore_main_loop(), and NavComputer::toggleVisibility().

1000 {
1001  //Evaluate number of loops per second each XX loops
1002  if (loop_count == 500) {
1004  cur_check = getNewTime();
1005  if (last_check != 1) {
1006  //Time to update test
1008  nb_checks = nb_checks+1;
1009  }
1010  loop_count = -1;
1011  }
1012  loop_count++;
1013 
1014  //Execute DJ script
1016 
1017  _Universe->StartDraw();
1018  if (myterrain)
1020  if (Network != NULL)
1021  for (size_t jj = 0; jj < _Universe->numPlayers(); jj++)
1022  Network[jj].checkMsg( NULL );
1023 
1024 #ifndef NO_GFX
1025  VSFileSystem::vs_dprintf(3, "Drawn %d vertices in %d batches\n",
1030 #endif
1031 
1032  //Commit audio scene status to renderer
1033  if (g_game.sound_enabled)
1035 }