Beispiel #1
0
void checkWin(){

    if ( ball_x < p1_x){
        textout_ex( screen, font, "Player 2 Wins!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); 
        startNew();
    } else if ( ball_x > p2_x){
        textout_ex( screen, font, "Player 1 Wins!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); 
        startNew();
    }    
   
}    
Beispiel #2
0
int checkWin(SDL_Surface* score1, SDL_Surface* score2, SDL_Surface* screen)
{

    if ( ball_x < p1_x){
		startNew(screen);
		return 1;
		}   
    else if ( ball_x > p2_x){ 
        startNew(screen);
		return 0;
    }    

	return 2;
   
}    
Beispiel #3
0
void Spider::gameTypeChanged()
{
    stopDemo();

    if ( allowedToStartNewGame() )
    {
        if ( options->currentItem() == 0 )
            setSuits( 1 );
        else if ( options->currentItem() == 1 )
            setSuits( 2 );
        else
            setSuits( 4 );

        if ( m_stackFaceup != m_stackFaceupOption->currentItem() ) {
            m_stackFaceup = m_stackFaceupOption->currentItem();
            Settings::setSpiderStackFaceup( m_stackFaceup );
        }

        startNew( gameNumber() );
    }
    else
    {
        // If we're not allowed, reset the option to
        // the current number of suits.
        if ( m_suits == 1 )
            options->setCurrentItem( 0 );
        else if ( m_suits == 2 )
            options->setCurrentItem( 1 );
        else
            options->setCurrentItem( 2 );

        m_stackFaceupOption->setCurrentItem( m_stackFaceup );
    }
}
Beispiel #4
0
/** \brief Higher-level method to start a GP without having to care about
 *  the exact startup sequence
 */
void RaceManager::startGP(const GrandPrixData &gp, bool from_overworld,
                          bool continue_saved_gp)
{
    StateManager::get()->enterGameState();
    setGrandPrix(gp);
    race_manager->setupPlayerKartInfo();
    m_continue_saved_gp = continue_saved_gp;

    setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
    startNew(from_overworld);
}
Beispiel #5
0
void RaceManager::startGP(const GrandPrixData* gp, bool from_overworld, 
                          bool continue_saved_gp)
{
    assert(gp != NULL);

    StateManager::get()->enterGameState();
    setGrandPrix(*gp);
    setCoinTarget( 0 ); // Might still be set from a previous challenge
    race_manager->setupPlayerKartInfo();
    m_continue_saved_gp = continue_saved_gp;

    setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
    startNew(from_overworld);
}
Beispiel #6
0
void pingpong_score()
{
     if(for_scoring==2)
           count2++;
     else if(for_scoring==1)
           count1++;   
     textprintf(screen,font,60,2,makecol(255,255,255), "P1=%d", count1);
     textprintf(screen,font,540,2,makecol(255,255,255), "P2=%d", count2);
     if(count1==5 || count2==5)
     {
           declare_winner();
           stop_sample(samSong);
           openscreen();
     }
     startNew();
}
Beispiel #7
0
/** \brief Higher-level method to start a GP without having to care about
 *  the exact startup sequence.
 * \param trackIdent Internal name of the track to race on
 * \param num_laps   Number of laps to race, or -1 if number of laps is
 *        not relevant in current mode
 */
void RaceManager::startSingleRace(const std::string &track_ident,
                                  const int num_laps,
                                  bool from_overworld)
{
    StateManager::get()->enterGameState();
    setTrack(track_ident.c_str());

    if (num_laps != -1) setNumLaps( num_laps );

    setMajorMode(RaceManager::MAJOR_MODE_SINGLE);

    setCoinTarget( 0 ); // Might still be set from a previous challenge
    if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning()) // if not in a network world
        race_manager->setupPlayerKartInfo(); // do this setup player kart

    startNew(from_overworld);
}
Beispiel #8
0
/** \brief Higher-level method to start a GP without having to care about
 *  the exact startup sequence.
 * \param trackIdent Internal name of the track to race on
 * \param num_laps   Number of laps to race, or -1 if number of laps is
 *        not relevant in current mode
 */
void RaceManager::startSingleRace(const std::string &track_ident,
                                  const int num_laps,
                                  bool from_overworld)
{
    assert(!m_watching_replay);
    StateManager::get()->enterGameState();
    setTrack(track_ident);

    if (num_laps != -1) setNumLaps( num_laps );

    setMajorMode(RaceManager::MAJOR_MODE_SINGLE);

    setCoinTarget( 0 ); // Might still be set from a previous challenge

    // if not in a network world, setup player karts
    if (!RaceEventManager::getInstance<RaceEventManager>()->isRunning())
        race_manager->setupPlayerKartInfo(); // do this setup player kart

    startNew(from_overworld);
}   // startSingleRace