src/tron/cockpit/cCockpit.cpp File Reference

#include "cockpit/cCockpit.h"
#include "tValue.h"
#include "values/vParser.h"
#include "cockpit/cGauges.h"
#include "cockpit/cLabel.h"
#include "cockpit/cMap.h"
#include "cockpit/cRectangle.h"
#include "nConfig.h"
#include "ePlayer.h"
#include "gCycle.h"
#include "eTimer.h"
#include "eTeam.h"
#include "eCamera.h"
#include "rRender.h"
#include "rFont.h"
#include "rScreen.h"
#include "eSensor.h"
#include <iostream>
#include "eSoundMixer.h"
#include <time.h>

Include dependency graph for cCockpit.cpp:

Go to the source code of this file.

Typedefs

typedef std::pair< tString,
tValue::Callback< cCockpit >
::cb_ptr > 
cbpair

Functions

static void parsecockpit ()
static void readjust_cockpit ()
std::map< tString,
tValue::Callback< cCockpit >
::cb_ptr > const 
stc_callbacks (cbarray, cbarray+sizeof(cbarray)/sizeof(cbpair))
static void reparseforbiddencallbacks (void)
static void stc_updateFastest ()
static void display_cockpit_lucifer ()
bool ProcessKey (float i, int num)

Variables

static
rCallbackAfterScreenModeChange
reloadft & 
readjust_cockpit
static tString cockpit_file ("Anonymous/standard-0.0.1.aacockpit.xml")
static tConfItem< tStringcf ("COCKPIT_FILE", cockpit_file,&parsecockpit)
static const cbpair cbarray []
std::set< tStringstc_forbiddenCallbacks
static tString stc_forbiddenCallbacksString
static nSettingItem< tStringfcs ("FORBID_COCKPIT_DATA", stc_forbiddenCallbacksString,&reparseforbiddencallbacks)
REAL stc_fastestSpeedRound = .0
REAL stc_fastestSpeed
tString stc_fastestNameRound
tString stc_fastestName
int stc_topScore
static rPerFrameTask stcuf & stc_updateFastest
static rPerFrameTask dfps & display_cockpit_lucifer
static uActionGlobal cockpitKey1 ("COCKPIT_KEY_1")
static uActionGlobal cockpitKey2 ("COCKPIT_KEY_2")
static uActionGlobal cockpitKey3 ("COCKPIT_KEY_3")
static uActionGlobal cockpitKey4 ("COCKPIT_KEY_4")
static uActionGlobal cockpitKey5 ("COCKPIT_KEY_5")


Typedef Documentation

typedef std::pair<tString, tValue::Callback<cCockpit>::cb_ptr> cbpair

Definition at line 70 of file cCockpit.cpp.


Function Documentation

static void display_cockpit_lucifer (  )  [static]

Definition at line 766 of file cCockpit.cpp.

References cCockpit::cCockpit(), ePlayer::cockpit, rViewportConfiguration::CurrentViewportConfiguration(), rViewport::EqualAspectBottom(), rViewport::GetDimensions(), vValue::Expr::Core::Base::GetValue(), eTimer::IsSynced(), rViewportConfiguration::num_viewports, vValue::Parser::parse(), ePlayer::PlayerConfig(), rViewportConfiguration::Port(), cCockpit::Readjust(), cCockpit::Render(), se_mainGameTimer, rViewport::Select(), cCockpit::SetPlayer(), eTimer::speed, sr_ResetRenderState(), sr_screenHeight, sr_screenWidth, sr_viewportBelongsToPlayer, cCockpit::VIEWPORT_ALL, cCockpit::VIEWPORT_TOP, tCoord::x, and tCoord::y.

00767                                       {
00768     static cCockpit static_cockpit(cCockpit::VIEWPORT_TOP);
00769 
00770     sr_ResetRenderState(true);
00771 
00772     if (!(se_mainGameTimer &&
00773             se_mainGameTimer->speed > .9 &&
00774             se_mainGameTimer->speed < 1.1 &&
00775             se_mainGameTimer->IsSynced() )) return;
00776 
00777     rViewportConfiguration* viewportConfiguration = rViewportConfiguration::CurrentViewportConfiguration();
00778 
00779     for ( int viewport = viewportConfiguration->num_viewports-1; viewport >= 0; --viewport )
00780     {
00781         // get the ID of the player in the viewport
00782         int playerID = sr_viewportBelongsToPlayer[ viewport ];
00783 
00784         // get the player
00785         ePlayer* player = ePlayer::PlayerConfig( playerID );
00786 
00787         rViewport *port = viewportConfiguration->Port( viewport );
00788         tCoord dims = port->GetDimensions();
00789 
00790         // select the corrected viewport
00791         port->EqualAspectBottom().Select();
00792 
00793         cCockpit *player_cockpit;
00794         if(!(player_cockpit = dynamic_cast<cCockpit *>(&*player->cockpit))) {
00795             player_cockpit = new cCockpit(cCockpit::VIEWPORT_ALL);
00796             player->cockpit = player_cockpit;
00797             float factor = 4./3. / (static_cast<float>(sr_screenWidth)/static_cast<float>(sr_screenHeight));
00798             player_cockpit->Readjust(factor * dims.y / dims.x);
00799         }
00800 
00801         player_cockpit->SetPlayer(player);
00802         // delegate
00803         player_cockpit->Render();
00804     }
00805 
00806     static_cockpit.Render();
00807 
00808 #if 0   // Testing ground :)
00809     vValue::Expr::Core::Base *test = vValue::Parser::parse(tString("10"));
00810     std::cerr << "test: " << test->GetValue() << std::endl;
00811 #endif

Here is the call graph for this function:

static void parsecockpit (  )  [static]

Definition at line 53 of file cCockpit.cpp.

References FOREACH_COCKPIT.

Referenced by reparseforbiddencallbacks().

00053                             {
00054     FOREACH_COCKPIT(i) {
00055         (*i)->ProcessCockpit();
00056     }
00057 }

Here is the caller graph for this function:

bool ProcessKey ( float  i,
int  num 
)

Definition at line 826 of file cCockpit.cpp.

References FOREACH_COCKPIT.

Referenced by cCockpit::ProcessKey2(), cCockpit::ProcessKey3(), cCockpit::ProcessKey4(), and cCockpit::ProcessKey5().

00827                                   {
00828     bool ret = false;
00829     FOREACH_COCKPIT(j) {
00830         if((*j)->HandleEvent(num, i>0)) {
00831             ret = true;
00832         }
00833     }
00834     return ret;

Here is the caller graph for this function:

static void readjust_cockpit (  )  [static]

Definition at line 59 of file cCockpit.cpp.

References FOREACH_COCKPIT.

00059                                 {
00060     FOREACH_COCKPIT(i) {
00061         (*i)->Readjust();
00062     }
00063 }

static void reparseforbiddencallbacks ( void   )  [static]

Definition at line 112 of file cCockpit.cpp.

References parsecockpit(), pos, stc_callbacks, and tString::SubStr().

00112                                             {
00113     stc_forbiddenCallbacks.clear();
00114 
00115     tString callbacks = stc_forbiddenCallbacksString + ":"; //add the extra separator, makes things easier
00116 
00117     size_t pos = 0;
00118     size_t next;
00119     while((next = callbacks.find(':', pos)) != tString::npos) {
00120         tString callback = callbacks.SubStr(pos, next - pos);
00121         if(stc_callbacks.count(callback)) {
00122             stc_forbiddenCallbacks.insert(callback);
00123         }
00124         pos = next+1;
00125     }
00126     parsecockpit();
00127 }

Here is the call graph for this function:

std::map<tString, tValue::Callback<cCockpit>::cb_ptr> const stc_callbacks ( cbarray  ,
cbarray sizeof(cbarray)/sizeof(cbpair) 
)

static void stc_updateFastest (  )  [static]

Definition at line 330 of file cCockpit.cpp.

References ePlayerNetID::GetName(), GrowingArrayBase::Len(), ePlayerNetID::Object(), and se_PlayerNetIDs.

00331                                 {
00332     stc_fastestSpeed = 0.;
00333     stc_topScore = 0;
00334     for(int i =0 ; i< se_PlayerNetIDs.Len(); i++){
00335         ePlayerNetID *p = se_PlayerNetIDs[i];
00336 
00337         if(gCycle *h = (gCycle*)(p->Object())){
00338             if (h->Speed()>stc_fastestSpeedRound && h->Alive()){
00339                 stc_fastestSpeedRound =  (float) h->Speed();  // changed to float for more accuracy in reporting top speed
00340                 stc_fastestNameRound = p->GetName();
00341             }
00342             if (h->Speed()>stc_fastestSpeed && h->Alive()){
00343                 stc_fastestSpeed =  (float) h->Speed();  // changed to float for more accuracy in reporting top speed
00344                 stc_fastestName = p->GetName();
00345             }
00346         }
00347         int thisscore = se_PlayerNetIDs[i]->TotalScore();
00348         if(thisscore>stc_topScore)
00349             stc_topScore=thisscore;
00350     }

Here is the call graph for this function:


Variable Documentation

const cbpair cbarray[] [static]

Definition at line 71 of file cCockpit.cpp.

tConfItem<tString> cf("COCKPIT_FILE", cockpit_file,&parsecockpit) [static]

tString cockpit_file("Anonymous/standard-0.0.1.aacockpit.xml") [static]

Referenced by cCockpit::ProcessCockpit().

static uActionGlobalFunc ck1 & cockpitKey1 [static]

Definition at line 820 of file cCockpit.cpp.

static uActionGlobalFunc ck2 & cockpitKey2 [static]

Definition at line 821 of file cCockpit.cpp.

static uActionGlobalFunc ck3 & cockpitKey3 [static]

Definition at line 822 of file cCockpit.cpp.

static uActionGlobalFunc ck4 & cockpitKey4 [static]

Definition at line 823 of file cCockpit.cpp.

static uActionGlobalFunc ck5 & cockpitKey5 [static]

Definition at line 824 of file cCockpit.cpp.

rPerFrameTask dfps& display_cockpit_lucifer [static]

Definition at line 813 of file cCockpit.cpp.

nSettingItem<tString> fcs("FORBID_COCKPIT_DATA", stc_forbiddenCallbacksString,&reparseforbiddencallbacks) [static]

rCallbackAfterScreenModeChange reloadft& readjust_cockpit [static]

Definition at line 65 of file cCockpit.cpp.

tString stc_fastestName

Definition at line 303 of file cCockpit.cpp.

tString stc_fastestNameRound

Definition at line 302 of file cCockpit.cpp.

REAL stc_fastestSpeed

Definition at line 301 of file cCockpit.cpp.

REAL stc_fastestSpeedRound = .0

Definition at line 300 of file cCockpit.cpp.

std::set<tString> stc_forbiddenCallbacks

Definition at line 105 of file cCockpit.cpp.

Referenced by cWidget::WithDataFunctions::ProcessDataSource().

tString stc_forbiddenCallbacksString [static]

Definition at line 107 of file cCockpit.cpp.

int stc_topScore

Definition at line 304 of file cCockpit.cpp.

rPerFrameTask stcuf& stc_updateFastest [static]

Definition at line 352 of file cCockpit.cpp.


Generated on Sat Mar 15 23:13:49 2008 for Armagetron Advanced by  doxygen 1.5.4