~ubuntu-branches/ubuntu/natty/smc/natty

« back to all changes in this revision

Viewing changes to src/enemies/rokko.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Muammar El Khatib
  • Date: 2009-01-30 14:20:20 UTC
  • mfrom: (1.1.5 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090130142020-slza1cg603t34uyq
Tags: 1.7-1
* New upstream release. (Closes: #511404)
* debian/control: smc Build-Depends on libboost-filesystem1.37-dev instead of
  libboost-filesystem-dev.
* debian/control: dpatch build dependency has been added in order to make the
  update of libboost-filesystem1.37-dev.
* smc is not failing anymore with undefined symbol error in CEGUI. Problem was
  caused by a missed directory called translations under /usr/share/games/smc/
  (Closes: #508106)
* smc now suggests smc-music. Thanks to Alessio Treglia for reporting this.
  (Closes: #511660)
* Bug 'Segmentation fault on startup' is no longer present in this new 
  upstream version.  (Closes: #512841)

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        massivetype = MASS_PASSIVE;
51
51
        posz = 0.03f;
52
52
        editor_posz = 0.09f;
 
53
        can_be_on_ground = 0;
 
54
        player_range = 4000;
53
55
        Set_Visible( 0 );
54
 
        can_be_ground = 1;
55
56
 
56
57
        fire_resistant = 1;
57
58
        ice_resistance = 1;
62
63
        Set_Max_Distance_Sides( 400 );
63
64
        state = STA_STAY;
64
65
 
65
 
        player_range = 4000;
66
66
        smoke_counter = 0;
67
67
 
68
68
        kill_sound = "stomp_1.ogg";
127
127
void cRokko :: Set_Direction( ObjectDirection dir )
128
128
{
129
129
        // already set
130
 
        if( direction == dir )
 
130
        if( start_direction == dir )
131
131
        {
132
132
                return;
133
133
        }
137
137
 
138
138
        cEnemy::Set_Direction( dir, 1 );
139
139
        name = "Rokko ";
140
 
        name += _(Get_Direction_Name( start_direction).c_str());
 
140
        name += _(Get_Direction_Name(start_direction).c_str());
141
141
 
142
142
        if( direction == DIR_LEFT )
143
143
        {
232
232
 
233
233
void cRokko :: DieStep( void )
234
234
{
235
 
        Move( 0, 17 );
 
235
        // add gravity
 
236
        if( vely < 25 )
 
237
        {
 
238
                Add_Velocity( 0, 1.5f );
 
239
        }
 
240
 
 
241
        Move( velx, vely );
236
242
 
237
243
        if( direction == DIR_LEFT || direction == DIR_RIGHT )
238
244
        {
250
256
                smoke_counter -= static_cast<int>(smoke_counter);
251
257
        }
252
258
 
253
 
        if( posy > 600 )
 
259
        // below ground
 
260
        if( col_rect.y - 200 > pActive_Camera->limit_rect.y + game_res_h )
254
261
        {
255
262
                rotz = 0;
256
263
                massivetype = MASS_PASSIVE;
395
402
        // moving smoke particle animation
396
403
        while( quota > 0 )
397
404
        {
 
405
                anim = new cParticle_Emitter();
 
406
 
398
407
                // not dead
399
408
                if( !dead )
400
 
                {
 
409
                {                               
401
410
                        if( direction == DIR_LEFT )
402
411
                        {
403
 
                                anim = new cParticle_Emitter();
404
412
                                anim->Set_Pos( posx + col_rect.w - Get_Random_Float( 5, 8 ), posy + Get_Random_Float( 0, rect.h - 15 ) );
405
413
                                anim->Set_Direction_Range( 320, 100 );
406
414
                        }
407
415
                        else
408
416
                        {
409
 
                                anim = new cParticle_Emitter();
410
417
                                anim->Set_Pos( posx + Get_Random_Float( 5, 8 ), posy + Get_Random_Float( 0, rect.h - 15 ) );
411
418
                                anim->Set_Direction_Range( 140, 100 );
412
419
                        }
 
420
 
 
421
                        anim->Set_Scale( 1.1f );
413
422
                }
414
423
                // dead
415
424
                else
416
425
                {
417
 
                        anim = new cParticle_Emitter();
418
426
                        anim->Set_Pos( posx + Get_Random_Float( 0, col_rect.w ), posy + Get_Random_Float( 0, rect.h ) );
 
427
                        anim->Set_Scale( 0.5f );
419
428
                }
420
429
 
421
 
                // - 0.000001f caused a weird graphical z pos bug with my ATI card
 
430
                // - 0.000001f caused a weird graphical z pos bug with an ATI card
422
431
                anim->Set_Pos_Z( posz - 0.000005f );
423
432
                anim->Set_Image( pVideo->Get_Surface( "animation/particles/smoke_black.png" ) );
424
433
                anim->Set_Time_to_Live( 0.3f, 1 );
425
434
                anim->Set_Speed( 1, 1 );
426
 
                anim->Set_Scale( 1.3f );
427
435
                anim->Set_Const_Rotation_Z( -1, 2 );
428
436
                anim->Set_Color( Color( static_cast<Uint8>(155), 150, 130 ) );
429
437
                anim->Set_Fading_Alpha( 1 );
469
477
 
470
478
bool cRokko :: Is_Draw_Valid( void )
471
479
{
472
 
        if( cEnemy::Is_Draw_Valid() == 1 )
473
 
        {
474
 
                return 1;
475
 
        }
476
 
 
477
 
        // if not editor enabled or not active mouse object
478
 
        if( !editor_enabled || pMouseCursor->active_object != this )
479
 
        {
480
 
                return 0;
481
 
        }
482
 
 
483
 
        return 1;
 
480
        bool valid = cEnemy::Is_Draw_Valid();
 
481
 
 
482
        // if editor enabled
 
483
        if( editor_enabled )
 
484
        {
 
485
                // if active mouse object
 
486
                if( pMouseCursor->active_object == this )
 
487
                {
 
488
                        return 1;
 
489
                }
 
490
        }
 
491
 
 
492
 
 
493
        return valid;
484
494
}
485
495
 
486
496
unsigned int cRokko :: Validate_Collision( cSprite *obj )
516
526
        }
517
527
        else
518
528
        {
519
 
                pPlayer->DownGrade();
 
529
                pPlayer->DownGrade_Player();
520
530
        }
521
531
}
522
532
 
529
539
{
530
540
        CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
531
541
 
 
542
        // direction
 
543
        CEGUI::Combobox *combobox = static_cast<CEGUI::Combobox *>(wmgr.createWindow( "TaharezLook/Combobox", "editor_rokko_direction" ));
 
544
        Editor_Add( UTF8_("Direction"), UTF8_("Direction"), combobox, 100, 75 );
 
545
 
 
546
        combobox->addItem( new CEGUI::ListboxTextItem( "left" ) );
 
547
        combobox->addItem( new CEGUI::ListboxTextItem( "right" ) );
 
548
 
 
549
        combobox->setText( Get_Direction_Name( start_direction ) );
 
550
        combobox->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cRokko::Editor_Direction_Select, this ) );
 
551
 
532
552
        // speed
533
553
        CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_rokko_speed" ));
534
554
        Editor_Add( UTF8_("Speed"), UTF8_("Speed when activated"), editbox, 120 );
540
560
        Editor_Init();
541
561
}
542
562
 
 
563
bool cRokko :: Editor_Direction_Select( const CEGUI::EventArgs &event )
 
564
{
 
565
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
566
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
 
567
 
 
568
        Set_Direction( Get_Direction_Id( item->getText().c_str() ) );
 
569
 
 
570
        return 1;
 
571
}
 
572
 
543
573
bool cRokko :: Editor_Speed_Key( const CEGUI::EventArgs &event )
544
574
{
545
575
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );