Back to index

extremetuxracer  0.5beta
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions
Intro Class Reference

#include <intro.h>

Inheritance diagram for Intro:
Inheritance graph
[legend]
Collaboration diagram for Intro:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Intro ()
 ~Intro ()
void loop (float timeStep)
bool keyPressEvent (SDLKey key)
virtual bool keyboardEvent (SDLKey key, bool release)
virtual bool keyReleaseEvent (SDLKey key)
virtual bool mouseButtonEvent (int button, int x, int y, bool pressed)
virtual bool mouseButtonPressEvent (int button, int x, int y)
virtual bool mouseButtonReleaseEvent (int button, int x, int y)

Static Public Attributes

static GameModecurrentMode = NULL
static game_mode_t mode
static game_mode_t prevmode

Protected Member Functions

void drawSnow (float timeStep, bool windy=false)
 custom function for drawing snow in the ui

Private Member Functions

void abort (Player &plyr)

Detailed Description

Definition at line 26 of file intro.h.


Constructor & Destructor Documentation

Definition at line 52 of file intro.cpp.

{
       int i, num_items;
    Item *item_locs;

    pp::Vec2d start_pt = get_start_pt();

    init_key_frame();

    players[0].orientation_initialized = false;

    players[0].view.initialized = false;

    gameMgr->time = 0.0;
       gameMgr->airbornetime = 0.0;
    players[0].herring = 0;
    players[0].score = 0;

       if(Benchmark::getMode()==Benchmark::PAUSED){
              set_start_pt(Benchmark::getPosition());
       }else{
              players[0].pos.x = start_pt.x;
       players[0].pos.z = start_pt.y;
       }
    init_physical_simulation();

    players[0].vel = pp::Vec3d(0,0,0);

    clear_particles();

    set_view_mode( players[0], ABOVE );
    update_view( players[0], EPS ); 

    if(gameMgr->getCurrentRace().snowing) {
        int snowtype = gameMgr->getCurrentRace().snowtype;
        if(snowtype > -1) {
            SetSnowType(snowtype);
        }
        init_snow(players[0].pos);
    }
    
    if(gameMgr->getCurrentRace().windy) {
              int windtype = gameMgr->getCurrentRace().windtype;
        if(windtype > -1) {
            SetWindType(windtype);
        }
       }
    
    // reset all items as collectable 
    num_items = get_num_items();
    item_locs = get_item_locs();
    for (i = 0; i < num_items; i++ ) {
              item_locs[i].setCollected(false);
              /*            
              if(item_locs[i].getTypeCollectable()==Item::COLLECTED){
              item_locs[i].setCollectable(Item::YES);
              }
              */
    }

if (gameMgr->gametype!=GameMgr::PRACTICING) {
std::string mus = gameMgr->currentEvent->music;
mus += "_intro";
play_music( (char *)mus.c_str() );
}
else
{
play_music("intro");
}    

}

Here is the call graph for this function:

Definition at line 124 of file intro.cpp.

{
       
       
}

Member Function Documentation

void Intro::abort ( Player plyr) [private]

Definition at line 198 of file intro.cpp.

{
    pp::Vec2d start_pt = get_start_pt();
    
    if(gameMgr->getCurrentRace().snowing) reset_snow();

    set_game_mode( RACING );

       plyr.orientation_initialized = false;
    plyr.view.initialized = true;

       plyr.pos.x = start_pt.x;
    plyr.pos.z = start_pt.y;
    winsys_post_redisplay();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GameMode::drawSnow ( float  timeStep,
bool  windy = false 
) [protected, inherited]

custom function for drawing snow in the ui

Definition at line 203 of file loop.cpp.

{
       // check wether ui snow is 
       if(getparam_ui_snow()){
              // update and draw snow
              update_ui_snow( timeStep, windy );
              draw_ui_snow();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool GameMode::keyboardEvent ( SDLKey  key,
bool  release 
) [inline, virtual, inherited]

Reimplemented in Racing.

Definition at line 90 of file loop.h.

{return false;};
bool Intro::keyPressEvent ( SDLKey  key) [virtual]

Reimplemented from GameMode.

Definition at line 215 of file intro.cpp.

{ 
       abort( players[0] );
       
       return true;
}

Here is the call graph for this function:

virtual bool GameMode::keyReleaseEvent ( SDLKey  key) [inline, virtual, inherited]

Reimplemented in HighscoreShow, and SplashScreen.

Definition at line 92 of file loop.h.

{return false;};
void Intro::loop ( float  timeStep) [virtual]

Implements GameMode.

Definition at line 131 of file intro.cpp.

{
       int width, height;

    if ( getparam_do_intro_animation() == false ) {
        if(gameMgr->getCurrentRace().snowing) reset_snow();
              set_game_mode( RACING );
              return;
    }

    width = getparam_x_resolution();
    height = getparam_y_resolution();

    // Check joystick
    if ( is_joystick_active() ) {
              update_joystick();

              if ( is_joystick_continue_button_down() ) {
              abort( players[0] );
              return;
              }
    }
    
    fpsCounter.update();

    update_audio();

    update_key_frame( players[0], timeStep );

    clear_rendering_context();

    fogPlane.setup();

    update_view( players[0], timeStep );

    setup_view_frustum( players[0], NEAR_CLIP_DIST, 
                     getparam_forward_clip_distance() );

    draw_sky( players[0].view.pos );

    draw_fog_plane();

    set_course_clipping( true );
    set_course_eye_point( players[0].view.pos );
    setup_course_lighting();
    render_course( );
    //Draw snow
    if(gameMgr->getCurrentRace().snowing) {
        update_snow( timeStep, false, players[0].pos );
        draw_snow(players[0].view.pos);
    }
    draw_trees();

    ModelHndl->draw_tux();
    draw_tux_shadow();

    HUD1.draw(players[0]);

    reshape( width, height );
    winsys_swap_buffers();
       
       if( Benchmark::getMode() != Benchmark::NONE){
              abort(players[0]);
       }
}

Here is the call graph for this function:

virtual bool GameMode::mouseButtonEvent ( int  button,
int  x,
int  y,
bool  pressed 
) [inline, virtual, inherited]

Reimplemented in GameOver.

Definition at line 94 of file loop.h.

{return false;};
virtual bool GameMode::mouseButtonPressEvent ( int  button,
int  x,
int  y 
) [inline, virtual, inherited]

Definition at line 95 of file loop.h.

{return false;};
virtual bool GameMode::mouseButtonReleaseEvent ( int  button,
int  x,
int  y 
) [inline, virtual, inherited]

Reimplemented in CreditsTrans, and SplashScreen.

Definition at line 96 of file loop.h.

{return false;};

Member Data Documentation

GameMode * GameMode::currentMode = NULL [static, inherited]

Definition at line 96 of file loop.h.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.h.

game_mode_t GameMode::prevmode [static, inherited]

Definition at line 100 of file loop.h.


The documentation for this class was generated from the following files: