src/tron/gGame.cpp File Reference

#include "eEventNotification.h"
#include "gStuff.h"
#include "eSoundMixer.h"
#include "eGrid.h"
#include "eTeam.h"
#include "tSysTime.h"
#include "gGame.h"
#include "rTexture.h"
#include "gWall.h"
#include "rConsole.h"
#include "gCycle.h"
#include "eCoord.h"
#include "eTimer.h"
#include "gAIBase.h"
#include "rSysdep.h"
#include "rFont.h"
#include "uMenu.h"
#include "nConfig.h"
#include "rScreen.h"
#include "rViewport.h"
#include "uInput.h"
#include "ePlayer.h"
#include "gSpawn.h"
#include "uInputQueue.h"
#include "nNetObject.h"
#include "tToDo.h"
#include "gMenus.h"
#include "gCamera.h"
#include "gServerBrowser.h"
#include "gServerFavorites.h"
#include "gFriends.h"
#include "gLogo.h"
#include "gLanguageMenu.h"
#include "nServerInfo.h"
#include "gAICharacter.h"
#include "tDirectories.h"
#include "gTeam.h"
#include "gWinZone.h"
#include "eVoter.h"
#include "tRecorder.h"
#include "gStatistics.h"
#include "tXmlParser.h"
#include "gParser.h"
#include "nAuthentication.h"
#include "gRotation.h"
#include <math.h>
#include <stdlib.h>
#include <string>
#include <fstream>
#include <ctype.h>
#include <time.h>
#include "nSocket.h"
#include "gArena.h"
#include "rSDL.h"
#include <SDL_thread.h>
#include "rRender.h"
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>

Go to the source code of this file.

Classes

class  tSettingRotation
class  gSettingsReverter
class  gNetIdler
class  gMapLoadConsoleFilter

Defines

#define DEFAULT_MAP   "Anonymous/polygon/regular/square-1.0.1.aamap.xml"
#define MAXAI   (gAICharacter::s_Characters.Len())
#define AUTO_AI_MAXFRAC   6
#define AUTO_AI_WIN   3
#define AUTO_AI_LOSE   1
#define PREPARE_TIME   4
#define GS_CREATED   0
#define GS_TRANSFER_SETTINGS   7
#define GS_CREATE_GRID   10
#define GS_CREATE_OBJECTS   20
#define GS_TRANSFER_OBJECTS   30
#define GS_CAMERA   35
#define GS_SYNCING   40
#define GS_SYNCING2   41
#define GS_SYNCING3   42
#define GS_PLAY   50
#define GS_DELETE_OBJECTS   60
#define GS_DELETE_GRID   70
#define GS_STATE_MAX   80

Functions

 tCONFIG_ENUM (gGameType)
 tCONFIG_ENUM (gFinishType)
tString sg_GetCurrentTime (char const *szFormat)
void sg_PrintCurrentTime (char const *szFormat)
void sg_PrintCurrentDate ()
void sg_PrintCurrentTime ()
void sg_Timestamp ()
static void GameSettingsMP ()
static void GameSettingsSP ()
static void GameSettingsCurrent ()
void sg_DeclareWinner (eTeam *team, char const *message)
static tCONTROLLED_PTR (gGame) sg_currentGame
void exit_game_grid (eGrid *grid)
void exit_game_objects (eGrid *grid)
REAL exponent (int i)
void init_game_grid (eGrid *grid, gParser *aParser)
int sg_NumHumans ()
int sg_NumUsers ()
static void sg_copySettings ()
void update_settings ()
void init_game_objects (eGrid *grid)
void init_game_camera (eGrid *grid)
void s_Timestep (eGrid *grid, REAL time, bool cam)
void RenderAllViewports (eGrid *grid)
void Render (eGrid *grid, REAL time, bool swap=true)
static void own_game (nNetState enter_state)
static void singlePlayer_game ()
void sg_HostGame ()
static bool sg_NetworkError (const tOutput &title, const tOutput &message, REAL timeout)
void sg_Receive ()
bool ConnectToServerCore (nServerInfoBase *server)
void ConnectToServer (nServerInfoBase *server)
void ret_to_MainMenu ()
void net_options ()
void sg_HostGameMenu ()
void net_game ()
static void StartNewMatch ()
static void StartNewMatch_conf (std::istream &)
void st_PrintPathInfo (tOutput &buf)
static void PlayerLogIn ()
void sg_DisplayVersionInfo ()
void MainMenu (bool ingame)
static bool sg_AbeforeB (int stateA, int stateB)
static void ingame_menu_cleanup ()
static void ingame_menu ()
static void sg_ParseMap (gParser *aParser, tString mapfile)
static void sg_ParseMap (gParser *aParser)
static void client_gamestate_handler (nMessage &m)
static void sg_VoteMenuIdle ()
void sg_RespawnPlayer (eGrid *grid, gArena *arena, ePlayerNetID *p)
gArenasg_GetArena ()
static bool sg_EnemyExists (int team)
void rotate ()
static bool togglemousegrab_func (REAL x)
static bool pausegame_func (REAL x)
static bool reloadtextures_func (REAL x)
static bool ingamemenu_func (REAL x)
bool GameLoop (bool input=true)
void gameloop_idle ()
static void sg_EnterGameCleanup ()
void sg_EnterGameCore (nNetState enter_state)
void sg_EnterGame (nNetState enter_state)
bool GridIsReady (int c)
static bool notrans ()
void Activate (bool act)
static void sg_FullscreenIdle ()
void sg_ClientFullscreenMessage (tOutput const &title, tOutput const &message, REAL timeout)
 Displays a message locally that gets displayed on the whole screen, blocking view to the game.
static void sg_TodoClientFullscreenMessage ()
static void sg_ClientFullscreenMessage (nMessage &m)
void sg_FullscreenMessage (tOutput const &title, tOutput const &message, REAL timeout, int client)
 Displays a message on a specific client or all clients that gets displayed on the whole screen, blocking view to the game.
static void sg_FullscreenMessageConf (std::istream &s)
static void LoginCallback ()

Variables

gArena Arena
static REAL sg_extraRoundTime = 0.0f
static tSettingItem< REALsg_extraRoundTimeConf ("EXTRA_ROUND_TIME", sg_extraRoundTime)
static REAL sg_lastChatBreakTime = -1.0f
static tSettingItem< REALsg_lastChatBreakTimeConf ("LAST_CHAT_BREAK_TIME", sg_lastChatBreakTime)
static tString mapfile (DEFAULT_MAP)
static nSettingItemWatched
< tString
conf_mapfile ("MAP_FILE", mapfile, nConfItemVersionWatcher::Group_Breaking, 8)
static tSettingRotation sg_mapRotation ("MAP_ROTATION")
static tSettingRotation sg_configRotation ("CONFIG_ROTATION")
static int rotationtype = 0
static tSettingItem< int > conf_rotationtype ("ROTATION_TYPE", rotationtype)
static REAL ded_idle = 24
static tSettingItem< REALdedicaded_idle ("DEDICATED_IDLE", ded_idle)
static float sg_gameTimeInterval = -1
static tSettingItem< float > sggti ("LADDERLOG_GAME_TIME_INTERVAL", sg_gameTimeInterval)
gGameSettings singlePlayer (10, 30, 10, 100000, 1, 0, 30, true, true, 0,-3, gDUEL, gFINISH_IMMEDIATELY, 1, 100000, 1000000)
gGameSettings multiPlayer (10, 30, 10, 100, 0, 4, 100, false, false, 0,-3, gDUEL, gFINISH_IMMEDIATELY, 2, 60, 30)
gGameSettingssg_currentSettings = &singlePlayer
static tSettingItem< int > mp_sw ("SCORE_WIN", multiPlayer.scoreWin)
static tSettingItem< int > mp_lt ("LIMIT_TIME", multiPlayer.limitTime)
static tSettingItem< int > mp_lr ("LIMIT_ROUNDS", multiPlayer.limitRounds)
static tSettingItem< int > mp_ls ("LIMIT_SCORE", multiPlayer.limitScore)
static tConfItem< int > mp_na ("NUM_AIS", multiPlayer.numAIs)
static tConfItem< int > mp_mp ("MIN_PLAYERS", multiPlayer.minPlayers)
static tConfItem< int > mp_iq ("AI_IQ", multiPlayer.AI_IQ)
static tConfItem< bool > mp_an ("AUTO_AIS", multiPlayer.autoNum)
static tConfItem< bool > mp_aq ("AUTO_IQ", multiPlayer.autoIQ)
static tConfItem< int > mp_sf ("SPEED_FACTOR", multiPlayer.speedFactor)
static tConfItem< int > mp_zf ("SIZE_FACTOR", multiPlayer.sizeFactor)
static tConfItem< gGameTypemp_gt ("GAME_TYPE", multiPlayer.gameType)
static tConfItem< gFinishTypemp_ft ("FINISH_TYPE", multiPlayer.finishType)
static tConfItem< int > mp_wzmr ("WIN_ZONE_MIN_ROUND_TIME", multiPlayer.winZoneMinRoundTime)
static tConfItem< int > mp_wzld ("WIN_ZONE_MIN_LAST_DEATH", multiPlayer.winZoneMinLastDeath)
static tConfItem< int > mp_tmin ("TEAMS_MIN", multiPlayer.minTeams)
static tConfItem< int > mp_tmax ("TEAMS_MAX", multiPlayer.maxTeams)
static tConfItem< int > mp_mtp ("TEAM_MIN_PLAYERS", multiPlayer.minPlayersPerTeam)
static tConfItem< int > mp_tp ("TEAM_MAX_PLAYERS", multiPlayer.maxPlayersPerTeam)
static tConfItem< int > mp_tib ("TEAM_MAX_IMBALANCE", multiPlayer.maxTeamImbalance)
static tConfItem< bool > mp_tbai ("TEAM_BALANCE_WITH_AIS", multiPlayer.balanceTeamsWithAIs)
static tConfItem< bool > mp_tboq ("TEAM_BALANCE_ON_QUIT", multiPlayer.enforceTeamRulesOnQuit)
static tConfItem< REALmp_wsu ("WALLS_STAY_UP_DELAY", multiPlayer.wallsStayUpDelay)
static tConfItem< REALmp_wl ("WALLS_LENGTH", multiPlayer.wallsLength)
static tConfItem< REALmp_er ("EXPLOSION_RADIUS", multiPlayer.explosionRadius)
static tSettingItem< int > sp_sw ("SP_SCORE_WIN", singlePlayer.scoreWin)
static tSettingItem< int > sp_lt ("SP_LIMIT_TIME", singlePlayer.limitTime)
static tSettingItem< int > sp_lr ("SP_LIMIT_ROUNDS", singlePlayer.limitRounds)
static tSettingItem< int > sp_ls ("SP_LIMIT_SCORE", singlePlayer.limitScore)
static tConfItem< int > sp_na ("SP_NUM_AIS", singlePlayer.numAIs)
static tConfItem< int > sp_mp ("SP_MIN_PLAYERS", singlePlayer.minPlayers)
static tConfItem< int > sp_iq ("SP_AI_IQ", singlePlayer.AI_IQ)
static tConfItem< bool > sp_an ("SP_AUTO_AIS", singlePlayer.autoNum)
static tConfItem< bool > sp_aq ("SP_AUTO_IQ", singlePlayer.autoIQ)
static tConfItem< int > sp_sf ("SP_SPEED_FACTOR", singlePlayer.speedFactor)
static tConfItem< int > sp_zf ("SP_SIZE_FACTOR", singlePlayer.sizeFactor)
static tConfItem< gGameTypesp_gt ("SP_GAME_TYPE", singlePlayer.gameType)
static tConfItem< gFinishTypesp_ft ("SP_FINISH_TYPE", singlePlayer.finishType)
static tConfItem< int > sp_wzmr ("SP_WIN_ZONE_MIN_ROUND_TIME", singlePlayer.winZoneMinRoundTime)
static tConfItem< int > sp_wzld ("SP_WIN_ZONE_MIN_LAST_DEATH", singlePlayer.winZoneMinLastDeath)
static tConfItem< int > sp_tmin ("SP_TEAMS_MIN", singlePlayer.minTeams)
static tConfItem< int > sp_tmax ("SP_TEAMS_MAX", singlePlayer.maxTeams)
static tConfItem< int > sp_mtp ("SP_TEAM_MIN_PLAYERS", singlePlayer.minPlayersPerTeam)
static tConfItem< int > sp_tp ("SP_TEAM_MAX_PLAYERS", singlePlayer.maxPlayersPerTeam)
static tConfItem< int > sp_tib ("SP_TEAM_MAX_IMBALANCE", singlePlayer.maxTeamImbalance)
static tConfItem< bool > sp_tbai ("SP_TEAM_BALANCE_WITH_AIS", singlePlayer.balanceTeamsWithAIs)
static tConfItem< bool > sp_tboq ("SP_TEAM_BALANCE_ON_QUIT", singlePlayer.enforceTeamRulesOnQuit)
static tConfItem< REALsp_wsu ("SP_WALLS_STAY_UP_DELAY", singlePlayer.wallsStayUpDelay)
static tConfItem< REALsp_wl ("SP_WALLS_LENGTH", singlePlayer.wallsLength)
static tConfItem< REALsp_er ("SP_EXPLOSION_RADIUS", singlePlayer.explosionRadius)
static REAL sg_Timeout = 5.0f
static tConfItem< REALsg_ctimeout ("GAME_TIMEOUT", sg_Timeout)
bool sg_TalkToMaster = true
static tSettingItem< bool > sg_ttm ("TALK_TO_MASTER", sg_TalkToMaster)
static bool just_connected = true
static bool sg_singlePlayer = 0
static int winner = 0
static int absolute_winner = 0
static REAL lastTime_gameloop = 0
static REAL lastTimeTimestep = 0
static int wishWinner = 0
static char const * wishWinnerMessage = ""
REAL stc_fastestSpeedRound
bool sg_axesIndicator
static int sg_spawnPointGroupSize = 0
static tSettingItem< int > sg_spawnPointGroupSizeConf ("SPAWN_POINT_GROUP_SIZE", sg_spawnPointGroupSize)
bool think = 1
static tString sg_roundCenterMessage ("")
static tConfItemLine sn_roundCM_ci ("ROUND_CENTER_MESSAGE", sg_roundCenterMessage)
static tString sg_roundConsoleMessage ("")
static tConfItemLine sn_roundCcM1_ci ("ROUND_CONSOLE_MESSAGE", sg_roundConsoleMessage)
static bool sg_RequestedDisconnection = false
static tConfItem< int > mor ("MAX_OUT_RATE", sn_maxRateOut)
static tConfItem< int > mir ("MAX_IN_RATE", sn_maxRateIn)
static tConfItem< int > pc ("PING_CHARITY", pingCharity)
uMenusg_IngameMenu = NULL
uMenusg_HostMenu = NULL
static tConfItemFunc snm ("START_NEW_MATCH",&StartNewMatch_conf)
static nNOInitialisator< gGamegame_init (310,"game")
unsigned short client_gamestate [MAXCLIENTS+2]
static nDescriptor client_gs (311, client_gamestate_handler,"client_gamestate")
REAL planned_rate_control [MAXCLIENTS+2]
REAL sent_per_messid [100]
static REAL lastdeath = 0
static bool roundOver = false
static REAL sg_timestepMax = .2
static tSettingItem< REALsg_timestepMaxConf ("TIMESTEP_MAX", sg_timestepMax)
static int sg_timestepMaxCount = 10
static tSettingItem< int > sg_timestepMaxCountConf ("TIMESTEP_MAX_COUNT", sg_timestepMaxCount)
static REAL sg_winZoneRandomness = .8
static tSettingItem< REALsg_winZoneSpreadConf ("WIN_ZONE_RANDOMNESS", sg_winZoneRandomness)
static uActionGlobal togglemousegrab ("TOGGLE_MOUSEGRAB")
static uActionGlobal pausegame ("PAUSE_GAME")
static uActionGlobal reloadtextures ("RELOAD_TEXTURES")
static uActionGlobal ingamemenu ("INGAME_MENU")
static eTransferInhibitor inh & notrans
static nVersionFeature sg_fullscreenMessages (14)
static tString sg_fullscreenMessageTitle
static tString sg_fullscreenMessageMessage
static REAL sg_fullscreenMessageTimeout
static nDescriptor sg_clientFullscreenMessage (312, sg_ClientFullscreenMessage,"client_fsm")
static tConfItemFunc sg_fullscreenMessageConf ("FULLSCREEN_MESSAGE",&sg_FullscreenMessageConf)
tString sg_greeting ("")
static tConfItemLine a_mod ("MESSAGE_OF_DAY", sg_greeting)
tString sg_greetingTitle ("")
static tConfItemLine a_tod ("TITLE_OF_DAY", sg_greetingTitle)
REAL sg_greetingTimeout = 60
static tSettingItem< REALa_modt ("MESSAGE_OF_DAY_TIMEOUT", sg_greetingTimeout)
static nCallbackLoginLogout lc (LoginCallback)


Define Documentation

#define AUTO_AI_LOSE   1

Definition at line 300 of file gGame.cpp.

Referenced by gGameSettings::AutoAI().

#define AUTO_AI_MAXFRAC   6

Definition at line 298 of file gGame.cpp.

Referenced by gGameSettings::AutoAI(), and gGameSettings::gGameSettings().

#define AUTO_AI_WIN   3

Definition at line 299 of file gGame.cpp.

Referenced by gGameSettings::AutoAI().

#define DEFAULT_MAP   "Anonymous/polygon/regular/square-1.0.1.aamap.xml"

Definition at line 127 of file gGame.cpp.

Referenced by sg_ParseMap().

#define GS_CAMERA   35

Definition at line 2219 of file gGame.cpp.

Referenced by gGame::StateUpdate().

#define GS_CREATE_GRID   10

Definition at line 2216 of file gGame.cpp.

Referenced by gGame::GameLoop(), and gGame::StateUpdate().

#define GS_CREATE_OBJECTS   20

Definition at line 2217 of file gGame.cpp.

Referenced by gGame::StateUpdate().

#define GS_CREATED   0

Definition at line 2214 of file gGame.cpp.

Referenced by gGame::Init(), and gGame::StateUpdate().

#define GS_DELETE_GRID   70

Definition at line 2225 of file gGame.cpp.

Referenced by gGame::StateUpdate().

#define GS_DELETE_OBJECTS   60

Definition at line 2224 of file gGame.cpp.

Referenced by gGame::Analysis(), gGame::GameLoop(), gGame::GridIsReady(), and gGame::StateUpdate().

#define GS_PLAY   50

Definition at line 2223 of file gGame.cpp.

Referenced by gGame::Analysis(), gGame::GameLoop(), ingame_menu_cleanup(), and gGame::StateUpdate().

#define GS_STATE_MAX   80

Definition at line 2226 of file gGame.cpp.

Referenced by sg_AbeforeB().

#define GS_SYNCING   40

Definition at line 2220 of file gGame.cpp.

Referenced by gGame::StateUpdate().

#define GS_SYNCING2   41

Definition at line 2221 of file gGame.cpp.

#define GS_SYNCING3   42

Definition at line 2222 of file gGame.cpp.

#define GS_TRANSFER_OBJECTS   30

Definition at line 2218 of file gGame.cpp.

Referenced by gGame::GridIsReady(), and gGame::StateUpdate().

#define GS_TRANSFER_SETTINGS   7

Definition at line 2215 of file gGame.cpp.

Referenced by gGame::Init(), and gGame::StateUpdate().

#define MAXAI   (gAICharacter::s_Characters.Len())

Definition at line 296 of file gGame.cpp.

Referenced by gGameSettings::AutoAI(), and gGameSettings::Menu().

#define PREPARE_TIME   4

Definition at line 734 of file gGame.cpp.

Referenced by gGame::GameLoop(), and init_game_camera().


Function Documentation

void Activate ( bool  act  ) 

Definition at line 4142 of file gGame.cpp.

References ePlayerNetID::ChatFlags_Away, currentScreensetting, rScreenSettings::fullscreen, tRecorderBase::IsRunning(), nSTANDALONE, se_ChatState(), se_PauseGameTimer(), sn_GetNetState(), and sr_Activate().

Referenced by filter().

04144                        {
04145 #ifdef DEBUG
04146     return;
04147 #endif
04148 
04149 // another fullscreen fix ammendmend: avoid the short screen flicker
04150 // by ignoring deactivation events in fullscreen mode completely.
04151 #ifndef WIN32
04152 #ifndef MACOSX
04153     if ( currentScreensetting.fullscreen && !act )
04154     {
04155         return;
04156     }
04157 #endif
04158 #endif
04159 
04160     sr_Activate( act );
04161 
04162     if (!tRecorder::IsRunning() )
04163     {
04164         if (sn_GetNetState()==nSTANDALONE)
04165         {
04166             se_PauseGameTimer(!act);
04167         }
04168 
04169         se_ChatState( ePlayerNetID::ChatFlags_Away, !act);

Here is the call graph for this function:

Here is the caller graph for this function:

static void client_gamestate_handler ( nMessage m  )  [static]

Definition at line 2458 of file gGame.cpp.

References nMessage::Read(), nMessage::SenderID(), and gGame::state.

02459                                                  {
02460     unsigned short state;
02461     m.Read( state );
02462     client_gamestate[m.SenderID()] = state;
02463 #ifdef DEBUG
02464     //  con << "User " << m.SenderID() << " is in Mode " << state << '\n';
02465 #endif

Here is the call graph for this function:

void ConnectToServer ( nServerInfoBase server  ) 

Definition at line 1654 of file gGame.cpp.

References ConnectToServerCore(), and sn_GetRedirectTo().

Referenced by gServerFavorite::Connect(), gCommandLineJumpStartAnalyzer::Connect(), and gServerMenuItem::Enter().

01656 {
01657     bool okToRedirect = ConnectToServerCore( server );
01658 
01659     // REAL redirections = 0;
01660     // double lastTime = tSysTimeFloat();
01661 
01662     // check for redirection
01663     while( okToRedirect )
01664     {
01665         std::auto_ptr< nServerInfoBase > redirectTo( sn_GetRedirectTo() );
01666 
01667         // abort loop
01668         if ( !(&(*redirectTo)) )
01669         {
01670             break;
01671         }
01672 
01673         okToRedirect = ConnectToServerCore( redirectTo.get() );
01674 
01675         /*
01676         // redirection spam chain protection, allow one redirection every 30 seconds. Should
01677         // be short enough to allow hacky applications (server-to-server teleport), but
01678         // long enough to allow players to escape via the menu or at least shift-esc.
01679         static const REAL timeout = 30;
01680         static const REAL maxRedirections = 5;
01681 
01682         redirections = redirections + 1;
01683         if ( redirections > maxRedirections )
01684         {
01685             break;
01686         }
01687 
01688         // decay spam protection
01689         double newTime = tSysTimeFloat();
01690         REAL dt = newTime - lastTime;
01691         lastTime = newTime;
01692         redirections *= 1/(1 + dt * maxRedirections * timeout );
01693         */
01694     }

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConnectToServerCore ( nServerInfoBase server  ) 

Definition at line 1532 of file gGame.cpp.

References rConsole::autoDisplayAtNewline, nNetObject::ClearAll(), ePlayerNetID::ClearAll(), rSysDep::ClearGL(), con, nServerInfoBase::Connect(), rConsole::fullscreen, nServerInfoBase::GetName(), just_connected, tString::Len(), MAX_PLAYERS, nABORT, nCLIENT, nDENIED, nOK, nSTANDALONE, nTIMEOUT, NULL, uMenu::quickexit, REAL, renderer_identification, tOutput::SetTemplateParameter(), sg_EnterGame(), sg_NetworkError(), sg_Receive(), sn_bigBrotherString, sn_Delay(), sn_DenyReason, sn_GetLastError(), sn_GetNetState(), sn_SendPlanned(), sn_SetNetState(), sr_con, sr_textOut, st_DoToDo(), rSysDep::SwapGL(), nNetObject::SyncAll(), tAdvanceFrame(), tASSERT, to, tSysTimeFloat(), and rViewport::Update().

Referenced by ConnectToServer().

01532               : false if there was an error or abort
01533 bool ConnectToServerCore(nServerInfoBase *server)
01534 {
01535     tASSERT( server );
01536 
01537     ePlayerNetID::ClearAll();
01538 
01539     // revert to default settings, restore current vlaues on exit
01540     gSettingsReverter reverter;
01541 
01542     sn_bigBrotherString = renderer_identification;
01543 
01544     nNetObject::ClearAll();
01545 
01546     just_connected=true;
01547 
01548     rViewport::Update(MAX_PLAYERS);
01549     // ePlayerNetID::Update();
01550 
01551 #ifndef DEDICATED
01552     rSysDep::SwapGL();
01553     rSysDep::ClearGL();
01554     rSysDep::SwapGL();
01555     rSysDep::ClearGL();
01556 #endif
01557 
01558     sr_con.autoDisplayAtNewline=true;
01559     sr_con.fullscreen=true;
01560 
01561     bool to=sr_textOut;
01562     sr_textOut=true;
01563 
01564     tOutput o;
01565 
01566     nConnectError error = nOK;
01567 
01568     nNetObject::ClearAll();
01569 
01570     o.SetTemplateParameter(1, server->GetName());
01571     o << "$network_connecting_to_server";
01572     con << o;
01573     error = server->Connect();
01574 
01575     switch (error)
01576     {
01577     case nABORT:
01578         return false;
01579         break;
01580     case nOK:
01581         break;
01582     case nTIMEOUT:
01583         sg_NetworkError("$network_message_timeout_title", "$network_message_timeout_inter", 20);
01584         return false;
01585         break;
01586 
01587     case nDENIED:
01588         sg_NetworkError("$network_message_denied_title", sn_DenyReason.Len() > 2 ? "$network_message_denied_inter2" : "$network_message_denied_inter", 20);
01589         return false;
01590         break;
01591     }
01592 
01593     // ePlayerNetID::CompleteRebuild();
01594 
01595     if (sn_GetNetState()==nCLIENT){
01596         REAL endTime=tSysTimeFloat()+30;
01597         con << tOutput("$network_connecting_gamestate");
01598         while (!sg_currentGame && tSysTimeFloat()<endTime && (sn_GetNetState() != nSTANDALONE)){
01599             tAdvanceFrame();
01600             sg_Receive();
01601             nNetObject::SyncAll();
01602             tAdvanceFrame();
01603             sn_SendPlanned();
01604             st_DoToDo();
01605 
01606 #ifndef DEDICATED
01607             rSysDep::SwapGL();
01608             rSysDep::ClearGL();
01609 #endif
01610 
01611             sn_Delay();
01612         }
01613         if (sg_currentGame){
01614             sr_con.autoDisplayAtNewline=false;
01615             sr_con.fullscreen=false;
01616 
01617             con << tOutput("$network_syncing_gamestate");
01618             sg_EnterGame( nCLIENT );
01619         }
01620         else{
01621             //con << "Timeout. Try again!\n";
01622             sg_NetworkError("$network_message_lateto_title", "$network_message_lateto_inter", 20);
01623         }
01624     }
01625 
01626     bool ret = true;
01627 
01628     if (!sg_RequestedDisconnection && !uMenu::quickexit)
01629         switch (sn_GetLastError())
01630         {
01631         case nOK:
01632             ret = sg_NetworkError("$network_message_abortconn_title",
01633                                   "$network_message_abortconn_inter", 20);
01634             break;
01635         default:
01636             ret = sg_NetworkError("$network_message_lostconn_title",
01637                                   "$network_message_lostconn_inter", 20);
01638             break;
01639         }
01640 
01641     sr_con.autoDisplayAtNewline=false;
01642     sr_con.fullscreen=false;
01643 
01644     sn_SetNetState(nSTANDALONE);
01645 
01646     sg_currentGame = NULL;
01647     nNetObject::ClearAll();
01648     ePlayerNetID::ClearAll();
01649 
01650     sr_textOut=to;
01651 
01652     return ret;

Here is the call graph for this function:

Here is the caller graph for this function:

void exit_game_grid ( eGrid grid  ) 

Definition at line 780 of file gGame.cpp.

References eGrid::Clear().

Referenced by exit_game_objects(), and gGame::Verify().

00780                                 {
00781     grid->Clear();
00782 }

Here is the call graph for this function:

Here is the caller graph for this function:

void exit_game_objects ( eGrid grid  ) 

Definition at line 784 of file gGame.cpp.

References gNetPlayerWall::Clear(), eGameObject::DeleteAll(), exit_game_grid(), rConsole::fullscreen, GrowingArrayBase::Len(), nCLIENT, uPlayerPrototype::Num(), ePlayer::PlayerConfig(), se_PlayerNetIDs, sn_GetNetState(), sr_con, su_prefetchInput, and tDESTROY.

Referenced by cleanup(), gGame::StateUpdate(), and gGame::~gGame().

00784                                    {
00785     sr_con.fullscreen=true;
00786 
00787     su_prefetchInput=false;
00788 
00789     int i;
00790     for (i=ePlayer::Num()-1;i>=0;i--){
00791         if (ePlayer::PlayerConfig(i))
00792             tDESTROY(ePlayer::PlayerConfig(i)->cam);
00793     }
00794 
00795     eGameObject::DeleteAll(grid);
00796 
00797     if (sn_GetNetState()!=nCLIENT)
00798         for (int i=se_PlayerNetIDs.Len()-1;i>=0;i--)
00799             if (se_PlayerNetIDs(i))
00800                 se_PlayerNetIDs(i)->ClearObject();
00801 
00802     gNetPlayerWall::Clear();
00803 
00804     exit_game_grid(grid);
00805 }

Here is the call graph for this function:

Here is the caller graph for this function:

REAL exponent ( int  i  ) 

Definition at line 807 of file gGame.cpp.

References abs(), REAL, and sqrtf().

Referenced by sg_copySettings().

00808 {
00809     int abs = i;
00810     if ( abs < 0 )
00811         abs = -abs;
00812 
00813     REAL ret = 1;
00814     REAL fac = sqrtf(2);
00815 
00816     while (abs > 0)
00817     {
00818         if ( 1 == (abs & 1) )
00819             ret *= fac;
00820 
00821         fac *= fac;
00822         abs >>= 1;
00823     }
00824 
00825     if (i < 0)
00826         ret = 1/ret;
00827 
00828     return ret;
00829 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool GameLoop ( bool  input = true  ) 

Definition at line 3934 of file gGame.cpp.

References gGame::GameLoop(), nAverager::GetDataVariance(), nPingAverager::GetPing(), nPingAverager::GetSlowAverager(), gGame::goon, ePlayerNetID::lastSync, GrowingArrayBase::Len(), nSERVER, nNetObject::Owner(), ePlayerNetID::ping, nConnectionInfo::ping, uMenu::quickexit, REAL, nNetObject::RequestSync(), se_PlayerNetIDs, sn_Connections, sn_GetNetState(), gGame::StateUpdate(), and tSysTimeFloat().

03936                               {
03937     /*
03938       int oldflags = fcntl (fileno(stdin), F_GETFD, 0);
03939       if (oldflags<0)
03940       std::cout << errno << '\n';
03941        
03942       if (fcntl(fileno(stdin), F_SETFL, oldflags | O_NONBLOCK)<0)
03943       std::cout << errno << '\n';
03944       
03945     //if (std::cin && std::cin.good() && !std::cin.eof() && !std::cin.fail() && !std::cin.bad()){
03946     //if (std::cin.rdbuf()->overflow()!=EOF){
03947     //if (std::cin.rdbuf()->in_avail()>0){
03948 
03949     char c[10];
03950     int in=0;
03951     in=read (fileno(stdin),c,9);
03952     for (int i=0;i<in;i++)
03953     std::cout << c;
03954      */
03955 
03956     // see if pings have dramatically changed
03957     if (sn_GetNetState()==nSERVER){
03958         REAL t=tSysTimeFloat();
03959         for (int i=se_PlayerNetIDs.Len()-1;i>=0;i--){
03960             ePlayerNetID *p=se_PlayerNetIDs(i);
03961 
03962             // get average and variance (increased a bit) of this player's ping
03963             nPingAverager const & averager = sn_Connections[p->Owner()].ping;
03964             REAL realping = averager.GetPing();
03965             REAL pingvariance = averager.GetSlowAverager().GetDataVariance() + realping * realping * .01;
03966 
03967             // deviation of real ping and synced ping
03968             REAL deviation = realping - p->ping;
03969 
03970             // measured against the variance, this player's ping deviates this much
03971             // from the communicated value
03972             REAL relativedeviation = deviation * deviation / pingvariance;
03973 
03974             if (0 == p->Owner())
03975                 realping = 0;
03976 
03977             if ( ( t - p->lastSync - 5 ) * relativedeviation > 5 ){
03978                 // if yes, send a message about it
03979                 p->ping = realping;
03980                 p->RequestSync(false);
03981             }
03982         }
03983     }
03984 
03985     bool goon=false;
03986     if (sg_currentGame){
03987         tControlledPTR< nNetObject > keep( sg_currentGame );
03988         sg_currentGame->StateUpdate();
03989         goon=!uMenu::quickexit && bool(sg_currentGame) && sg_currentGame->GameLoop(input);
03990     }

Here is the call graph for this function:

void gameloop_idle (  ) 

Definition at line 3992 of file gGame.cpp.

Referenced by sg_FullscreenMessage().

03995 {
03996     se_UserShowScores( false );
03997     sg_Receive();
03998     nNetObject::SyncAll();
03999     sn_SendPlanned();

Here is the caller graph for this function:

static void GameSettingsCurrent (  )  [static]

Definition at line 723 of file gGame.cpp.

References gGameSettings::Menu().

Referenced by MainMenu().

00723                                  {
00724     sg_currentSettings->Menu();
00725 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void GameSettingsMP (  )  [static]

Definition at line 715 of file gGame.cpp.

References gGameSettings::Menu(), and multiPlayer.

Referenced by sg_HostGameMenu().

00715                             {
00716     multiPlayer.Menu();
00717 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void GameSettingsSP (  )  [static]

Definition at line 719 of file gGame.cpp.

References gGameSettings::Menu(), and singlePlayer.

Referenced by MainMenu().

00719                             {
00720     singlePlayer.Menu();
00721 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool GridIsReady ( int  c  ) 

Definition at line 4129 of file gGame.cpp.

Referenced by gNetPlayerWall::ClearToTransmit().

04131                        {

Here is the caller graph for this function:

static void ingame_menu (  )  [static]

Definition at line 2235 of file gGame.cpp.

Referenced by gGame::GameLoop().

02237 {
02238     //    globalingame=true;
02239     try
02240     {
02241         se_ChatState( ePlayerNetID::ChatFlags_Menu, true );
02242         if (sn_GetNetState()==nSTANDALONE)
02243             se_PauseGameTimer(true);
02244         MainMenu(true);
02245     }
02246     catch ( ... )
02247     {
02248         ingame_menu_cleanup();
02249         ret_to_MainMenu();
02250         sg_IngameMenu=NULL;
02251         sg_HostMenu=NULL;
02252         throw;
02253     }
02254     ingame_menu_cleanup();

Here is the caller graph for this function:

static void ingame_menu_cleanup (  )  [static]

Definition at line 2256 of file gGame.cpp.

References ePlayerNetID::ChatFlags_Menu, gGame::GetState(), GS_PLAY, MAX_PLAYERS, nSTANDALONE, se_ChatState(), se_PauseGameTimer(), sn_GetNetState(), ePlayerNetID::Update(), and rViewport::Update().

02258 {
02259     if (sn_GetNetState()==nSTANDALONE)
02260         se_PauseGameTimer(false);
02261     se_ChatState(ePlayerNetID::ChatFlags_Menu, false);
02262     if ((bool(sg_currentGame) && sg_currentGame->GetState()!=GS_PLAY))
02263         //      || se_PlayerNetIDs.Len()==0)
02264     {
02265         rViewport::Update(MAX_PLAYERS);
02266         ePlayerNetID::Update();
02267     }
02268     //    globalingame=false;

Here is the call graph for this function:

static bool ingamemenu_func ( REAL  x  )  [static]

Definition at line 3633 of file gGame.cpp.

03635                                    {
03636     if (x>0){
03637         st_ToDo(&ingame_menu);
03638     }
03639 

void init_game_camera ( eGrid grid  ) 

Definition at line 1195 of file gGame.cpp.

References CAMERA_SMART, gGameSettings::finishType, gFINISH_EXPRESS, lastTime_gameloop, lastTimeTimestep, nCLIENT, uPlayerPrototype::Num(), ePlayer::PlayerConfig(), ePlayer::PlayerIsInGame(), ePlayer::PlayerViewport(), PREPARE_TIME, se_PauseGameTimer(), se_ResetGameTimer(), sg_extraRoundTime, and sn_GetNetState().

Referenced by gGame::StateUpdate().

01195                                   {
01196 #ifndef DEDICATED
01197     for (int i=ePlayer::Num()-1;i>=0;i--)
01198         if (ePlayer::PlayerIsInGame(i)){
01199             ePlayerNetID *p=ePlayer::PlayerConfig(i)->netPlayer;
01200 
01201             if ( sg_currentSettings->finishType == gFINISH_EXPRESS && ( sn_GetNetState() != nCLIENT ) )
01202                 se_ResetGameTimer( -PREPARE_TIME/5 - sg_extraRoundTime );
01203             else
01204                 se_ResetGameTimer( -PREPARE_TIME - sg_extraRoundTime );
01205 
01206             // se_PauseGameTimer(true);
01207 
01208             ePlayer::PlayerConfig(i)->cam=new gCamera(grid,
01209                                           ePlayer::PlayerViewport(i),
01210                                           p,
01211                                           ePlayer::PlayerConfig(i),
01212                                           CAMERA_SMART);
01213 
01214             lastTime_gameloop=lastTimeTimestep=0;
01215         }
01216 #else
01217     se_ResetGameTimer( -PREPARE_TIME - sg_extraRoundTime );
01218     se_PauseGameTimer(false);
01219 #endif
01220     /*
01221       for(int p=se_PlayerNetIDs.Len()-1;p>=0;p--){
01222       int i=se_PlayerNetIDs(p)->pID;
01223 
01224       se_ResetGameTimer(-PREPARE_TIME);
01225       se_PauseGameTimer(true);
01226 
01227       if (i>=0)
01228          playerConfig[i]->cam=new eCamera(PlayerViewport(i),
01229       se_PlayerNetIDs(p),CAMERA_SMART);
01230       }
01231 
01232     */

Here is the call graph for this function:

Here is the caller graph for this function:

void init_game_grid ( eGrid grid,
gParser aParser 
)

Definition at line 836 of file gGame.cpp.

References absolute_winner, gArena::PrepareGrid(), se_PauseGameTimer(), se_ResetGameTimer(), sr_glOut, sr_ResetRenderState(), winner, and wishWinner.

Referenced by gGame::StateUpdate(), and gGame::Verify().

00836                                                   {
00837     se_ResetGameTimer();
00838     se_PauseGameTimer(true);
00839 
00840 #ifndef DEDICATED
00841     if (sr_glOut){
00842         sr_ResetRenderState();
00843 
00844         // rSysDep::ClearGL();
00845 
00846         // glViewport (0, 0, static_cast<GLsizei>(sr_screenWidth), static_cast<GLsizei>(sr_screenHeight));
00847 
00848         // rSysDep::SwapGL();
00849     }
00850     stc_fastestSpeedRound = .0;
00851 #endif
00852 
00853     /*
00854       if(!speedup)
00855       SDL_Delay(1000);
00856     */
00857 
00858     Arena.PrepareGrid(grid, aParser);
00859 
00860     absolute_winner=winner=wishWinner=0;
00861 }

Here is the call graph for this function:

Here is the caller graph for this function:

void init_game_objects ( eGrid grid  ) 

Definition at line 983 of file gGame.cpp.

References gGameSettings::AI_IQ, ePlayerNetID::ControlObject(), ePlayerNetID::CurrentTeam(), eCoord, ePlayerNetID::Greet(), ePlayerNetID::IsActive(), eTeam::IsHuman(), lastTime_gameloop, lastTimeTimestep, gArena::LeastDangerousSpawnPoint(), GrowingArrayBase::Len(), rITexture::LoadAll(), gGameSettings::minPlayers, nCLIENT, NULL, gGameSettings::numAIs, eTeam::NumPlayers(), eTeam::Player(), pos, ePlayerNetID::ResetScoreDifferences(), se_PlayerNetIDs, gAIPlayer::SetNumberOfAIs(), sn_GetNetState(), gSpawnPoint::Spawn(), st_Breakpoint(), su_prefetchInput, nNetObject::SyncAll(), eTeam::teams, and eTeam::Update().

Referenced by gGame::StateUpdate().

00983                                    {
00984     /*
00985       static REAL r[MAX_PLAYERS]={1,.2,.2,1};
00986       static REAL g[MAX_PLAYERS]={.2,1,.2,1};
00987       static REAL b[MAX_PLAYERS]={.2,.2,1,.2};
00988     */
00989 
00990     if (sn_GetNetState()!=nCLIENT)
00991     {
00992         // update team settings
00993         gAIPlayer::SetNumberOfAIs(sg_currentSettings->numAIs,
00994                                   sg_currentSettings->minPlayers,
00995                                   sg_currentSettings->AI_IQ);
00996 
00997         int spawnPointsUsed = 0;
00998         for (int t=eTeam::teams.Len()-1;t>=0;t--)
00999         {
01000             eTeam *team = eTeam::teams(t);
01001             team->Update();
01002 
01003             gSpawnPoint *spawn = Arena.LeastDangerousSpawnPoint();
01004             spawnPointsUsed++;
01005 
01006             // if the spawn points are grouped, make sure the last player is not in a goup of his
01007             // own by skipping one spawnpoint
01008             if ( ( eTeam::teams(0)->IsHuman() || eTeam::teams(0)->NumPlayers() == 1 ) && sg_spawnPointGroupSize > 2 && ( spawnPointsUsed % sg_spawnPointGroupSize == sg_spawnPointGroupSize - 1 ) )
01009             {
01010                 // the next spawn point is the last of this group. Skip it if
01011                 // either only two players are left (and the one would need to play alone)
01012                 // or we can fill the remaining groups well with one player short.
01013                 if ( t == 2 || ( ( t % ( sg_spawnPointGroupSize - 1 ) ) == 0 && t < ( sg_spawnPointGroupSize - 1 ) * ( sg_spawnPointGroupSize - 1 ) ) )
01014                 {
01015                     eCoord pos, dir;
01016                     spawn->Spawn( pos, dir );
01017                     spawn = Arena.LeastDangerousSpawnPoint();
01018                     spawnPointsUsed++;
01019                 }
01020             }
01021 
01022             int numPlayers = team->NumPlayers();
01023             for (int p = 0; p<numPlayers; ++p)
01024             {
01025                 ePlayerNetID *pni=team->Player( p );
01026 
01027                 if ( !team->IsHuman() )
01028                 {
01029                     spawn = Arena.LeastDangerousSpawnPoint();
01030                     spawnPointsUsed++;
01031                 }
01032 
01033                 //                      bool isHuman = pni->IsHuman();
01034 
01035                 // don't give inactive players a cycle
01036                 if (!pni->IsActive())
01037                     continue;
01038 
01039                 eCoord pos,dir;
01040                 gCycle *cycle=NULL;
01041                 if (sn_GetNetState()!=nCLIENT){
01042 #ifdef DEBUG
01043                     //                std::cout << "spawning player " << pni->name << '\n';
01044 #endif
01045                     spawn->Spawn(pos,dir);
01046                     pni->Greet();
01047                     cycle = new gCycle(grid, pos, dir, pni);
01048                     pni->ControlObject(cycle);
01049                     nNetObject::SyncAll();
01050                 }
01051                 //    int i=se_PlayerNetIDs(p)->pID;
01052 
01053                 // se_ResetGameTimer();
01054                 // se_PauseGameTimer(true);
01055             }
01056         }
01057 
01058 
01059 #ifdef ALLOW_NO_TEAM
01060         for (int p=se_PlayerNetIDs.Len()-1;p>=0;p--){
01061             ePlayerNetID *pni=se_PlayerNetIDs(p);
01062 
01063             gSpawnPoint *spawn=Arena.LeastDangerousSpawnPoint();
01064 
01065             if ( NULL == pni->CurrentTeam() )
01066             {
01067 #ifdef KRAWALL_SERVER
01068                 // don't allow unknown players to play
01069                 if (!pni->IsAuth())
01070                     continue;
01071 #endif
01072 
01073                 // don't give inactive players a cycle
01074                 if (!pni->IsActive())
01075                     continue;
01076 
01077                 eCoord pos,dir;
01078                 gCycle *cycle=NULL;
01079                 if (sn_GetNetState()!=nCLIENT){
01080 #ifdef DEBUG
01081                     //con << "spawning player " << se_PlayerNetIDs[p]->name << '\n';
01082 #endif
01083                     st_Breakpoint();
01084 
01085                     spawn->Spawn(pos,dir);
01086                     pni->Greet();
01087                     cycle = new gCycle(grid, pos, dir, pni, 0);
01088                     pni->ControlObject(cycle);
01089                     nNetObject::SyncAll();
01090                 }
01091                 //    int i=se_PlayerNetIDs(p)->pID;
01092 
01093                 // se_ResetGameTimer();
01094                 // se_PauseGameTimer(true);
01095             }
01096         }
01097 #endif
01098     }
01099 
01100     /*
01101     for(int p=se_PlayerNetIDs.Len()-1;p>=0;p--){
01102         ePlayerNetID *pni=se_PlayerNetIDs(p);
01103 
01104         bool isHuman = pni->IsHuman();
01105 
01106     #ifdef KRAWALL_SERVER
01107         // don't allow unknown players to play
01108         if (!pni->IsAuth())
01109                 continue;
01110     #endif
01111 
01112         // don't give inactive players a cycle
01113         if (!pni->IsActive())
01114                 continue;
01115        
01116         eCoord pos,dir;
01117         gCycle *cycle=NULL;
01118         if (sn_GetNetState()!=nCLIENT){
01119     #ifdef DEBUG
01120                 //con << "spawning player " << se_PlayerNetIDs[p]->name << '\n';
01121     #endif
01122                 spawn->Spawn(pos,dir);
01123                 pni->Greet();
01124                 cycle = new gCycle(grid, pos, dir, pni, 0);
01125                 pni->ControlObject(cycle);
01126                 nNetObject::SyncAll();
01127         }
01128         //    int i=se_PlayerNetIDs(p)->pID;
01129 
01130         se_ResetGameTimer();
01131         se_PauseGameTimer(true);
01132 
01133         if (sg_currentSettings->gameType==gHUMAN_VS_AI){
01134                 //      if (Cycle(p))
01135                 //      Cycle(p)->team=1;
01136                 if (cycle)
01137                 {
01138                         spawn=Arena.LeastDangerousSpawnPoint();
01139                         if (isHuman)
01140                                 cycle->team=2;
01141                         else
01142                         {
01143                                 cycle->team=1;
01144                         }
01145                 }
01146         }
01147         else{
01148     #ifdef DEBUG
01149                 //con << "new eSpawnPoint.\n";
01150     #endif
01151                 if (cycle)
01152                 {
01153                         spawn=Arena.LeastDangerousSpawnPoint();
01154                         if (isHuman)
01155                                 cycle->team=p + 2;
01156                         else
01157                                 cycle->team=1;
01158                 }
01159                 //      if (Cycle(p))
01160                 //      Cycle(p)->team=p+1;
01161         }
01162     }
01163     */
01164 
01165     //  spawn=Arena.LeastDangerousSpawnPoint();
01166 
01167     /*
01168     static REAL rgb[MAXAI][3]={
01169       {1,1,.2},
01170       {1,.2,1},
01171       {.2,1,1},
01172       {1,.6,.2},
01173       {.2,1,.6},
01174       {.6,.2,1},
01175       {1,.2,.6},
01176       {.6,1,.2},
01177       {1,1,1},
01178       {.2,.2,.2}
01179     };
01180     */
01181 
01182 
01183     rITexture::LoadAll();
01184     // se_ResetGameTimer();
01185     // se_PauseGameTimer(true);
01186 
01187     su_prefetchInput=true;
01188 
01189     lastTime_gameloop=lastTimeTimestep=0;
01190 
01191     // reset scores, all players that are spawned need to get ladder points
01192     ePlayerNetID::ResetScoreDifferences();
01193 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void LoginCallback (  )  [static]

Definition at line 4341 of file gGame.cpp.

04343                            {
04344     client_gamestate[nCallbackLoginLogout::User()]=0;
04345     if ( nCallbackLoginLogout::Login() && nCallbackLoginLogout::User() > 0 )
04346     {
04347         if ( sg_greeting.Len()>1 )
04348         {
04349             if ( sg_greetingTitle.Len() <= 1 )
04350                 sg_greetingTitle = "Server message";
04351 
04352             sg_FullscreenMessage( sg_greetingTitle, sg_greeting, sg_greetingTimeout, nCallbackLoginLogout::User() );
04353         }

void MainMenu ( bool  ingame  ) 

Definition at line 1959 of file gGame.cpp.

References uMenu::Enter(), GameSettingsCurrent(), GameSettingsSP(), MainMenu(), MAX_PLAYERS, mp, nCLIENT, net_game(), nSTANDALONE, NULL, PlayerLogIn(), ePlayerNetID::PoliceMenu(), ret_to_MainMenu(), se_SoundMenu(), gLogo::SetDisplayed(), rConsole::SetHeight(), tOutput::SetTemplateParameter(), sg_DisplayVersionInfo(), sg_LanguageMenu(), sg_moviepackUse, sg_PlayerMenu(), sg_screenMenu, singlePlayer_game(), sn_GetNetState(), sn_programVersion, sr_con, sr_textOut, StartNewMatch(), su_InputConfigGlobal(), nVersionFeature::Supported(), gTeam::TeamMenu(), tNEW, rViewport::Update(), eVoter::VotingMenu(), eVoter::VotingPossible(), and uMenu::wrap.

Referenced by main(), and MainMenu().

01960                           {
01961     //  update_settings();
01962 
01963     if (ingame)
01964         sr_con.SetHeight(2);
01965 
01966     //gLogo::SetDisplayed(true);
01967 
01968     tOutput gametitle;
01969     if (!ingame)
01970         gametitle << "$game_menu_text";
01971     else
01972         gametitle << "$game_menu_ingame_text";
01973 
01974     uMenu game_menu(gametitle);
01975 
01976     uMenuItemFunction *reset=NULL;
01977 
01978     if (ingame && sn_GetNetState()!=nCLIENT){
01979         reset=new uMenuItemFunction
01980               (&game_menu,"$game_menu_reset_text",
01981                "$game_menu_reset_help",
01982                &StartNewMatch);
01983     }
01984 
01985     uMenuItemFunction *settings1=NULL;
01986 
01987     if (!ingame)
01988         settings1=tNEW(uMenuItemFunction)
01989                   (&game_menu,
01990                    "$game_settings_menu_text",
01991                    "$game_settings_menu_help",
01992                    &GameSettingsSP);
01993     else
01994         settings1=tNEW(uMenuItemFunction)
01995                   (&game_menu,
01996                    "$game_settings_menu_text",
01997                    "$game_settings_menu_help",
01998                    &GameSettingsCurrent);
01999 
02000     uMenuItemFunction *connect=NULL,*start=NULL,*sound=NULL;
02001 
02002     if (!ingame){
02003         connect=new uMenuItemFunction
02004                 (&game_menu,
02005                  "$network_menu_text",
02006                  "$network_menu_help",
02007                  &net_game);
02008 
02009         start= new uMenuItemFunction(&game_menu,"$game_menu_start_text",
02010                                      "$game_menu_start_help",&singlePlayer_game);
02011     }
02012 
02013     tOutput title;
02014     title.SetTemplateParameter( 1, sn_programVersion );
02015     if (!ingame)
02016         title << "$main_menu_text";
02017     else
02018         title << "$ingame_menu_text";
02019 
02020     uMenu MainMenu(title,false);
02021 
02022     if (ingame)
02023         sg_IngameMenu = &MainMenu;
02024 
02025     char const * extitle,* exhelp;
02026     if (!ingame){
02027         extitle="$main_menu_exit_text";
02028         exhelp="$main_menu_exit_help";
02029     }
02030     else{
02031         extitle="$ingame_menu_exit_text";
02032         exhelp="$ingame_menu_exit_help";
02033     }
02034 
02035     uMenuItemExit exx(&MainMenu,extitle,
02036                       exhelp);
02037 
02038     uMenuItemFunction *return_to_main=NULL;
02039     if (ingame){
02040         if (sn_GetNetState()==nSTANDALONE)
02041             return_to_main=new uMenuItemFunction
02042                            (&MainMenu,"$game_menu_exit_text",
02043                             "$game_menu_exit_help",
02044                             &ret_to_MainMenu);
02045         else if (sn_GetNetState()==nCLIENT)
02046             return_to_main=new uMenuItemFunction
02047                            (&MainMenu,"$game_menu_disconnect_text",
02048                             "$game_menu_disconnect_help",
02049                             &ret_to_MainMenu);
02050         else
02051             return_to_main=new uMenuItemFunction
02052                            (&MainMenu,
02053                             "$game_menu_shutdown_text",
02054                             "game_menu_shutdown_help",
02055                             &ret_to_MainMenu);
02056     }
02057 
02058     uMenuItemFunction * auth = 0;
02059     static nVersionFeature authentication( 15 );
02060     if ( sn_GetNetState() == nCLIENT && ingame && authentication.Supported(0) )
02061     {
02062         auth =tNEW(uMenuItemFunction)(&MainMenu,
02063                                       "$player_authenticate_text",
02064                                       "$player_authenticate_help",
02065                                       &PlayerLogIn );
02066     }
02067 
02068     uMenuItemFunction abb(&MainMenu,
02069                           "$main_menu_about_text",
02070                           "$main_menu_about_help",
02071                           &sg_DisplayVersionInfo);
02072 
02073 
02074     uMenu Settings("$system_settings_menu_text");
02075 
02076     uMenuItemSubmenu subm_settings
02077     (&MainMenu,&Settings,
02078      "$system_settings_menu_help");
02079 
02080 
02081     uMenuItem* team = NULL;
02082     if ( ingame )
02083     {
02084         team = tNEW( uMenuItemFunction) ( &MainMenu,
02085                                           "$team_menu_title",
02086                                           "$team_menu_help",
02087                                           &gTeam::TeamMenu );
02088     }
02089 
02090     uMenuItemFunction *se_PlayerMenu=NULL;
02091 
02092     //   if (!ingame)
02093     se_PlayerMenu= new uMenuItemFunction
02094                    (&MainMenu,"$player_mainmenu_text",
02095                     "$player_mainmenu_help",
02096                     &sg_PlayerMenu);
02097 
02098     uMenuItemFunction *player_police=NULL;
02099     uMenuItemFunction *voting=NULL;
02100     if ( ingame && sn_GetNetState() != nSTANDALONE )
02101     {
02102         player_police = tNEW( uMenuItemFunction )( &MainMenu, "$player_police_text", "$player_police_help", ePlayerNetID::PoliceMenu );
02103 
02104         if ( eVoter::VotingPossible() )
02105             voting = tNEW( uMenuItemFunction )( &MainMenu, "$voting_menu_text", "$voting_menu_help", eVoter::VotingMenu );
02106     }
02107 
02108     uMenu misc("$misc_menu_text");
02109 
02110     //  misc.SetCenter(.25);
02111 
02112     uMenuItemFunction language
02113     (&misc,"$language_menu_title",
02114      "$language_menu_help",
02115      &sg_LanguageMenu);
02116 
02117     uMenuItemFunction global_key
02118     (&misc,"$misc_global_key_text",
02119      "$misc_global_key_help",
02120      &su_InputConfigGlobal);
02121 
02122     uMenuItemToggle wrap
02123     (&misc,"$misc_menuwrap_text",
02124      "$misc_menuwrap_help",
02125      uMenu::wrap);
02126 
02127     uMenuItemToggle to2
02128     (&misc,"$misc_textout_text",
02129      "$misc_textout_help",sr_textOut);
02130 
02131 
02132 
02133     uMenuItemToggle mp
02134     (&misc,"$misc_moviepack_text",
02135      "$misc_moviepack_help",sg_moviepackUse);
02136 
02137 
02138     uMenuItemSubmenu misc_sm
02139     (&Settings,&misc,
02140      "$misc_menu_help");
02141 
02142     sound = new uMenuItemFunction
02143             (&Settings,"$sound_menu_text",
02144              "$sound_menu_help",&se_SoundMenu);
02145 
02146     uMenuItemSubmenu subm
02147     (&Settings,&sg_screenMenu,
02148      "$display_settings_menu_help");
02149 
02150     uMenuItemSubmenu *gamemenuitem = NULL;
02151     if (sn_GetNetState() != nCLIENT)
02152     {
02153         char const * gamehelp;
02154         if (!ingame)
02155             gamehelp="$game_menu_main_help";
02156         else
02157             gamehelp="$game_menu_ingame_help";
02158 
02159         gamemenuitem = tNEW(uMenuItemSubmenu) (&MainMenu,
02160                                                &game_menu,
02161                                                gamehelp
02162                                               );
02163     }
02164 
02165     if (!ingame)
02166     {
02167         rViewport::Update(MAX_PLAYERS);
02168         // ePlayerNetID::Update();
02169     }
02170 
02171     MainMenu.Enter();
02172 
02173     if (settings1)
02174         delete settings1;
02175     if (team)
02176         delete team;
02177     if (gamemenuitem)
02178         delete gamemenuitem;
02179     if (sound)
02180         delete sound;
02181     if (connect)
02182         delete connect;
02183     if (start)
02184         delete start;
02185     if (return_to_main)
02186         delete return_to_main;
02187     if (se_PlayerMenu)
02188         delete se_PlayerMenu;
02189     if (reset)
02190         delete reset;
02191     if ( player_police )
02192         delete player_police;
02193     if ( voting )
02194         delete voting;
02195 
02196     if (ingame)
02197         sg_IngameMenu=NULL;
02198 
02199     if (ingame)
02200     {
02201         gLogo::SetDisplayed(false);
02202         sr_con.SetHeight(7);
02203     }
02204 
02205     if ( auth )
02206     {
02207         delete auth;
02208     }

Here is the call graph for this function:

Here is the caller graph for this function:

void net_game (  ) 

Definition at line 1857 of file gGame.cpp.

References gServerFavorites::AlternativesMenu(), gServerBrowser::BrowseLAN(), gServerBrowser::BrowseMaster(), gServerFavorites::CustomConnectMenu(), uMenu::Enter(), gServerFavorites::FavoritesMenu(), gFriends::FriendsMenu(), net_options(), and rSysDep::StopNetSyncThread().

Referenced by MainMenu().

01858                {
01859 #ifndef DEDICATED
01860     uMenu net_menu("$network_menu_text");
01861 
01862     uMenuItemFunction cust
01863     (&net_menu,"$network_custjoin_text",
01864      "$network_custjoin_help",&gServerFavorites::CustomConnectMenu);
01865 
01866     uMenuItemFunction mas
01867     (&net_menu,"$masters_menu",
01868      "$masters_menu_help",&gServerFavorites::AlternativesMenu);
01869 
01870     uMenuItemFunction fav
01871     (&net_menu,"$bookmarks_menu",
01872      "$bookmarks_menu_help",&gServerFavorites::FavoritesMenu);
01873 
01874     uMenuItemFunction bud
01875     (&net_menu,"$friends_menu",
01876      "$friends_menu_help",&gFriends::FriendsMenu);
01877 
01878     uMenuItemFunction opt
01879     (&net_menu,"$network_opts_text",
01880      "$network_opts_help",&net_options);
01881 
01882     /*
01883       uMenuItemFunction serv
01884       (&net_menu,"$network_host_text",
01885       "$network_host_help",&sg_HostGameMenu);
01886     */
01887 
01888     uMenuItemFunction inter
01889     (&net_menu,"$network_menu_internet_text",
01890      "$network_menu_internet_help",&gServerBrowser::BrowseMaster);
01891 
01892     uMenuItemFunction lan
01893     (&net_menu,"$network_menu_lan_text",
01894      "$network_menu_lan_help",&gServerBrowser::BrowseLAN);
01895 
01896     gNetIdler idler;
01897     // rSysDep::StartNetSyncThread( &idler );
01898     net_menu.Enter();
01899     rSysDep::StopNetSyncThread();
01900 #endif

Here is the call graph for this function:

Here is the caller graph for this function:

void net_options (  ) 

Definition at line 1728 of file gGame.cpp.

References ai, uMenu::Enter(), gServerBrowser::highPort, gServerBrowser::lowPort, pingCharity, sn_maxRateIn, sn_maxRateOut, sr_laggometer, and sr_predictObjects.

Referenced by net_game().

01729                   {
01730     uMenu net_menu("$network_opts_text");
01731 
01732     uMenuItemInt high_port
01733     (&net_menu,"$network_opts_maxport_text",
01734      "$network_opts_maxport_help",
01735      gServerBrowser::highPort,1024,65536);
01736 
01737     uMenuItemInt low_port
01738     (&net_menu,"$network_opts_minport_text",
01739      "$network_opts_minport_help",
01740      gServerBrowser::lowPort,1024,65536);
01741 
01742     /*
01743         uMenuItemFunction delpw(&net_menu,
01744                                                         "$network_opts_deletepw_text",
01745                                                         "$network_opts_deletepw_help",
01746                                                         &se_DeletePasswords);
01747       
01748         uMenuItemSelection<int> storepw(&net_menu,
01749                                                                         "$login_storepw_text",
01750                                                                         "$login_storepw_help",
01751                                                                         se_PasswordStorageMode);
01752         storepw.NewChoice("$login_storepw_dont_text",
01753                                           "$login_storepw_dont_help",
01754                                           -1);
01755         storepw.NewChoice("$login_storepw_mem_text",
01756                                           "$login_storepw_mem_help",
01757                                           0);
01758         storepw.NewChoice("$login_storepw_disk_text",
01759                                           "$login_storepw_disk_help",
01760                                           1);
01761     */
01762 
01763     /*
01764       uMenuItemToggle master
01765       (&net_menu,"$network_opts_master_text",
01766       "$network_opts_master_help",
01767       sg_TalkToMaster);
01768     */
01769 
01770 
01771     uMenuItemInt out_rate
01772     (&net_menu,"$network_opts_outrate_text",
01773      "$network_opts_outrate_help",
01774      sn_maxRateOut,1,20);
01775 
01776 
01777     uMenuItemInt in_rate
01778     (&net_menu,"$network_opts_inrate_text",
01779      "$network_opts_inrate_help",
01780      sn_maxRateIn,1,20);
01781 
01782 
01783     uMenuItemToggle po2
01784     (&net_menu,"$network_opts_predict_text",
01785      "$network_opts_predict_help",
01786      sr_predictObjects);
01787 
01788     uMenuItemToggle lm2
01789     (&net_menu,"$network_opts_lagometer_text",
01790      "$network_opts_lagometer_help",
01791      sr_laggometer);
01792 
01793     uMenuItemToggle ai
01794     (&net_menu,"$network_opts_axesindicator_text",
01795      "$network_opts_axesindicator_help",
01796      sg_axesIndicator);
01797 
01798 
01799     uMenuItemInt p_s
01800     (&net_menu,"$network_opts_pingchar_text",
01801      "$network_opts_pingchar_help",
01802      pingCharity,0,300,20);
01803 
01804     net_menu.Enter();
01805 
01806     if (gServerBrowser::lowPort > gServerBrowser::highPort)
01807         gServerBrowser::highPort = gServerBrowser::lowPort;

Here is the call graph for this function:

Here is the caller graph for this function:

static bool notrans (  )  [static]

Definition at line 4135 of file gGame.cpp.

References gGame::GridIsReady(), and eTransferInhibitor::User().

04137                      {

Here is the call graph for this function:

static void own_game ( nNetState  enter_state  )  [static]

Definition at line 1361 of file gGame.cpp.

References ePlayerNetID::LogScoreDifferences(), NULL, se_KillGameTimer(), se_MakeGameTimer(), se_SaveToLadderLog(), se_sendEventNotification(), sg_EnterGame(), and tNEW.

Referenced by sg_HostGame(), and singlePlayer_game().

01362                                              {
01363     tNEW(gGame);
01364     se_MakeGameTimer();
01365 #ifndef DEDICATED
01366     stc_fastestSpeedRound = .0;
01367 #endif
01368     sg_EnterGame( enter_state );
01369 
01370     // write scores one last time
01371     ePlayerNetID::LogScoreDifferences();
01372     se_SaveToLadderLog(tString("GAME_END\n"));
01373     se_sendEventNotification(tString("Game end"), tString("The Game has ended"));
01374 
01375     sg_currentGame=NULL;
01376     se_KillGameTimer();

Here is the call graph for this function:

Here is the caller graph for this function:

static bool pausegame_func ( REAL  x  )  [static]

Definition at line 3608 of file gGame.cpp.

03610                                   {
03611     static bool paused=false;
03612 
03613     if (x>0){
03614         paused=!paused;
03615         se_PauseGameTimer(paused);
03616     }
03617 

static void PlayerLogIn (  )  [static]

Definition at line 1939 of file gGame.cpp.

References con, uMenu::Exit(), and ePlayer::LogIn().

Referenced by MainMenu().

01941 {
01942     ePlayer::LogIn();
01943 
01944     if ( sg_IngameMenu )
01945     {
01946         sg_IngameMenu->Exit();
01947     }
01948 
01949     con << tOutput( "$player_authenticate_action" );

Here is the call graph for this function:

Here is the caller graph for this function:

static bool reloadtextures_func ( REAL  x  )  [static]

Definition at line 3622 of file gGame.cpp.

03624                                        {
03625     if (x>0){
03626         rITexture::UnloadAll();
03627     }
03628 

void Render ( eGrid grid,
REAL  time,
bool  swap = true 
)

Definition at line 1302 of file gGame.cpp.

References rSysDep::ClearGL(), gLogo::Display(), RenderAllViewports(), sn_defaultDelay, sr_glOut, sr_ResetRenderState(), rSysDep::SwapGL(), and tDelay().

Referenced by _wrap_EGameObject_render(), _wrap_UMenuItem_render__SWIG_0(), _wrap_UMenuItem_render__SWIG_1(), _wrap_UMenuItem_render__SWIG_2(), _wrap_UMenuItemAction_render__SWIG_0(), _wrap_UMenuItemAction_render__SWIG_1(), _wrap_UMenuItemAction_render__SWIG_2(), _wrap_UMenuItemExit_render__SWIG_0(), _wrap_UMenuItemExit_render__SWIG_1(), _wrap_UMenuItemExit_render__SWIG_2(), _wrap_UMenuItemInt_render__SWIG_0(), _wrap_UMenuItemInt_render__SWIG_1(), _wrap_UMenuItemInt_render__SWIG_2(), _wrap_UMenuItemString_render__SWIG_0(), _wrap_UMenuItemString_render__SWIG_1(), _wrap_UMenuItemString_render__SWIG_2(), _wrap_UMenuItemSubmenu_render__SWIG_0(), _wrap_UMenuItemSubmenu_render__SWIG_1(), _wrap_UMenuItemSubmenu_render__SWIG_2(), and gGame::GameLoop().

01303                                                    {
01304 #ifdef DEBUG
01305     //  eFace::UpdateVisAll(10);
01306 #endif
01307     //  se_debugExt=0;
01308 
01309 #ifndef DEDICATED
01310     if (sr_glOut){
01311         RenderAllViewports(grid);
01312 
01313         sr_ResetRenderState(true);
01314         gLogo::Display();
01315 
01316         if (swap){
01317             rSysDep::SwapGL();
01318             rSysDep::ClearGL();
01319         }
01320     }
01321     else
01322     {
01323         if ( swap )
01324             rSysDep::SwapGL();
01325 
01326         tDelay( sn_defaultDelay );
01327     }
01328 #endif

Here is the call graph for this function:

Here is the caller graph for this function:

void RenderAllViewports ( eGrid grid  ) 

Definition at line 1263 of file gGame.cpp.

References eGrid::Cameras(), con, rViewportConfiguration::CurrentViewportConfiguration(), GrowingArrayBase::Len(), ePlayer::PlayerConfig(), rViewportConfiguration::Port(), pp_out, eGameObject::PPDisplayAll(), ePlayer::Render(), rViewportConfiguration::Select(), sr_glOut, sr_ResetRenderState(), and sr_viewportBelongsToPlayer.

Referenced by Render().

01264                                     {
01265     rViewportConfiguration *conf=rViewportConfiguration::CurrentViewportConfiguration();
01266 
01267     if (sr_glOut){
01268         sr_ResetRenderState();
01269 
01270         // enable distance based fog
01271         /*
01272         glFogi( GL_FOG_MODE, GL_EXP );
01273         glFogf( GL_FOG_DENSITY, .01/gArena::SizeMultiplier() );
01274         GLfloat black[3]={0,0,0};
01275         glFogfv( GL_FOG_COLOR, black );
01276         glEnable( GL_FOG );
01277         */
01278 
01279         const tList<eCamera>& cameras = grid->Cameras();
01280 
01281         for (int i=cameras.Len()-1;i>=0;i--){
01282             int p=sr_viewportBelongsToPlayer[i];
01283             conf->Select(i);
01284             rViewport *act=conf->Port(i);
01285             if (act && ePlayer::PlayerConfig(p))
01286                 ePlayer::PlayerConfig(p)->Render();
01287             else con << "hey! viewport " << i << " does not exist!\n";
01288         }
01289 
01290         // glDisable( GL_FOG );
01291     }
01292 
01293 #ifdef POWERPAK_DEB
01294     if (pp_out){
01295         eGameObject::PPDisplayAll();
01296         PD_ShowDoubleBuffer();
01297     }
01298 #endif

Here is the call graph for this function:

Here is the caller graph for this function:

void ret_to_MainMenu (  ) 

Definition at line 1706 of file gGame.cpp.

References rConsole::autoDisplayAtNewline, uMenu::Exit(), rConsole::fullscreen, gGame::NoLongerGoOn(), nSTANDALONE, NULL, uMenu::SetIdle(), sn_SetNetState(), and sr_con.

Referenced by MainMenu().

01707                       {
01708     sg_RequestedDisconnection = true;
01709 
01710     if (sg_HostMenu)
01711         sg_HostMenu->Exit();
01712 
01713     if (sg_IngameMenu)
01714         sg_IngameMenu->Exit();
01715 
01716     sr_con.fullscreen=true;
01717     sr_con.autoDisplayAtNewline=true;
01718 
01719     if (sg_currentGame)
01720         sg_currentGame->NoLongerGoOn();
01721 
01722     sn_SetNetState(nSTANDALONE);
01723 
01724     uMenu::SetIdle(NULL);

Here is the call graph for this function:

Here is the caller graph for this function:

void rotate (  ) 

Definition at line 3547 of file gGame.cpp.

03550 {
03551     if ( sg_mapRotation.Size() > 0 )
03552     {
03553         conf_mapfile.Set( sg_mapRotation.Current() );
03554         sg_mapRotation.Rotate();
03555     }
03556 
03557     if ( sg_configRotation.Size() > 0 )
03558     {
03559         st_Include( sg_configRotation.Current() );
03560         sg_configRotation.Rotate();

void s_Timestep ( eGrid grid,
REAL  time,
bool  cam 
)

Definition at line 1244 of file gGame.cpp.

References lastTimeTimestep, REAL, gNetPlayerWall::s_CopyIntoGrid(), eCamera::s_Timestep(), eGameObject::s_Timestep(), and eGameObject::SetMaxLazyLag().

Referenced by gGame::StateUpdate(), and gGame::Timestep().

01245                                                 {
01246     gNetPlayerWall::s_CopyIntoGrid();
01247     REAL minstep = 0;
01248 #ifdef DEDICATED
01249     minstep = 1.0/sg_dedicatedFPS;
01250 
01251     // the low possible simulation frequency, together with lazy timesteps, produces
01252     // this much possible extra time difference between gameobjects
01253     eGameObject::SetMaxLazyLag( ( 1 + sg_dedicatedFPSIdleFactor )/( sg_dedicatedFPSIdleFactor * sg_dedicatedFPS ) );
01254 #endif
01255     eGameObject::s_Timestep(grid, time, minstep );
01256 
01257     if (cam)
01258         eCamera::s_Timestep(grid, time);
01259 
01260     lastTimeTimestep=time;

Here is the call graph for this function:

Here is the caller graph for this function:

static bool sg_AbeforeB ( int  stateA,
int  stateB 
) [static]

Definition at line 2228 of file gGame.cpp.

References GS_STATE_MAX.

Referenced by gGame::ReadSync(), gGame::StateUpdate(), and gGame::SyncState().

02230 {
02231     return ( ( GS_STATE_MAX + stateA - stateB ) % GS_STATE_MAX > GS_STATE_MAX >> 2 );

Here is the caller graph for this function:

static void sg_ClientFullscreenMessage ( nMessage m  )  [static]

Definition at line 4215 of file gGame.cpp.

void sg_ClientFullscreenMessage ( tOutput const &  title,
tOutput const &  message,
REAL  timeout 
)

Displays a message locally that gets displayed on the whole screen, blocking view to the game.

Definition at line 4186 of file gGame.cpp.

Referenced by sg_FullscreenMessage(), and sg_TodoClientFullscreenMessage().

04188                                                                                                {
04189     // keep syncing the network
04190     rPerFrameTask idle( sg_FullscreenIdle );
04191 
04192     // put players into idle mode
04193     ePlayerNetID::SpectateAll();
04194     se_ChatState( ePlayerNetID::ChatFlags_Menu, true );
04195 
04196     // show message
04197     uMenu::Message( title, message, timeout );
04198 
04199     // and print it to the console
04200 #ifndef DEDICATED
04201     con <<  title << "\n" << message << "\n";
04202 #endif
04203 
04204     // get players out of idle mode again
04205     ePlayerNetID::SpectateAll(false);

Here is the caller graph for this function:

static void sg_copySettings (  )  [static]

Definition at line 886 of file gGame.cpp.

References gGameSettings::balanceTeamsWithAIs, eTeam::balanceWithAIs, eTeam::enforceRulesOnQuit, gGameSettings::enforceTeamRulesOnQuit, gGameSettings::explosionRadius, exponent(), eTeam::maxImbalance, eTeam::maxPlayers, gGameSettings::maxPlayersPerTeam, gGameSettings::maxTeamImbalance, gGameSettings::maxTeams, eTeam::maxTeams, eTeam::minPlayers, gGameSettings::minPlayersPerTeam, gGameSettings::minTeams, eTeam::minTeams, gCycle::SetExplosionRadius(), gArena::SetSizeMultiplier(), gCycleMovement::SetSpeedMultiplier(), gCycle::SetWallsLength(), gCycle::SetWallsStayUpDelay(), gGameSettings::sizeFactor, gGameSettings::speedFactor, gGameSettings::wallsLength, and gGameSettings::wallsStayUpDelay.

Referenced by update_settings().

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_DeclareWinner ( eTeam team,
char const *  message 
)

Definition at line 746 of file gGame.cpp.

References eTeam::TeamID(), winner, wishWinner, and wishWinnerMessage.

Referenced by zEffectorWin::effect(), gBaseZoneHack::OnConquest(), gWinZoneHack::OnEnter(), and gBaseZoneHack::Timestep().

00747 {
00748     if ( team && !winner )
00749     {
00750         wishWinner = team->TeamID() + 1;
00751         wishWinnerMessage = message;
00752     }
00753 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_DisplayVersionInfo (  ) 

Definition at line 1951 of file gGame.cpp.

References sg_FullscreenMessage(), and st_PrintPathInfo().

Referenced by MainMenu().

01952                              {
01953     tOutput versionInfo;
01954     versionInfo << "$version_info_version" << "\n";
01955     st_PrintPathInfo(versionInfo);
01956     versionInfo << "$version_info_misc_stuff";
01957     sg_FullscreenMessage("$version_info_title", versionInfo, 1000);

Here is the call graph for this function:

Here is the caller graph for this function:

static bool sg_EnemyExists ( int  team  )  [static]

Definition at line 2979 of file gGame.cpp.

References eTeam::Enemies(), and eTeam::teams.

Referenced by gGame::Analysis().

02981 {
02982     // check if the win was legitimate: at least one enemy team needs to bo online
02983     for ( int i = eTeam::teams.Len()-1; i>= 0; --i )
02984     {
02985         if ( i != team && eTeam::Enemies( eTeam::teams[i], eTeam::teams[team] ) )
02986             return true;
02987     }
02988 
02989     return false;

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_EnterGame ( nNetState  enter_state  ) 

Definition at line 4094 of file gGame.cpp.

Referenced by ConnectToServerCore(), and own_game().

04097 {
04098     try
04099     {
04100         // enter the game
04101         sg_EnterGameCore( enter_state );
04102     }
04103     catch (tException const & e)
04104     {
04105         // cleanup
04106         sg_EnterGameCleanup();
04107 
04108         // inform user of generic errors
04109         tConsole::Message( e.GetName(), e.GetDescription(), 120000 );
04110     }
04111     // again: VC6 does not catch tGenericException with above statement
04112 #ifdef _MSC_VER
04113 #pragma warning ( disable : 4286 )
04114     catch (tGenericException const & e)
04115     {
04116         // cleanup
04117         sg_EnterGameCleanup();
04118 
04119         // inform user of generic errors
04120         tConsole::Message( e.GetName(), e.GetDescription(), 120000 );
04121     }
04122 #endif
04123 
04124     // bounce teams
04125     for ( int i = eTeam::teams.Len()-1; i>=0; --i )
04126     {
04127         tJUST_CONTROLLED_PTR< eTeam > t = eTeam::teams(i);

Here is the caller graph for this function:

void sg_EnterGameCleanup (  )  [static]

Definition at line 4067 of file gGame.cpp.

04070 {
04071     //gStatistics - save high scores
04072 
04073     eSoundMixer* mixer = eSoundMixer::GetMixer();
04074     mixer->SetMode(GUI_TRACK);
04075 
04076     sn_SetNetState( nSTANDALONE );
04077 
04078     // delete all AI players
04079     gAIPlayer::ClearAll();
04080     // gAIPlayer::SetNumberOfAIs(0, 0, 0, -1);
04081     // gAITeam::BalanceWithAIs( false );
04082     // gAIPlayer::ClearAll();
04083 
04084     gLogo::SetDisplayed(true);
04085     uMenu::SetIdle(NULL);
04086     sr_con.autoDisplayAtSwap=false;
04087     sr_con.fullscreen=false;
04088 
04089     //  exit_game_objects(grid);
04090     nNetObject::ClearAll();
04091     ePlayerNetID::ClearAll();
04092     sg_currentGame = NULL;

void sg_EnterGameCore ( nNetState  enter_state  ) 

Definition at line 4003 of file gGame.cpp.

04005                                               {
04006     gLogo::SetBig(false);
04007 
04008     sg_RequestedDisconnection = false;
04009 
04010     sr_con.SetHeight(7);
04011 
04012     //  exit_game_objects(grid);
04013     eSoundMixer* mixer = eSoundMixer::GetMixer();
04014     mixer->SetMode(GRID_TRACK);
04015 
04016     // enter single player settings
04017     if ( sn_GetNetState() != nCLIENT )
04018     {
04019         sg_currentSettings = &singlePlayer;
04020         sg_copySettings();
04021 
04022         // initiate rotation
04023         rotate();
04024         gRotation::HandleNewRound();
04025         gRotation::HandleNewMatch();
04026     }
04027 
04028     //gStatistics - original load call
04029 
04030     uMenu::SetIdle(gameloop_idle);
04031     sr_con.autoDisplayAtSwap=true;
04032     bool goon=true;
04033     while (bool(sg_currentGame) && goon && sn_GetNetState()==enter_state){
04034 #ifdef DEDICATED // read input
04035         sr_Read_stdin();
04036 
04037         if ( sn_BasicNetworkSystem.Select( 1.0 / ( sg_dedicatedFPSIdleFactor * sg_dedicatedFPS )  ) )
04038         {
04039             // new network data arrived, do the most urgent work now
04040             tAdvanceFrame();
04041             sg_Receive();
04042             se_SyncGameTimer();
04043             REAL time=se_GameTime();
04044             sg_currentGame->StateUpdate();
04045             if ( time > 0 )
04046             {
04047                 // only simulate the objects that have pending events to execute
04048                 eGameObject::s_Timestep(sg_currentGame->Grid(), time, 1E+10 );
04049 
04050                 // send out updates immediately
04051                 nNetObject::SyncAll();
04052                 tAdvanceFrame();
04053                 sn_SendPlanned();
04054             }
04055         }
04056 #endif
04057 
04058         // do the regular simulation
04059         tAdvanceFrame();
04060 
04061         goon=GameLoop();
04062 
04063         st_DoToDo();
04064     }
04065 

static void sg_FullscreenIdle (  )  [static]

Definition at line 4177 of file gGame.cpp.

Referenced by sg_FullscreenMessage().

04180 {
04181     tAdvanceFrame();
04182     se_SyncGameTimer();
04183     gGame::NetSync();
04184     if ( sg_currentGame )

Here is the caller graph for this function:

void sg_FullscreenMessage ( tOutput const &  title,
tOutput const &  message,
REAL  timeout,
int  client 
)

Displays a message on a specific client or all clients that gets displayed on the whole screen, blocking view to the game.

Definition at line 4230 of file gGame.cpp.

References c, gameloop_idle(), ePlayerNetID::IsChatting(), GrowingArrayBase::Len(), MAXCLIENTS, gGame::NetSyncIdle(), REAL, se_GameTime(), se_mainGameTimer, se_PauseGameTimer(), se_PlayerNetIDs, sg_ClientFullscreenMessage(), sg_clientFullscreenMessage, sg_FullscreenIdle(), sg_fullscreenMessages, sg_lastChatBreakTime, sn_Connections, sn_ConsoleOut(), eTimer::speed, nVersionFeature::Supported(), and tSysTimeFloat().

Referenced by sg_DisplayVersionInfo().

04232                                                                                                    {
04233     tJUST_CONTROLLED_PTR< nMessage > m=new nMessage(sg_clientFullscreenMessage);
04234     *m << title;
04235     *m << message;
04236     *m << timeout;
04237 
04238     tString complete( title );
04239     complete << "\n" << message << "\n";
04240 
04241     if (client <= 0){
04242         if ( sg_fullscreenMessages.Supported() )
04243             m->BroadCast();
04244         else
04245         {
04246             for (int c = MAXCLIENTS; c > 0; --c)
04247             {
04248                 if ( sn_Connections[c].socket )
04249                 {
04250                     if ( sg_fullscreenMessages.Supported(c) )
04251                         m->Send(c);
04252                     else
04253                         sn_ConsoleOut(complete, c);
04254                 }
04255             }
04256         }
04257 
04258         // display the message locally, waiting for the clients to have seen it
04259         {
04260             // stop the game
04261             bool paused = se_mainGameTimer && se_mainGameTimer->speed < .0001;
04262             se_PauseGameTimer(true);
04263             gGame::NetSyncIdle();
04264 
04265             REAL waitTo = tSysTimeFloat() + timeout;
04266             REAL waitToMin = tSysTimeFloat() + 1.0;
04267             sg_ClientFullscreenMessage( title, message, timeout );
04268 
04269             // wait for players to see it
04270             bool goon = true;
04271             while ( goon && waitTo > tSysTimeFloat() )
04272             {
04273                 sg_FullscreenIdle();
04274                 gameloop_idle();
04275                 if ( se_GameTime() > sg_lastChatBreakTime )
04276                     se_PauseGameTimer(true);
04277 
04278                 // give the clients a second to enter chat state
04279                 if ( tSysTimeFloat() > waitToMin )
04280                 {
04281                     goon = false;
04282                     for ( int i = se_PlayerNetIDs.Len()-1; i>=0; --i )
04283                     {
04284                         ePlayerNetID* player = se_PlayerNetIDs(i);
04285                         if ( player->IsChatting() )
04286                             goon = true;
04287                     }
04288                 }
04289             }
04290 
04291             // continue the game
04292             se_PauseGameTimer(paused);
04293             gGame::NetSyncIdle();
04294         }
04295     }
04296     else
04297     {
04298         if ( sg_fullscreenMessages.Supported(client) )
04299             m->Send(client);
04300         else
04301             sn_ConsoleOut(complete, client);

Here is the call graph for this function:

Here is the caller graph for this function:

static void sg_FullscreenMessageConf ( std::istream &  s  )  [static]

Definition at line 4303 of file gGame.cpp.

04306 {
04307     // read the timeout
04308     REAL timeout;
04309     s >> timeout;
04310 
04311     if ( !s.good() || s.eof() )
04312     {
04313         con << "Usage: FULLSCREEN_MESSAGE <timeout> <message>\n";
04314         return;
04315     }
04316 
04317     // read the message
04318     tString message;
04319     message.ReadLine( s, true );
04320 
04321     message += "\n";
04322 
04323     // display it

gArena* sg_GetArena (  ) 

Definition at line 2936 of file gGame.cpp.

02937                        {
02938     return &Arena;

tString sg_GetCurrentTime ( char const *  szFormat  ) 

Definition at line 245 of file gGame.cpp.

References NULL.

Referenced by gGame::Analysis(), and sg_PrintCurrentTime().

00246 {
00247     char szTemp[128];
00248     time_t     now;
00249     struct tm *pTime;
00250     now = time(NULL);
00251     pTime = localtime(&now);
00252     strftime(szTemp,sizeof(szTemp),szFormat,pTime);
00253     return tString(szTemp);
00254 }

Here is the caller graph for this function:

void sg_HostGame (  ) 

Definition at line 1387 of file gGame.cpp.

References nBasicNetworkSystem::AccessListener(), ePlayerNetID::CompleteRebuild(), con, gServerBrowser::CurrentMaster(), ded_idle, gStats, nSocketListener::Listen(), gGame::NetSyncIdle(), nSERVER, nSTANDALONE, own_game(), uMenu::quickexit, nBasicNetworkSystem::Select(), sg_NumUsers(), sg_TalkToMaster, sg_Timestamp(), sn_BasicNetworkSystem, sn_SetNetState(), sr_Read_stdin(), st_DoToDo(), tAdvanceFrame(), nServerInfo::TellMasterAboutMe(), tNEW, tSysTimeFloat(), and update_settings().

Referenced by main(), and sg_HostGameMenu().

01388                   {
01389     //we'll want to collect stats
01390     gStats = new gStatistics();
01391 
01392     {
01393         // create a game to check map once
01394         tJUST_CONTROLLED_PTR< gGame > game = tNEW(gGame);
01395         game->Verify();
01396     }
01397 
01398     if (sg_TalkToMaster)
01399     {
01400         nServerInfo::TellMasterAboutMe( gServerBrowser::CurrentMaster() );
01401     }
01402 
01403     sn_SetNetState(nSERVER);
01404 
01405     update_settings();
01406     ePlayerNetID::CompleteRebuild();
01407 
01408     tAdvanceFrame();
01409 
01410     //#ifndef DEBUG
01411 #ifdef DEDICATED
01412     static double startTime=tSysTimeFloat();
01413 
01414     if ( sg_NumUsers() == 0)
01415     {
01416         cp();
01417         con << tOutput("$online_activity_napping") << "\n";
01418         sg_Timestamp();
01419 
01420         int counter = -1;
01421 
01422         int numPlayers = 0;
01423 
01424         while (numPlayers == 0 &&
01425                 (ded_idle<.0001 || tSysTimeFloat()<startTime + ded_idle * 3600 ) && !uMenu::quickexit ){
01426             sr_Read_stdin();
01427             st_DoToDo();
01428             gGame::NetSyncIdle();
01429 
01430             sn_BasicNetworkSystem.Select( 1.0f );
01431 
01432             // std::cout the players who are logged in:
01433             numPlayers = sg_NumUsers();
01434             /*
01435                                 for (int i = se_PlayerNetIDs.Len()-1; i>=0; i--)
01436                                         if (se_PlayerNetIDs(i)->IsAuth())
01437                                                 numPlayers++;
01438             */
01439 
01440             if (counter <= 0)
01441             {
01442                 // restart network, just in case we lost the input socket
01443                 sn_BasicNetworkSystem.AccessListener().Listen(false);
01444                 sn_BasicNetworkSystem.AccessListener().Listen(true);
01445                 counter = 50;
01446             }
01447         }
01448 
01449         if (sg_NumUsers() <= 0 && ded_idle>0.0001 &&
01450                 tSysTimeFloat()>= startTime + ded_idle * 3600 )
01451         {
01452             sg_Timestamp();
01453             con << "Server exiting due to DEDICATED_IDLE after " << (tSysTimeFloat() - startTime)/3600 << " hours.\n";
01454             uMenu::quickexit = true;
01455         }
01456     }
01457     cp();
01458 
01459     if (!uMenu::quickexit)
01460 #endif
01461         //#endif
01462         own_game( nSERVER );
01463 
01464     sn_SetNetState(nSTANDALONE);
01465 
01466     // close listening sockets
01467     sn_BasicNetworkSystem.AccessListener().Listen(false);
01468 
01469     //wrap up the stats
01470     delete gStats;

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_HostGameMenu (  ) 

Definition at line 1809 of file gGame.cpp.

References uMenu::Enter(), GameSettingsMP(), gServerBrowser::highPort, gServerBrowser::lowPort, NULL, uMenu::ReverseItems(), uMenu::SetSelected(), sg_HostGame(), sn_serverName, and sn_serverPort.

Referenced by gServerStartMenuItem::Enter().

01810                       {
01811     uMenu net_menu("$network_host_text");
01812 
01813     sg_HostMenu = &net_menu;
01814 
01815     uMenuItemInt port(&net_menu, "$network_host_port_text",
01816                       "$network_host_port_help"
01817                       ,reinterpret_cast<int &>(sn_serverPort), gServerBrowser::lowPort, gServerBrowser::highPort);
01818 
01819     uMenuItemString serverName
01820     (&net_menu,"$network_host_name_text",
01821      "$network_host_name_help",
01822      sn_serverName);
01823 
01824     uMenuItemFunction settings1
01825     (&net_menu,
01826      "$game_settings_menu_text",
01827      "$game_settings_menu_help",
01828      &GameSettingsMP);
01829 
01830     uMenuItemFunction serv
01831     (&net_menu,"$network_host_host_text",
01832      "$network_host_host_help",&sg_HostGame);
01833 
01834     net_menu.ReverseItems();
01835     net_menu.SetSelected(0);
01836     net_menu.Enter();
01837 
01838     sg_HostMenu = NULL;

Here is the call graph for this function:

Here is the caller graph for this function:

static bool sg_NetworkError ( const tOutput title,
const tOutput message,
REAL  timeout 
) [static]

Definition at line 1480 of file gGame.cpp.

References tOutput::AddLiteral(), tOutput::AddLocale(), tOutput::Append(), nServerInfoBase::GetConnectionName(), nServerInfoBase::GetPort(), tString::Len(), tConsole::Message(), sn_DenyReason, and sn_PeekRedirectTo().

Referenced by ConnectToServerCore().

01482 {
01483     tOutput message2 ( message );
01484 
01485     if ( sn_DenyReason.Len() > 2 )
01486     {
01487         message2.AddLiteral("\n\n");
01488         message2.AddLocale("network_kill_preface");
01489         message2.AddLiteral("\n");
01490         message2.AddLiteral(sn_DenyReason);
01491     }
01492 
01493     nServerInfoBase * redirect = sn_PeekRedirectTo();
01494     if ( redirect )
01495     {
01496         message2.Append( tOutput( "$network_redirect", redirect->GetConnectionName(), (int)redirect->GetPort() ) );
01497     }
01498 
01499     return tConsole::Message( title, message2, timeout );

Here is the call graph for this function:

Here is the caller graph for this function:

int sg_NumHumans (  ) 

Definition at line 863 of file gGame.cpp.

References ePlayerNetID::CurrentTeam(), ePlayerNetID::IsActive(), ePlayerNetID::IsHuman(), GrowingArrayBase::Len(), ePlayerNetID::NextTeam(), and se_PlayerNetIDs.

Referenced by update_settings().

00864 {
00865     int humans = 0;
00866     for (int i = se_PlayerNetIDs.Len()-1; i>=0; i--)
00867     {
00868         ePlayerNetID* p = se_PlayerNetIDs(i);
00869         if (p->IsHuman() && p->IsActive() && ( bool(p->CurrentTeam()) || bool(p->NextTeam()) ) )
00870             humans++;
00871     }
00872 
00873     return humans;
00874 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sg_NumUsers (  ) 

Definition at line 876 of file gGame.cpp.

References sn_NumUsers().

Referenced by gGame::Analysis(), sg_HostGame(), gGame::StateUpdate(), and update_settings().

00877 {
00878     // return se_PlayerNetIDs.Len() ;
00879 #ifdef DEDICATED
00880     return sn_NumUsers();
00881 #else
00882     return sn_NumUsers() + 1;
00883 #endif
00884 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void sg_ParseMap ( gParser aParser  )  [static]

Definition at line 2361 of file gGame.cpp.

References mapfile, and sg_ParseMap().

02363 {
02364     sg_ParseMap(aParser, mapfile);

Here is the call graph for this function:

static void sg_ParseMap ( gParser aParser,
tString  mapfile 
) [static]

Definition at line 2329 of file gGame.cpp.

References con, DEFAULT_MAP, gMapLoadConsoleFilter::message_, nCLIENT, nSTANDALONE, and sn_GetNetState().

Referenced by sg_ParseMap(), gGame::StateUpdate(), and gGame::Verify().

02331 {
02332     {
02333         gMapLoadConsoleFilter consoleLog;
02334 #ifdef DEBUG
02335         con << "Loading map " << mapfile << "...\n";
02336 #endif
02337         if (!aParser->LoadWithoutParsing(mapfile))
02338         {
02339             tOutput errorMessage( sn_GetNetState() == nCLIENT ? "$map_file_load_failure_server" : "$map_file_load_failure_self", mapfile );
02340 
02341 #ifndef DEDICATED
02342             errorMessage << "\nLog:\n" << consoleLog.message_;
02343 #endif
02344 
02345             con << errorMessage;
02346 
02347             tOutput errorTitle("$map_file_load_failure_title");
02348 
02349             if ( sn_GetNetState() != nSTANDALONE )
02350             {
02351                 throw tGenericException( errorMessage, errorTitle );
02352             }
02353 
02354             if (!aParser->LoadWithoutParsing(DEFAULT_MAP)) {
02355                 errorMessage << "$map_file_load_failure_default";
02356                 throw tGenericException( errorMessage, errorTitle );
02357             }
02358         }
02359     }

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_PrintCurrentDate (  ) 

Definition at line 261 of file gGame.cpp.

References sg_PrintCurrentTime().

00262 {
00263     sg_PrintCurrentTime( "%Y%m%d");
00264 }

Here is the call graph for this function:

void sg_PrintCurrentTime (  ) 

Definition at line 266 of file gGame.cpp.

References sg_PrintCurrentTime().

00267 {
00268     sg_PrintCurrentTime( "%H%M%S" );
00269 }

Here is the call graph for this function:

void sg_PrintCurrentTime ( char const *  szFormat  ) 

Definition at line 256 of file gGame.cpp.

References con, and sg_GetCurrentTime().

Referenced by sg_PrintCurrentDate(), sg_PrintCurrentTime(), and sg_Timestamp().

00257 {
00258     con << sg_GetCurrentTime(szFormat);
00259 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_Receive (  ) 

Definition at line 1520 of file gGame.cpp.

References nSERVER, sn_DiscardFromControlSocket(), sn_GetNetState(), and sn_Receive().

Referenced by ConnectToServerCore(), gGame::GameLoop(), and gGame::NetSync().

01522 {
01523     sn_Receive();
01524     if ( sn_GetNetState() == nSERVER )
01525     {
01526         // servers should ignore data sent to the control socket. It probably would be better
01527         // to close the socket altogether, but that opens another can of worms.
01528         sn_DiscardFromControlSocket();
01529     }

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_RespawnPlayer ( eGrid grid,
gArena arena,
ePlayerNetID p 
)

Definition at line 2905 of file gGame.cpp.

References eGameObject::Alive(), eWallRim::Bound(), ePlayerNetID::ControlObject(), eGameObject::Direction(), eCoord, gArena::LeastDangerousSpawnPoint(), nCLIENT, ePlayerNetID::Object(), pos, eGameObject::Position(), sg_Timestamp(), sn_GetNetState(), and gSpawnPoint::Spawn().

Referenced by zEffectorSpawnPlayer::effect().

02907 {
02908     eGameObject *e=p->Object();
02909 
02910     if ( ( !e || !e->Alive()) && sn_GetNetState() != nCLIENT )
02911     {
02912         eCoord pos,dir;
02913         if ( e )
02914         {
02915             dir = e->Direction();
02916             pos = e->Position();
02917             eWallRim::Bound( pos, 1 );
02918             eCoord displacement = pos - e->Position();
02919             if ( displacement.NormSquared() > .01 )
02920             {
02921                 dir = displacement;
02922                 dir.Normalize();
02923             }
02924         }
02925         else
02926             arena->LeastDangerousSpawnPoint()->Spawn( pos, dir );
02927 #ifdef DEBUG
02928         //                std::cout << "spawning player " << pni->name << '\n';
02929 #endif
02930         gCycle * cycle = new gCycle(grid, pos, dir, p);
02931         p->ControlObject(cycle);
02932 
02933         sg_Timestamp();
02934     }

Here is the call graph for this function:

Here is the caller graph for this function:

void sg_Timestamp (  ) 

Definition at line 271 of file gGame.cpp.

References con, tRecorderBase::IsRunning(), sg_PrintCurrentTime(), st_Breakpoint(), and tSysTimeFloat().

Referenced by sg_HostGame(), sg_RespawnPlayer(), and gGame::StateUpdate().

00272 {
00273 #ifdef DEDICATED
00274     sg_PrintCurrentTime( "Timestamp: %Y/%m/%d %H:%M:%S\n" );
00275     if ( tRecorder::IsRunning() )
00276     {
00277         con << "Uptime: " << int(tSysTimeFloat()) << " seconds.\n";
00278 
00279 #ifdef DEBUG_X
00280         // to set breakpoints at specific round starts
00281         static double breakTime = 0;
00282         if ( tSysTimeFloat() > breakTime )
00283             st_Breakpoint();
00284 #endif
00285     }
00286 #endif
00287 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void sg_TodoClientFullscreenMessage (  )  [static]

Definition at line 4210 of file gGame.cpp.

References sg_ClientFullscreenMessage().

04213 {

Here is the call graph for this function:

static void sg_VoteMenuIdle (  )  [static]

Definition at line 2546 of file gGame.cpp.

References ePlayerNetID::ChatFlags_Menu, uMenu::MenuActive(), se_ChatState(), and eVoter::VotingMenu().

Referenced by gGame::StateUpdate().

02548 {
02549     if ( !uMenu::MenuActive() )
02550     {
02551         se_ChatState( ePlayerNetID::ChatFlags_Menu, true );
02552         eVoter::VotingMenu();
02553         se_ChatState( ePlayerNetID::ChatFlags_Menu, false );
02554     }

Here is the call graph for this function:

Here is the caller graph for this function:

static void singlePlayer_game (  )  [static]

Definition at line 1378 of file gGame.cpp.

References ePlayerNetID::CompleteRebuild(), nSTANDALONE, own_game(), sn_SetNetState(), and update_settings().

Referenced by MainMenu().

01379                                {
01380     sn_SetNetState(nSTANDALONE);
01381 
01382     update_settings();
01383     ePlayerNetID::CompleteRebuild();
01384 
01385     own_game( nSTANDALONE );

Here is the call graph for this function:

Here is the caller graph for this function:

void st_PrintPathInfo ( tOutput buf  ) 

Definition at line 1671 of file tDirectories.cpp.

References tDirectories::Config(), tDirectories::Data(), tPath::GetPaths(), tPath::GetReadPath(), tDirectories::Resource(), tDirectories::Screenshot(), and tDirectories::Var().

Referenced by sg_DisplayVersionInfo().

01671                                     {
01672     tString const hcol("0xff8888");
01673     buf << hcol << "$path_info_user_cfg"   << "0xRESETT\n   " << tDirectories::Var().GetReadPath("user.cfg") << "\n"
01674     << hcol << "$path_info_config"     << "0xRESETT\n" << tDirectories::Config().GetPaths()
01675     << hcol << "$path_info_resource"   << "0xRESETT\n" << tDirectories::Resource().GetPaths()
01676     << hcol << "$path_info_data"       << "0xRESETT\n" << tDirectories::Data().GetPaths()
01677     << hcol << "$path_info_screenshot" << "0xRESETT\n" << tDirectories::Screenshot().GetPaths()
01678     << hcol << "$path_info_var"        << "0xRESETT\n" << tDirectories::Var().GetPaths();
01679 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void StartNewMatch (  )  [static]

Definition at line 1904 of file gGame.cpp.

References nCLIENT, sn_CenterMessage(), sn_ConsoleOut(), sn_GetNetState(), and gGame::StartNewMatch().

Referenced by MainMenu(), and StartNewMatch_conf().

01905                            {
01906     if (sg_currentGame)
01907         sg_currentGame->StartNewMatch();
01908     if (sn_GetNetState()!=nCLIENT){
01909         sn_CenterMessage("$gamestate_reset_center");
01910         sn_ConsoleOut("$gamestate_reset_console");
01911     }

Here is the call graph for this function:

Here is the caller graph for this function:

static void StartNewMatch_conf ( std::istream &   )  [static]

Definition at line 1913 of file gGame.cpp.

References StartNewMatch().

01914                                             {
01915     StartNewMatch();

Here is the call graph for this function:

tCONFIG_ENUM ( gFinishType   ) 

tCONFIG_ENUM ( gGameType   ) 

static tCONTROLLED_PTR ( gGame   )  [static]

static bool togglemousegrab_func ( REAL  x  )  [static]

Definition at line 3597 of file gGame.cpp.

03599                                         {
03600     if (x>0){
03601         su_mouseGrab = !su_mouseGrab;
03602     }
03603 

void update_settings (  ) 

Definition at line 903 of file gGame.cpp.

References nMachine::KickSpectators(), multiPlayer, nCLIENT, gGame::NetSyncIdle(), gGame::NoLongerGoOn(), nSTANDALONE, nAuthentication::OnBreak(), REAL, ePlayerNetID::RemoveChatbots(), nBasicNetworkSystem::Select(), sg_copySettings(), sg_NumHumans(), sg_NumUsers(), sg_singlePlayer, singlePlayer, sn_BasicNetworkSystem, sn_CenterMessage(), sn_ConsoleOut(), sn_GetNetState(), sr_Read_stdin(), st_DoToDo(), gGame::StartNewMatch(), eTeam::teams, and tSysTimeFloat().

Referenced by gParser::parseSettings(), sg_HostGame(), singlePlayer_game(), and gGame::StateUpdate().

00904 {
00905     if (sn_GetNetState()!=nCLIENT)
00906     {
00907 #ifdef DEDICATED
00908         // wait for players to join
00909         {
00910             bool restarted = false;
00911 
00912             REAL timeout = tSysTimeFloat() + 3.0f;
00913             while ( sg_NumHumans() <= 0 && sg_NumUsers() > 0 )
00914             {
00915                 if ( !restarted && bool(sg_currentGame) )
00916                 {
00917                     sg_currentGame->StartNewMatch();
00918                     restarted = true;
00919                 }
00920 
00921                 if ( tSysTimeFloat() > timeout )
00922                 {
00923                     tOutput o("$gamestate_wait_players");
00924                     sn_CenterMessage(o);
00925 
00926                     tOutput o2("$gamestate_wait_players_con");
00927                     sn_ConsoleOut(o2);
00928 
00929                     timeout = tSysTimeFloat() + 10.0f;
00930 
00931                     // do tasks
00932                     st_DoToDo();
00933                     nAuthentication::OnBreak();
00934                 }
00935 
00936                 // kick spectators and chatbots
00937                 nMachine::KickSpectators();
00938                 ePlayerNetID::RemoveChatbots();
00939 
00940                 // wait for network messages
00941                 sn_BasicNetworkSystem.Select( 0.1f );
00942                 gGame::NetSyncIdle();
00943 
00944                 // handle console input
00945                 sr_Read_stdin();
00946             }
00947         }
00948 
00949         if ( sg_NumUsers() <= 0 && bool( sg_currentGame ) )
00950         {
00951             sg_currentGame->NoLongerGoOn();
00952         }
00953 
00954         // count the active players
00955         int humans = sg_NumHumans();
00956 
00957         bool newsg_singlePlayer = (humans<=1);
00958 #else
00959         bool newsg_singlePlayer = (sn_GetNetState() == nSTANDALONE);
00960 #endif
00961         if (sg_singlePlayer != newsg_singlePlayer && bool( sg_currentGame ) )
00962         {
00963             sg_currentGame->StartNewMatch();
00964         }
00965         sg_singlePlayer=newsg_singlePlayer;
00966 
00967         if (sg_singlePlayer)
00968             sg_currentSettings = &singlePlayer;
00969         else
00970             sg_currentSettings = &multiPlayer;
00971 
00972         sg_copySettings();
00973     }
00974 
00975     // update team properties
00976     for (int i = eTeam::teams.Len() - 1; i>=0; --i)
00977         eTeam::teams(i)->UpdateProperties();
00978 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

tConfItemLine a_mod("MESSAGE_OF_DAY", sg_greeting) [static]

tSettingItem< REAL > a_modt("MESSAGE_OF_DAY_TIMEOUT", sg_greetingTimeout) [static]

tConfItemLine a_tod("TITLE_OF_DAY", sg_greetingTitle) [static]

int absolute_winner = 0 [static]

Definition at line 739 of file gGame.cpp.

Referenced by gGame::Analysis(), and init_game_grid().

gArena Arena

Definition at line 93 of file gGame.cpp.

unsigned short client_gamestate[MAXCLIENTS+2]

Definition at line 2456 of file gGame.cpp.

nDescriptor client_gs(311, client_gamestate_handler,"client_gamestate") [static]

Referenced by gGame::StateUpdate().

nSettingItemWatched<tString> conf_mapfile("MAP_FILE", mapfile, nConfItemVersionWatcher::Group_Breaking, 8) [static]

tSettingItem<int> conf_rotationtype("ROTATION_TYPE", rotationtype) [static]

REAL ded_idle = 24 [static]

Definition at line 289 of file gGame.cpp.

Referenced by sg_HostGame().

tSettingItem<REAL> dedicaded_idle("DEDICATED_IDLE", ded_idle) [static]

nNOInitialisator<gGame> game_init(310,"game") [static]

Referenced by gGame::CreatorDescriptor().

static uActionGlobalFunc ingamemenu_action & ingamemenu [static]

Definition at line 3640 of file gGame.cpp.

bool just_connected = true [static]

Definition at line 736 of file gGame.cpp.

Referenced by ConnectToServerCore(), and gGame::StateUpdate().

REAL lastdeath = 0 [static]

Definition at line 2543 of file gGame.cpp.

REAL lastTime_gameloop = 0 [static]

Definition at line 740 of file gGame.cpp.

Referenced by gGame::GameLoop(), init_game_camera(), and init_game_objects().

REAL lastTimeTimestep = 0 [static]

Definition at line 741 of file gGame.cpp.

Referenced by init_game_camera(), init_game_objects(), s_Timestep(), and gGame::Timestep().

nCallbackLoginLogout lc(LoginCallback) [static]

tString mapfile(DEFAULT_MAP) [static]

Referenced by sg_ParseMap().

tConfItem<int> mir("MAX_IN_RATE", sn_maxRateIn) [static]

tConfItem<int> mor("MAX_OUT_RATE", sn_maxRateOut) [static]

tConfItem<bool> mp_an("AUTO_AIS",multiPlayer.autoNum) [static]

tConfItem<bool> mp_aq("AUTO_IQ",multiPlayer.autoIQ) [static]

tConfItem<REAL> mp_er("EXPLOSION_RADIUS", multiPlayer.explosionRadius) [static]

tConfItem<gFinishType> mp_ft("FINISH_TYPE", multiPlayer.finishType) [static]

tConfItem<gGameType> mp_gt("GAME_TYPE", multiPlayer.gameType) [static]

tConfItem<int> mp_iq("AI_IQ",multiPlayer.AI_IQ) [static]

tSettingItem<int> mp_lr("LIMIT_ROUNDS", multiPlayer.limitRounds) [static]

tSettingItem<int> mp_ls("LIMIT_SCORE",multiPlayer.limitScore) [static]

tSettingItem<int> mp_lt("LIMIT_TIME",multiPlayer.limitTime) [static]

tConfItem<int> mp_mp("MIN_PLAYERS",multiPlayer.minPlayers) [static]

tConfItem<int> mp_mtp("TEAM_MIN_PLAYERS", multiPlayer.minPlayersPerTeam) [static]

tConfItem<int> mp_na("NUM_AIS",multiPlayer.numAIs) [static]

tConfItem<int> mp_sf("SPEED_FACTOR", multiPlayer.speedFactor) [static]

tSettingItem<int> mp_sw("SCORE_WIN",multiPlayer.scoreWin) [static]

tConfItem<bool> mp_tbai("TEAM_BALANCE_WITH_AIS", multiPlayer.balanceTeamsWithAIs) [static]

tConfItem<bool> mp_tboq("TEAM_BALANCE_ON_QUIT", multiPlayer.enforceTeamRulesOnQuit) [static]

tConfItem<int> mp_tib("TEAM_MAX_IMBALANCE", multiPlayer.maxTeamImbalance) [static]

tConfItem<int> mp_tmax("TEAMS_MAX", multiPlayer.maxTeams) [static]

tConfItem<int> mp_tmin("TEAMS_MIN", multiPlayer.minTeams) [static]

tConfItem<int> mp_tp("TEAM_MAX_PLAYERS", multiPlayer.maxPlayersPerTeam) [static]

tConfItem<REAL> mp_wl("WALLS_LENGTH", multiPlayer.wallsLength) [static]

tConfItem<REAL> mp_wsu("WALLS_STAY_UP_DELAY", multiPlayer.wallsStayUpDelay) [static]

tConfItem<int> mp_wzld("WIN_ZONE_MIN_LAST_DEATH", multiPlayer.winZoneMinLastDeath) [static]

tConfItem<int> mp_wzmr("WIN_ZONE_MIN_ROUND_TIME", multiPlayer.winZoneMinRoundTime) [static]

tConfItem<int> mp_zf("SIZE_FACTOR",multiPlayer.sizeFactor) [static]

gGameSettings multiPlayer(10, 30, 10, 100, 0, 4, 100, false, false, 0,-3, gDUEL, gFINISH_IMMEDIATELY, 2, 60, 30)

Referenced by GameSettingsMP(), and update_settings().

eTransferInhibitor inh& notrans [static]

Definition at line 4139 of file gGame.cpp.

Referenced by nServerInfo::GiveSmallServerInfo(), and nServerInfo::NetReadThis().

static uActionGlobalFunc pausegame_action & pausegame [static]

Definition at line 3618 of file gGame.cpp.

tConfItem<int> pc("PING_CHARITY", pingCharity) [static]

REAL planned_rate_control[MAXCLIENTS+2]

static uActionGlobalFunc reloadtextures_action & reloadtextures [static]

Definition at line 3629 of file gGame.cpp.

int rotationtype = 0 [static]

Definition at line 241 of file gGame.cpp.

Referenced by gGame::Analysis(), and gGame::StateUpdate().

bool roundOver = false [static]

Definition at line 2544 of file gGame.cpp.

REAL sent_per_messid[100]

Definition at line 2130 of file nNetwork.cpp.

bool sg_axesIndicator

Definition at line 3795 of file gCycle.cpp.

nDescriptor sg_clientFullscreenMessage(312, sg_ClientFullscreenMessage,"client_fsm") [static]

Referenced by sg_FullscreenMessage().

tSettingRotation sg_configRotation("CONFIG_ROTATION") [static]

tConfItem<REAL> sg_ctimeout("GAME_TIMEOUT", sg_Timeout) [static]

gGameSettings* sg_currentSettings = &singlePlayer

Definition at line 645 of file gGame.cpp.

Referenced by gCamera::MyInit().

REAL sg_extraRoundTime = 0.0f [static]

Definition at line 121 of file gGame.cpp.

Referenced by init_game_camera().

tSettingItem<REAL> sg_extraRoundTimeConf("EXTRA_ROUND_TIME", sg_extraRoundTime) [static]

tConfItemFunc sg_fullscreenMessageConf("FULLSCREEN_MESSAGE",&sg_FullscreenMessageConf) [static]

tString sg_fullscreenMessageMessage [static]

Definition at line 4208 of file gGame.cpp.

nVersionFeature sg_fullscreenMessages(14) [static]

Referenced by sg_FullscreenMessage().

REAL sg_fullscreenMessageTimeout [static]

Definition at line 4209 of file gGame.cpp.

tString sg_fullscreenMessageTitle [static]

Definition at line 4207 of file gGame.cpp.

float sg_gameTimeInterval = -1 [static]

Definition at line 292 of file gGame.cpp.

Referenced by gGame::GameLoop().

tString sg_greeting("")

REAL sg_greetingTimeout = 60

Definition at line 4338 of file gGame.cpp.

tString sg_greetingTitle("")

uMenu* sg_HostMenu = NULL

Definition at line 1704 of file gGame.cpp.

uMenu* sg_IngameMenu = NULL

Definition at line 1703 of file gGame.cpp.

REAL sg_lastChatBreakTime = -1.0f [static]

Definition at line 124 of file gGame.cpp.

Referenced by gGame::GameLoop(), and sg_FullscreenMessage().

tSettingItem<REAL> sg_lastChatBreakTimeConf("LAST_CHAT_BREAK_TIME", sg_lastChatBreakTime) [static]

tSettingRotation sg_mapRotation("MAP_ROTATION") [static]

bool sg_RequestedDisconnection = false [static]

Definition at line 1478 of file gGame.cpp.

tString sg_roundCenterMessage("") [static]

Referenced by gGame::StateUpdate().

tString sg_roundConsoleMessage("") [static]

Referenced by gGame::StateUpdate().

bool sg_singlePlayer = 0 [static]

Definition at line 737 of file gGame.cpp.

Referenced by gGame::Analysis(), and update_settings().

int sg_spawnPointGroupSize = 0 [static]

Definition at line 980 of file gGame.cpp.

tSettingItem< int > sg_spawnPointGroupSizeConf("SPAWN_POINT_GROUP_SIZE", sg_spawnPointGroupSize) [static]

bool sg_TalkToMaster = true

Definition at line 730 of file gGame.cpp.

Referenced by gServerBrowser::BrowseLAN(), gServerBrowser::BrowseSpecialMaster(), and sg_HostGame().

REAL sg_Timeout = 5.0f [static]

Definition at line 727 of file gGame.cpp.

Referenced by gGame::StateUpdate(), and gGame::SyncState().

REAL sg_timestepMax = .2 [static]

Definition at line 2941 of file gGame.cpp.

tSettingItem<REAL> sg_timestepMaxConf("TIMESTEP_MAX", sg_timestepMax) [static]

int sg_timestepMaxCount = 10 [static]

Definition at line 2943 of file gGame.cpp.

tSettingItem<int> sg_timestepMaxCountConf("TIMESTEP_MAX_COUNT", sg_timestepMaxCount) [static]

tSettingItem<bool> sg_ttm("TALK_TO_MASTER", sg_TalkToMaster) [static]

REAL sg_winZoneRandomness = .8 [static]

Definition at line 2991 of file gGame.cpp.

tSettingItem< REAL > sg_winZoneSpreadConf("WIN_ZONE_RANDOMNESS", sg_winZoneRandomness) [static]

tSettingItem<float> sggti("LADDERLOG_GAME_TIME_INTERVAL", sg_gameTimeInterval) [static]

gGameSettings singlePlayer(10, 30, 10, 100000, 1, 0, 30, true, true, 0,-3, gDUEL, gFINISH_IMMEDIATELY, 1, 100000, 1000000)

Referenced by GameSettingsSP(), and update_settings().

tConfItemLine sn_roundCcM1_ci("ROUND_CONSOLE_MESSAGE", sg_roundConsoleMessage) [static]

tConfItemLine sn_roundCM_ci("ROUND_CENTER_MESSAGE", sg_roundCenterMessage) [static]

tConfItemFunc snm("START_NEW_MATCH",&StartNewMatch_conf) [static]

tConfItem<bool> sp_an("SP_AUTO_AIS",singlePlayer.autoNum) [static]

tConfItem<bool> sp_aq("SP_AUTO_IQ",singlePlayer.autoIQ) [static]

tConfItem<REAL> sp_er("SP_EXPLOSION_RADIUS", singlePlayer.explosionRadius) [static]

tConfItem<gFinishType> sp_ft("SP_FINISH_TYPE", singlePlayer.finishType) [static]

tConfItem<gGameType> sp_gt("SP_GAME_TYPE", singlePlayer.gameType) [static]

tConfItem<int> sp_iq("SP_AI_IQ",singlePlayer.AI_IQ) [static]

tSettingItem<int> sp_lr("SP_LIMIT_ROUNDS", singlePlayer.limitRounds) [static]

tSettingItem<int> sp_ls("SP_LIMIT_SCORE",singlePlayer.limitScore) [static]

tSettingItem<int> sp_lt("SP_LIMIT_TIME",singlePlayer.limitTime) [static]

tConfItem<int> sp_mp("SP_MIN_PLAYERS",singlePlayer.minPlayers) [static]

tConfItem<int> sp_mtp("SP_TEAM_MIN_PLAYERS", singlePlayer.minPlayersPerTeam) [static]

tConfItem<int> sp_na("SP_NUM_AIS",singlePlayer.numAIs) [static]

tConfItem<int> sp_sf("SP_SPEED_FACTOR", singlePlayer.speedFactor) [static]

tSettingItem<int> sp_sw("SP_SCORE_WIN",singlePlayer.scoreWin) [static]

tConfItem<bool> sp_tbai("SP_TEAM_BALANCE_WITH_AIS", singlePlayer.balanceTeamsWithAIs) [static]

tConfItem<bool> sp_tboq("SP_TEAM_BALANCE_ON_QUIT", singlePlayer.enforceTeamRulesOnQuit) [static]

tConfItem<int> sp_tib("SP_TEAM_MAX_IMBALANCE", singlePlayer.maxTeamImbalance) [static]

tConfItem<int> sp_tmax("SP_TEAMS_MAX", singlePlayer.maxTeams) [static]

tConfItem<int> sp_tmin("SP_TEAMS_MIN", singlePlayer.minTeams) [static]

tConfItem<int> sp_tp("SP_TEAM_MAX_PLAYERS", singlePlayer.maxPlayersPerTeam) [static]

tConfItem<REAL> sp_wl("SP_WALLS_LENGTH", singlePlayer.wallsLength) [static]

tConfItem<REAL> sp_wsu("SP_WALLS_STAY_UP_DELAY", singlePlayer.wallsStayUpDelay) [static]

tConfItem<int> sp_wzld("SP_WIN_ZONE_MIN_LAST_DEATH", singlePlayer.winZoneMinLastDeath) [static]

tConfItem<int> sp_wzmr("SP_WIN_ZONE_MIN_ROUND_TIME", singlePlayer.winZoneMinRoundTime) [static]

tConfItem<int> sp_zf("SP_SIZE_FACTOR",singlePlayer.sizeFactor) [static]

REAL stc_fastestSpeedRound

Definition at line 300 of file cCockpit.cpp.

bool think = 1

Definition at line 1234 of file gGame.cpp.

static uActionGlobalFunc togglemousegrab_action & togglemousegrab [static]

Definition at line 3604 of file gGame.cpp.

int winner = 0 [static]

Definition at line 738 of file gGame.cpp.

Referenced by gGame::Analysis(), init_game_grid(), and sg_DeclareWinner().

int wishWinner = 0 [static]

Definition at line 743 of file gGame.cpp.

Referenced by gGame::Analysis(), init_game_grid(), and sg_DeclareWinner().

char const* wishWinnerMessage = "" [static]

Definition at line 744 of file gGame.cpp.

Referenced by gGame::Analysis(), and sg_DeclareWinner().


Generated on Sat Mar 15 23:16:46 2008 for Armagetron Advanced by  doxygen 1.5.4