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

« back to all changes in this revision

Viewing changes to src/gui/menu_data.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Muammar El Khatib
  • Date: 2008-10-20 00:31:35 UTC
  • mfrom: (1.1.4 upstream) (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081020003135-5ac8cpecomfohvv5
Tags: 1.6-1
* New upstream release. (Closes:#479415)
* Bumped standards version to 3.8.0.
* debian/control: dpatch build dependency has been removed temporarily.
* debian/control: smc-data does not depend on smc anymore. This change will
  avoid a circular dependency. (Closes: #478712)
* smc does not segfault. (Closes: #500039, #491590) 
* Icon is not missed in Gnome Menu. Thanks to Saïvann for providing a 
  solution. (Closes: #491885)
* debian/control: smc-data's and smc-music's descriptions have been improved.
  (Closes: #493630)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
                                menu_data.cpp  -  menu data/handling classes
3
 
                             -------------------
4
 
    copyright            :      (C) 2004 - 2007 by Florian Richter
 
2
 * menu_data.cpp  -  menu data and handling classes
 
3
 *
 
4
 * Copyright (C) 2004 - 2008 Florian Richter
5
5
 ***************************************************************************/
6
6
/*
7
7
   This program is free software; you can redistribute it and/or modify
30
30
#include "../level/level.h"
31
31
#include "../input/keyboard.h"
32
32
#include "../level/level_editor.h"
 
33
#include "../audio/sound_manager.h"
 
34
#include "../core/math/utilities.h"
 
35
#include "../core/i18n.h"
 
36
#include "../core/math/size.h"
33
37
// boost filesystem
34
38
#include "boost/filesystem/convenience.hpp"
35
39
namespace fs = boost::filesystem;
50
54
        if( guiwindow )
51
55
        {
52
56
                pGuiSystem->getGUISheet()->removeChildWindow( guiwindow );
53
 
                WindowManager::getSingleton().destroyWindow( guiwindow );
 
57
                CEGUI::WindowManager::getSingleton().destroyWindow( guiwindow );
54
58
        }
55
59
 
56
60
        for( HudSpriteList::iterator itr = drawlist.begin(), itr_end = drawlist.end(); itr != itr_end; ++itr )
64
68
void cMenu_Base :: Init( void )
65
69
{
66
70
        // continue playing level/world music but not if finished level 
67
 
        if( !pAudio->isMusicPlaying() || ( Game_Mode_Type == MODE_TYPE_LEVEL_CUSTOM && !pLevel->is_Loaded() ) )
 
71
        if( !pAudio->Is_Music_Playing() || ( Game_Mode_Type == MODE_TYPE_LEVEL_CUSTOM && !pActive_Level->Is_Loaded() ) )
68
72
        {
69
 
                pAudio->PlayMusic( "game/menu.ogg", -1, 0, 1500 );
 
73
                pAudio->Play_Music( "game/menu.ogg", -1, 0, 1500 );
70
74
        }
71
75
 
72
76
        // init
82
86
                return;
83
87
        }
84
88
 
85
 
        guiwindow = WindowManager::getSingleton().loadWindowLayout( layout_file.c_str() );
 
89
        guiwindow = CEGUI::WindowManager::getSingleton().loadWindowLayout( layout_file.c_str() );
86
90
        pGuiSystem->getGUISheet()->addChildWindow( guiwindow );
87
91
}
88
92
 
91
95
        // animation
92
96
        pMenuCore->pMenu_AnimManager->Update();
93
97
        // hud
94
 
        pHudManager->Update();
 
98
        pHud_Manager->Update();
95
99
}
96
100
 
97
101
void cMenu_Base :: Draw( void )
112
116
void cMenu_Base :: Draw_End( void )
113
117
{
114
118
        // hud
115
 
        pHudManager->Draw();
 
119
        pHud_Manager->Draw();
116
120
}
117
121
 
118
122
void cMenu_Base :: Exit( void )
144
148
 
145
149
        layout_file = "menu_main.layout";
146
150
 
147
 
        GL_Surface *credits = pFont->RenderText( pFont->font_normal, "Credits", yellow );
 
151
        GL_Surface *credits = pFont->Render_Text( pFont->font_normal, _("Credits"), yellow );
148
152
 
149
153
        // Start
150
154
        temp_item = pMenuCore->Auto_Menu( "start.png", "start.png", menu_posy );
151
155
        temp_item->image_menu->Set_Pos( temp_item->posx + ( temp_item->image_default->col_rect.w + 16 ), temp_item->posy );
152
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
156
        pMenuCore->handler->Add_Menu_Item( temp_item );
153
157
        // Options
154
158
        menu_posy += 60;
155
159
        temp_item = pMenuCore->Auto_Menu( "options.png", "options.png", menu_posy );
156
160
        temp_item->image_menu->Set_Pos( temp_item->posx - temp_item->image_menu->col_rect.w - 16, temp_item->posy );
157
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
161
        pMenuCore->handler->Add_Menu_Item( temp_item );
158
162
        // Load
159
163
        menu_posy += 60;
160
164
        temp_item = pMenuCore->Auto_Menu( "load.png", "load.png", menu_posy );
161
165
        temp_item->image_menu->Set_Pos( temp_item->posx + ( temp_item->image_default->col_rect.w + 16 ), temp_item->posy );
162
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
166
        pMenuCore->handler->Add_Menu_Item( temp_item );
163
167
        // Save
164
168
        menu_posy += 60;
165
169
        temp_item = pMenuCore->Auto_Menu( "save.png", "save.png", menu_posy );
166
170
        temp_item->image_menu->Set_Pos( temp_item->posx - temp_item->image_menu->col_rect.w - 16, temp_item->posy );
167
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
171
        pMenuCore->handler->Add_Menu_Item( temp_item );
168
172
        // Quit
169
173
        menu_posy += 60;
170
174
        temp_item = pMenuCore->Auto_Menu( "quit.png", "", menu_posy, 1 );
171
175
        temp_item->image_menu->Set_Pos( temp_item->posx + temp_item->col_rect.w + 16, temp_item->posy );
172
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
176
        pMenuCore->handler->Add_Menu_Item( temp_item );
173
177
 
174
178
        // Credits
175
179
        temp_item = new cMenu_Item();
176
180
        temp_item->image_default->Set_Image( credits );
177
 
        temp_item->Set_Pos( GAME_RES_W * 0.45f, GAME_RES_H - 30 );
178
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
 
181
        temp_item->Set_Pos( static_cast<float>(game_res_w) * 0.45f, static_cast<float>(game_res_h) - 30 );
 
182
        pMenuCore->handler->Add_Menu_Item( temp_item, 1.5f, grey );
179
183
 
180
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/logo_sdl.png" ), 10, static_cast<float>(GAME_RES_H) * 0.935f ) );
 
184
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/logo_sdl.png" ), 10, static_cast<float>(game_res_h) * 0.935f ) );
181
185
        drawlist.push_back( new cHudSprite( credits, -200, 0, 1 ) );
182
186
 
183
187
        Init_GUI();
187
191
{
188
192
        cMenu_Base::Init_GUI();
189
193
 
190
 
        Window *text_version = WindowManager::getSingleton().getWindow( "text_version" );
191
 
        text_version->setProperty( "Text", "Version " VERSION );
 
194
        CEGUI::Window *text_version = CEGUI::WindowManager::getSingleton().getWindow( "text_version" );
 
195
        text_version->setProperty( "Text", _("Version ") + string_trim_from_end( float_to_string( smc_version, 6 ), '0' ) );
192
196
}
193
197
 
194
198
void cMenu_Main :: Update( void )
229
233
        // Quit
230
234
        else if( pMenuCore->handler->active == 4 )
231
235
        {
232
 
                done = 1;
 
236
                game_exit = 1;
233
237
        }
234
238
        // Credits
235
239
        else if( pMenuCore->handler->active == 5 )
247
251
 
248
252
void cMenu_Main :: Exit( void )
249
253
{
250
 
        if( pLevel->is_Loaded() )
 
254
        if( pActive_Level->Is_Loaded() )
251
255
        {
252
256
                Game_Action = GA_ENTER_LEVEL;
253
257
        }
278
282
 
279
283
        layout_file = "menu_start.layout";
280
284
 
281
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/start.png" ), GAME_RES_W * 0.02f, 140 ) );
282
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/overworld.png" ), GAME_RES_W / 20, 210 ) );
 
285
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/start.png" ), static_cast<float>(game_res_w) * 0.02f, 140 ) );
 
286
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/overworld.png" ), static_cast<float>(game_res_w) / 20, 210 ) );
283
287
 
284
288
        Init_GUI();
285
289
}
289
293
        cMenu_Base::Init_GUI();
290
294
 
291
295
        // Tab Control
292
 
        TabControl *tabcontrol = static_cast<TabControl *>(WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
 
296
        CEGUI::TabControl *tabcontrol = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
293
297
        tabcontrol->activate();
294
298
 
295
299
        // events
296
 
        tabcontrol->subscribeEvent( Window::EventKeyDown, Event::Subscriber( &cMenu_Start::window_keydown, this ) );
 
300
        tabcontrol->subscribeEvent( CEGUI::Window::EventKeyDown, CEGUI::Event::Subscriber( &cMenu_Start::Window_Keydown, this ) );
297
301
 
298
302
        // Worlds
299
 
        Listbox *listbox_worlds = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_worlds" ));
 
303
        CEGUI::Listbox *listbox_worlds = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_worlds" ));
300
304
        
301
305
        // overworld names
302
 
        for( vector<cOverworld *>::iterator itr = pOverworld_manager->objects.begin(), itr_end = pOverworld_manager->objects.end(); itr != itr_end; ++itr )
 
306
        for( vector<cOverworld *>::iterator itr = pOverworld_Manager->objects.begin(), itr_end = pOverworld_Manager->objects.end(); itr != itr_end; ++itr )
303
307
        {
304
308
                cOverworld_description *world = (*itr)->description;
305
309
 
311
315
                }
312
316
#endif
313
317
                
314
 
                ListboxTextItem *item = new ListboxTextItem( world->name, 0 );
 
318
                CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( reinterpret_cast<const CEGUI::utf8*>(world->name.c_str()), 0 );
315
319
                // game world
316
320
                if( !world->user )
317
321
                {
318
 
                        item->setTextColours( colour( 1, 0.8f, 0.6f ) );
 
322
                        item->setTextColours( CEGUI::colour( 1, 0.8f, 0.6f ) );
319
323
                }
320
324
                // user world
321
325
                else
322
326
                {
323
 
                        item->setTextColours( colour( 0.8f, 1, 0.6f ) );
 
327
                        item->setTextColours( CEGUI::colour( 0.8f, 1, 0.6f ) );
324
328
                }
325
329
 
326
 
                item->setSelectionColours( colour( 0.33f, 0.33f, 0.33f ) );
 
330
                item->setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
327
331
                item->setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
328
332
                listbox_worlds->addItem( item );
329
333
        }
330
334
 
331
335
        // Level Listbox
332
 
        Listbox *listbox_levels = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_levels" ));
 
336
        CEGUI::Listbox *listbox_levels = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_levels" ));
333
337
        listbox_levels->setSortingEnabled( 1 );
334
338
 
335
339
        // get game level
336
 
        Get_Levels( DATA_DIR "/" GAME_LEVEL_DIR, colour( 1, 0.8f, 0.6f ) );
 
340
        Get_Levels( DATA_DIR "/" GAME_LEVEL_DIR, CEGUI::colour( 1, 0.8f, 0.6f ) );
337
341
        // get user level
338
 
        Get_Levels( user_data_dir + USER_LEVEL_DIR, colour( 0.8f, 1, 0.6f ) );
 
342
        Get_Levels( user_data_dir + USER_LEVEL_DIR, CEGUI::colour( 0.8f, 1, 0.6f ) );
339
343
 
340
344
        // World Listbox events
341
 
        listbox_worlds->subscribeEvent( Listbox::EventSelectionChanged, Event::Subscriber( &cMenu_Start::world_Select, this ) );
342
 
        listbox_worlds->subscribeEvent( Listbox::EventMouseDoubleClick, Event::Subscriber( &cMenu_Start::world_Select_final_list, this ) );
 
345
        listbox_worlds->subscribeEvent( CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber( &cMenu_Start::World_Select, this ) );
 
346
        listbox_worlds->subscribeEvent( CEGUI::Listbox::EventMouseDoubleClick, CEGUI::Event::Subscriber( &cMenu_Start::World_Select_final_list, this ) );
343
347
        // Level Listbox events
344
 
        listbox_levels->subscribeEvent( Listbox::EventSelectionChanged, Event::Subscriber( &cMenu_Start::level_Select, this ) );
345
 
        listbox_levels->subscribeEvent( Listbox::EventMouseDoubleClick, Event::Subscriber( &cMenu_Start::level_Select_final_list, this ) );
 
348
        listbox_levels->subscribeEvent( CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber( &cMenu_Start::Level_Select, this ) );
 
349
        listbox_levels->subscribeEvent( CEGUI::Listbox::EventMouseDoubleClick, CEGUI::Event::Subscriber( &cMenu_Start::Level_Select_Final_List, this ) );
346
350
        // Level Buttons
347
 
        PushButton *button_new = static_cast<PushButton *>(WindowManager::getSingleton().getWindow( "button_level_new" ));
348
 
        button_new->subscribeEvent( PushButton::EventClicked, Event::Subscriber( &cMenu_Start::Button_level_new_clicked, this ) );
349
 
        PushButton *button_edit = static_cast<PushButton *>(WindowManager::getSingleton().getWindow( "button_level_edit" ));
350
 
        button_edit->subscribeEvent( PushButton::EventClicked, Event::Subscriber( &cMenu_Start::Button_level_edit_clicked, this ) );
351
 
        PushButton *button_delete = static_cast<PushButton *>(WindowManager::getSingleton().getWindow( "button_level_delete" ));
352
 
        button_delete->subscribeEvent( PushButton::EventClicked, Event::Subscriber( &cMenu_Start::Button_level_delete_clicked, this ) );
 
351
        CEGUI::PushButton *button_new = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_level_new" ));
 
352
        button_new->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Start::Button_Level_New_Clicked, this ) );
 
353
        CEGUI::PushButton *button_edit = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_level_edit" ));
 
354
        button_edit->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Start::Button_Level_Edit_Clicked, this ) );
 
355
        CEGUI::PushButton *button_delete = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_level_delete" ));
 
356
        button_delete->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Start::Button_Level_Delete_Clicked, this ) );
353
357
 
354
358
        // select first Item
355
359
        listbox_worlds->setItemSelectState( (size_t)0, 1 );
356
360
 
357
361
        // Button Enter 
358
 
        PushButton *button_enter = static_cast<PushButton *>(WindowManager::getSingleton().getWindow( "button_enter" ));
 
362
        CEGUI::PushButton *button_enter = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_enter" ));
359
363
        // Button back
360
 
        PushButton *button_back = static_cast<PushButton *>(WindowManager::getSingleton().getWindow( "button_back" ));
 
364
        CEGUI::PushButton *button_back = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_back" ));
361
365
 
362
366
        // events
363
 
        button_enter->subscribeEvent( PushButton::EventClicked, Event::Subscriber( &cMenu_Start::Button_enter_clicked, this ) );
364
 
        button_back->subscribeEvent( PushButton::EventClicked, Event::Subscriber( &cMenu_Start::Button_back_clicked, this ) );
 
367
        button_enter->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Start::Button_Enter_Clicked, this ) );
 
368
        button_back->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Start::Button_Back_Clicked, this ) );
365
369
}
366
370
 
367
371
void cMenu_Start :: Update( void )
391
395
        Game_Action = GA_ENTER_MENU;
392
396
}
393
397
 
394
 
void cMenu_Start :: Get_Levels( string dir, colour color )
 
398
void cMenu_Start :: Get_Levels( string dir, CEGUI::colour color )
395
399
{
396
400
        // Level Listbox
397
 
        Listbox *listbox_levels = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_levels" ));
 
401
        CEGUI::Listbox *listbox_levels = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_levels" ));
398
402
 
399
403
        // get directory length for erasing
400
404
        int dir_length = dir.length() + 1;
401
405
        // get all files
402
 
        vector<string> lvl_files = Get_Directory_files( dir );
 
406
        vector<string> lvl_files = Get_Directory_Files( dir, "", 0, 0 );
403
407
 
404
408
        // list all available levels
405
409
        for( vector<string>::iterator itr = lvl_files.begin(), itr_end = lvl_files.end(); itr != itr_end; ++itr )
416
420
                }
417
421
 
418
422
                // check if item with the same name already exists
419
 
                ListboxItem *old_item = listbox_levels->findItemWithText( lvl_name, NULL );
 
423
                CEGUI::ListboxItem *old_item = listbox_levels->findItemWithText( lvl_name, NULL );
420
424
                // remove old item
421
425
                if( old_item )
422
426
                {
423
427
                        listbox_levels->removeItem( old_item );
424
428
                }
425
429
 
426
 
                ListboxTextItem *item = new ListboxTextItem( lvl_name, 0 );
 
430
                CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( reinterpret_cast<const CEGUI::utf8*>(lvl_name.c_str()), 0 );
427
431
 
428
432
                // smclvl
429
433
                if( lvl_name.rfind( ".txt" ) == string::npos )
433
437
                // grey out old txt levels
434
438
                else
435
439
                {
436
 
                        item->setTextColours( colour( 0.6f, 0.6f, 0.6f ) );
 
440
                        item->setTextColours( CEGUI::colour( 0.6f, 0.6f, 0.6f ) );
437
441
                }
438
442
 
439
 
                item->setSelectionColours( colour( 0.33f, 0.33f, 0.33f ) );
 
443
                item->setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
440
444
                item->setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
441
445
                listbox_levels->addItem( item );
442
446
        }
445
449
void cMenu_Start :: Load_Selected( void )
446
450
{
447
451
        // Get Tab Control
448
 
        TabControl *tabcontrol = static_cast<TabControl *>(WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
 
452
        CEGUI::TabControl *tabcontrol = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
449
453
 
450
454
        // World
451
455
        if( tabcontrol->getSelectedTabIndex() == 0 )
452
456
        {
453
 
                ListboxItem *item = (static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_worlds" )))->getFirstSelectedItem();
 
457
                CEGUI::ListboxItem *item = (static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_worlds" )))->getFirstSelectedItem();
454
458
 
455
459
                // load world
456
460
                if( item )
461
465
        // Level
462
466
        else
463
467
        {
464
 
                ListboxItem *item = (static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_levels" )))->getFirstSelectedItem();
 
468
                CEGUI::ListboxItem *item = (static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_levels" )))->getFirstSelectedItem();
465
469
 
466
470
                // load level
467
471
                if( item )
473
477
 
474
478
void cMenu_Start :: Load_World( string name )
475
479
{
476
 
        // if not successful
477
 
        if( !pOverworld_manager->Set_Active( name ) )
 
480
        cOverworld *new_world = pOverworld_Manager->Get_from_Name( name );
 
481
 
 
482
        // if not available
 
483
        if( !new_world )
478
484
        {
479
 
                debugdisplay->Set_Text( "Could not set Overworld active " + name, DESIRED_FPS );
 
485
                debugdisplay->Set_Text( _("Couldn't load overworld ") + name, static_cast<float>(speedfactor_fps) );
480
486
        }
481
487
        // if successfully set active
482
488
        else
483
489
        {
484
490
                // unload possible loaded level
485
 
                pLevel->Unload();
 
491
                pActive_Level->Unload();
486
492
                // enter world
487
493
                Game_Action = GA_ENTER_WORLD;
 
494
                Game_Action_Data.add( "world", name.c_str() );
488
495
        }
489
496
}
490
497
 
491
498
bool cMenu_Start :: Load_Level( string level_name )
492
499
{
493
500
        // if not available
494
 
        if( !pLevel->Get_path( level_name ) )
 
501
        if( !pActive_Level->Get_Path( level_name ) )
495
502
        {
496
 
                pAudio->PlaySound( "error.ogg" );
497
 
                debugdisplay->Set_Text( "Couldn't load level " + level_name, DESIRED_FPS );
 
503
                pAudio->Play_Sound( "error.ogg" );
 
504
                debugdisplay->Set_Text( _("Couldn't load level ") + level_name, static_cast<float>(speedfactor_fps) );
498
505
                return 0;
499
506
        }
500
507
 
506
513
        return 1;
507
514
}
508
515
 
509
 
bool cMenu_Start :: window_keydown( const EventArgs &e )
 
516
bool cMenu_Start :: Window_Keydown( const CEGUI::EventArgs &e )
510
517
{
511
 
        const KeyEventArgs &ke = static_cast<const KeyEventArgs &>(e);
 
518
        const CEGUI::KeyEventArgs &ke = static_cast<const CEGUI::KeyEventArgs &>(e);
512
519
 
513
520
        // Return
514
 
        if( ke.scancode == Key::Return || ke.scancode == Key::NumpadEnter )
 
521
        if( ke.scancode == CEGUI::Key::Return || ke.scancode == CEGUI::Key::NumpadEnter )
515
522
        {
516
523
                Load_Selected();
517
524
 
518
525
                return 1;
519
526
        }
520
527
        // Shift Tab
521
 
        else if( ( pKeyboard->keys[SDLK_LSHIFT] || pKeyboard->keys[SDLK_RSHIFT] ) && ke.scancode == Key::Tab )
 
528
        else if( ( pKeyboard->keys[SDLK_LSHIFT] || pKeyboard->keys[SDLK_RSHIFT] ) && ke.scancode == CEGUI::Key::Tab )
522
529
        {
523
530
                // Get Tab Control
524
 
                TabControl *tabcontrol = static_cast<TabControl *>(WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
 
531
                CEGUI::TabControl *tabcontrol = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
525
532
 
526
533
                // if last tab
527
534
                if( tabcontrol->getSelectedTabIndex() + 1 == tabcontrol->getTabCount() )
533
540
                {
534
541
                        tabcontrol->setSelectedTabAtIndex( tabcontrol->getSelectedTabIndex() + 1 );
535
542
                }
 
543
 
 
544
                return 1;
536
545
        }
537
 
        // Tab
538
 
        else if( ke.scancode == Key::ArrowDown || ke.scancode == Key::ArrowUp )
 
546
        // Down/Up
 
547
        else if( ke.scancode == CEGUI::Key::ArrowDown || ke.scancode == CEGUI::Key::ArrowUp || ke.scancode == CEGUI::Key::PageDown || ke.scancode == CEGUI::Key::PageUp ||
 
548
                         ke.scancode == CEGUI::Key::Home || ke.scancode == CEGUI::Key::End )
539
549
        {
540
550
                // Get Tab Control
541
 
                TabControl *tabcontrol = static_cast<TabControl *>(WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
 
551
                CEGUI::TabControl *tabcontrol = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
542
552
 
543
553
                // Items Listbox
544
 
                Listbox *listbox;
 
554
                CEGUI::Listbox *listbox;
545
555
 
546
556
                // World
547
557
                if( tabcontrol->getSelectedTabIndex() == 0 )
548
558
                {
549
 
                        listbox = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_worlds" ));
 
559
                        listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_worlds" ));
550
560
                }
551
561
                // Level
552
562
                else
553
563
                {
554
 
                        listbox = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_levels" ));
555
 
                }
556
 
 
557
 
                
558
 
                ListboxItem *new_selected = NULL;
559
 
 
560
 
                // if none selected
561
 
                if( listbox->getSelectedCount() == 0 )
562
 
                {
563
 
                        new_selected = listbox->getListboxItemFromIndex( 0 );
564
 
                }
565
 
                else
566
 
                {
567
 
                        unsigned int selected = listbox->getItemIndex( listbox->getFirstSelectedItem() );
568
 
 
569
 
                        // last item selected
570
 
                        if( ke.scancode == Key::ArrowDown && selected == listbox->getItemCount() - 1 )
571
 
                        {
572
 
                                new_selected = listbox->getListboxItemFromIndex( 0 );
573
 
                        }
574
 
                        // first item selected
575
 
                        else if( ke.scancode == Key::ArrowUp && selected == 0 )
576
 
                        {
577
 
                                new_selected = listbox->getListboxItemFromIndex( listbox->getItemCount() - 1 );
578
 
                        }
579
 
                        // select next item
580
 
                        else
581
 
                        {
582
 
                                if( ke.scancode == Key::ArrowDown )
583
 
                                {
584
 
                                        new_selected = listbox->getListboxItemFromIndex( selected + 1 );
585
 
                                }
586
 
                                // up
587
 
                                else
588
 
                                {
589
 
                                        new_selected = listbox->getListboxItemFromIndex( selected - 1 );
590
 
                                }
591
 
                        }
592
 
                }
593
 
                
 
564
                        listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_levels" ));
 
565
                }
 
566
 
 
567
                
 
568
                int new_selected = 0;
 
569
                int last_selected = 0;
 
570
 
 
571
                // get selected item
 
572
                CEGUI::ListboxItem *last_selected_item = listbox->getFirstSelectedItem();
 
573
 
 
574
                // if something is selected
 
575
                if( last_selected_item != NULL )
 
576
                {
 
577
                        last_selected = listbox->getItemIndex( last_selected_item );
 
578
                }
 
579
 
 
580
                // down
 
581
                if( ke.scancode == CEGUI::Key::ArrowDown )
 
582
                {
 
583
                        new_selected = last_selected + 1;
 
584
                }
 
585
                // up
 
586
                else if( ke.scancode == CEGUI::Key::ArrowUp )
 
587
                {
 
588
                        new_selected = last_selected - 1;
 
589
                }
 
590
                // page down
 
591
                else if( ke.scancode == CEGUI::Key::PageDown )
 
592
                {
 
593
                        // todo : should skip all visible items
 
594
                        new_selected = last_selected + 10;
 
595
                }
 
596
                // page up
 
597
                else if( ke.scancode == CEGUI::Key::PageUp )
 
598
                {
 
599
                        // todo : should skip all visible items
 
600
                        new_selected = last_selected - 10;
 
601
                }
 
602
                // home
 
603
                else if( ke.scancode == CEGUI::Key::Home )
 
604
                {
 
605
                        new_selected = 0;
 
606
                }
 
607
                // end
 
608
                else if( ke.scancode == CEGUI::Key::End )
 
609
                {
 
610
                        new_selected = listbox->getItemCount() - 1;
 
611
                }
 
612
 
 
613
                // if after last item
 
614
                if( new_selected >= static_cast<int>(listbox->getItemCount()) )
 
615
                {
 
616
                        // select first
 
617
                        if( last_selected == static_cast<int>(listbox->getItemCount()) - 1 )
 
618
                        {
 
619
                                new_selected = 0;
 
620
                        }
 
621
                        // select last
 
622
                        else
 
623
                        {
 
624
                                new_selected = listbox->getItemCount() - 1;
 
625
                        }
 
626
                }
 
627
                // if before first item
 
628
                else if( new_selected < 0 )
 
629
                {
 
630
                        // select last
 
631
                        if( last_selected == 0 )
 
632
                        {
 
633
                                new_selected = listbox->getItemCount() - 1;
 
634
                        }
 
635
                        // select first
 
636
                        else
 
637
                        {
 
638
                                new_selected = 0;
 
639
                        }
 
640
                }
 
641
 
594
642
                listbox->setItemSelectState( new_selected, 1 );
595
643
                listbox->ensureItemIsVisible( new_selected );
 
644
 
 
645
                return 1;
596
646
        }
597
647
 
598
648
        return 0;
599
649
}
600
650
 
601
 
bool cMenu_Start :: world_Select( const EventArgs &event )
 
651
bool cMenu_Start :: World_Select( const CEGUI::EventArgs &event )
602
652
{
603
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
604
 
        ListboxItem *item = static_cast<Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
 
653
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
654
        CEGUI::ListboxItem *item = static_cast<CEGUI::Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
605
655
 
606
656
        // World Comment
607
 
        Editbox *editbox_world_comment = static_cast<Editbox *>(WindowManager::getSingleton().getWindow( "editbox_world_comment" ));
 
657
        CEGUI::Editbox *editbox_world_comment = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_world_comment" ));
608
658
 
609
659
        // set world comment
610
660
        if( item )
611
661
        {
612
 
                editbox_world_comment->setText( pOverworld_manager->Get_from_Name( item->getText().c_str() )->description->comment );
 
662
                editbox_world_comment->setText( reinterpret_cast<const CEGUI::utf8*>(pOverworld_Manager->Get_from_Name( item->getText().c_str() )->description->comment.c_str()) );
613
663
        }
614
664
        // clear
615
665
        else
620
670
        return 1;
621
671
}
622
672
 
623
 
bool cMenu_Start :: world_Select_final_list( const EventArgs &event )
 
673
bool cMenu_Start :: World_Select_final_list( const CEGUI::EventArgs &event )
624
674
{
625
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
626
 
        ListboxItem *item = static_cast<Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
 
675
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
676
        CEGUI::ListboxItem *item = static_cast<CEGUI::Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
627
677
 
628
678
        // load world
629
679
        if( item )
634
684
        return 1;
635
685
}
636
686
 
637
 
bool cMenu_Start :: level_Select( const EventArgs &event )
 
687
bool cMenu_Start :: Level_Select( const CEGUI::EventArgs &event )
638
688
{
639
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
640
 
        ListboxItem *item = static_cast<Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
 
689
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
690
        CEGUI::ListboxItem *item = static_cast<CEGUI::Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
641
691
 
642
692
        // set level something
643
693
        if( item )
653
703
        return 1;
654
704
}
655
705
 
656
 
bool cMenu_Start :: level_Select_final_list( const EventArgs &event )
 
706
bool cMenu_Start :: Level_Select_Final_List( const CEGUI::EventArgs &event )
657
707
{
658
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
659
 
        ListboxItem *item = static_cast<Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
 
708
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
709
        CEGUI::ListboxItem *item = static_cast<CEGUI::Listbox *>( windowEventArgs.window )->getFirstSelectedItem();
660
710
 
661
711
        // load level
662
712
        if( item )
668
718
}
669
719
 
670
720
 
671
 
bool cMenu_Start :: Button_level_new_clicked( const EventArgs &event )
 
721
bool cMenu_Start :: Button_Level_New_Clicked( const CEGUI::EventArgs &event )
672
722
{
673
723
        // Create level
674
724
        if( !pLevel_Editor->Function_New() )
684
734
        return 1;
685
735
}
686
736
 
687
 
bool cMenu_Start :: Button_level_edit_clicked( const EventArgs &event )
 
737
bool cMenu_Start :: Button_Level_Edit_Clicked( const CEGUI::EventArgs &event )
688
738
{
689
739
        // Get Selected Level
690
 
        Listbox *listbox_levels = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_levels" ));
691
 
        ListboxItem *item = listbox_levels->getFirstSelectedItem();
 
740
        CEGUI::Listbox *listbox_levels = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_levels" ));
 
741
        CEGUI::ListboxItem *item = listbox_levels->getFirstSelectedItem();
692
742
 
693
743
        // load level
694
744
        if( item && Load_Level( item->getText().c_str() ) )
699
749
        return 1;
700
750
}
701
751
 
702
 
bool cMenu_Start :: Button_level_delete_clicked( const EventArgs &event )
 
752
bool cMenu_Start :: Button_Level_Delete_Clicked( const CEGUI::EventArgs &event )
703
753
{
704
754
        // Get Selected Level
705
 
        Listbox *listbox_levels = static_cast<Listbox *>(WindowManager::getSingleton().getWindow( "listbox_levels" ));
706
 
        ListboxItem *item = listbox_levels->getFirstSelectedItem();
 
755
        CEGUI::Listbox *listbox_levels = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_levels" ));
 
756
        CEGUI::ListboxItem *item = listbox_levels->getFirstSelectedItem();
707
757
 
708
758
        // load level
709
759
        if( item )
711
761
                string filename = item->getText().c_str();
712
762
 
713
763
                // if denied
714
 
                if( !Box_Question( "Delete " + filename + " ?" ) )
 
764
                if( !Box_Question( _("Delete ") + filename + " ?" ) )
715
765
                {
716
766
                        return 1;
717
767
                }
718
768
 
719
769
                // only user directory
720
 
                if( pLevel->Get_path( filename, 1 ) )
 
770
                if( pActive_Level->Get_Path( filename, 1 ) )
721
771
                {
722
 
                        Delete_file( filename );
 
772
                        Delete_File( filename );
723
773
                        listbox_levels->removeItem( item );
724
774
                }
725
775
        }
727
777
        return 1;
728
778
}
729
779
 
730
 
bool cMenu_Start :: Button_enter_clicked( const EventArgs &event )
 
780
bool cMenu_Start :: Button_Enter_Clicked( const CEGUI::EventArgs &event )
731
781
{
732
782
        Load_Selected();
733
783
        return 1;
734
784
}
735
785
 
736
 
bool cMenu_Start :: Button_back_clicked( const EventArgs &event )
 
786
bool cMenu_Start :: Button_Back_Clicked( const CEGUI::EventArgs &event )
737
787
{
738
788
        Exit();
739
789
        return 1;
759
809
        cMenu_Item *temp_item = NULL;
760
810
        menu_posy = 210;
761
811
 
762
 
        GL_Surface *back1 = pFont->RenderText( pFont->font_normal, "Back", text_color );
 
812
        GL_Surface *back1 = pFont->Render_Text( pFont->font_normal, _("Back"), text_color );
763
813
 
764
814
        // Game
765
815
        temp_item = new cMenu_Item();
766
816
        temp_item = pMenuCore->Auto_Menu( "game.png", "", menu_posy );
767
817
        temp_item->Set_Scale( 0.7f );
768
 
        temp_item->Set_PosX( GAME_RES_W / 20, 1 );
769
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
818
        temp_item->Set_Pos_X( game_res_w * 0.05f, 1 );
 
819
        pMenuCore->handler->Add_Menu_Item( temp_item );
770
820
        // Video
771
821
        menu_posy += 60;
772
822
        temp_item = new cMenu_Item();
773
823
        temp_item = pMenuCore->Auto_Menu( "video.png", "", menu_posy );
774
 
        temp_item->Set_PosX( GAME_RES_W / 20, 1 );
775
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
824
        temp_item->Set_Pos_X( game_res_w * 0.05f, 1 );
 
825
        pMenuCore->handler->Add_Menu_Item( temp_item );
776
826
        // Audio
777
827
        menu_posy += 60;
778
828
        temp_item = new cMenu_Item();
779
829
        temp_item = pMenuCore->Auto_Menu( "audio.png", "", menu_posy );
780
 
        temp_item->Set_PosX( GAME_RES_W / 20, 1 );
781
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
830
        temp_item->Set_Pos_X( game_res_w * 0.05f, 1 );
 
831
        pMenuCore->handler->Add_Menu_Item( temp_item );
782
832
        // Controls
783
833
        menu_posy += 60;
784
834
        temp_item = new cMenu_Item();
785
835
        temp_item = pMenuCore->Auto_Menu( "controls.png", "", menu_posy );
786
 
        temp_item->Set_PosX( GAME_RES_W / 20, 1 );
787
 
        pMenuCore->handler->Add_MenuItem( temp_item );
 
836
        temp_item->Set_Pos_X( game_res_w * 0.05f, 1 );
 
837
        pMenuCore->handler->Add_Menu_Item( temp_item );
788
838
        // back
789
839
        temp_item = new cMenu_Item();
790
840
        temp_item->image_default->Set_Image( back1 );
791
 
        temp_item->Set_Pos( GAME_RES_W / 20 + 25, 450 );
 
841
        temp_item->Set_Pos( game_res_w * 0.11f, 450 );
792
842
        temp_item->isquit = 1;
793
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
 
843
        pMenuCore->handler->Add_Menu_Item( temp_item, 1.5f, grey );
794
844
 
795
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/options.png" ), GAME_RES_W / 20, 140, 0 ) );
 
845
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/options.png" ), game_res_w * 0.01f, 140, 0 ) );
796
846
        drawlist.push_back( new cHudSprite( back1, -200, 0, 1 ) );
797
847
}
798
848
 
885
935
        cMenu_Item *temp_item = NULL;
886
936
 
887
937
        layout_file = "menu_game.layout";
888
 
        menu_posy = 220;
889
 
 
890
 
        GL_Surface *controls_always_run = pFont->RenderText( pFont->font_normal, "Always Run", text_color );
891
 
        GL_Surface *game_camera_hor_speed = pFont->RenderText( pFont->font_normal, "Camera Hor Speed", text_color );
892
 
        GL_Surface *game_camera_ver_speed = pFont->RenderText( pFont->font_normal, "Camera Ver Speed", text_color );
893
 
 
894
 
        // always run
895
 
        temp_item = new cMenu_Item();
896
 
        temp_item->image_default->Set_Image( controls_always_run );
897
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
898
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
899
 
        drawlist.push_back( new cHudSprite( controls_always_run, -200, 0, 1 ) );
900
 
 
901
 
        // Camera Horizontal Speed
902
 
        menu_posy += 40;
903
 
        temp_item = new cMenu_Item();
904
 
        temp_item->image_default->Set_Image( game_camera_hor_speed );
905
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
906
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
907
 
        drawlist.push_back( new cHudSprite( game_camera_hor_speed, -200, 0, 1 ) );
908
 
        // Camera Vertical Speed
909
 
        menu_posy += 30;
910
 
        temp_item = new cMenu_Item();
911
 
        temp_item->image_default->Set_Image( game_camera_ver_speed );
912
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
913
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
914
 
        drawlist.push_back( new cHudSprite( game_camera_ver_speed, -200, 0, 1 ) );
915
 
 
916
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/game.png" ), GAME_RES_W * 0.47f, 140 ) );
917
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/game.png" ), GAME_RES_W / 2.6f, 140 ) );
 
938
 
 
939
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/game.png" ), game_res_w * 0.5f, game_res_h * 0.1f ) );
 
940
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/game.png" ), game_res_w * 0.4f, game_res_h * 0.1f ) );
918
941
 
919
942
        pMenuCore->handler->Set_Active( MENU_GAME );
920
943
 
926
949
        cMenu_Options::Init_GUI();
927
950
 
928
951
        // get the CEGUI window manager
929
 
        WindowManager &windowmanager = WindowManager::getSingleton();
 
952
        CEGUI::WindowManager &windowmanager = CEGUI::WindowManager::getSingleton();
930
953
 
931
954
        // always run
932
 
        Combobox *combo_always_run = static_cast<Combobox *>(windowmanager.getWindow( "combo_always_run" ));
 
955
        CEGUI::Combobox *combo_always_run = static_cast<CEGUI::Combobox *>(windowmanager.getWindow( "combo_always_run" ));
933
956
 
934
 
        ListboxTextItem *item = new ListboxTextItem( "On", 0 );
935
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
957
        CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( UTF8_("On"), 0 );
 
958
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
936
959
        combo_always_run->addItem( item );
937
 
        item = new ListboxTextItem( "Off", 1 );
938
 
        item->setTextColours( colour( 0, 0, 1 ) );
 
960
        item = new CEGUI::ListboxTextItem( UTF8_("Off"), 1 );
 
961
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
939
962
        combo_always_run->addItem( item );
940
963
 
941
964
        if( pPreferences->always_run )
942
965
        {
943
 
                combo_always_run->setText( "On" );
 
966
                combo_always_run->setText( UTF8_("On") );
944
967
        }
945
968
        else
946
969
        {
947
 
                combo_always_run->setText( "Off" );
 
970
                combo_always_run->setText( UTF8_("Off") );
948
971
        }
949
972
 
950
 
        combo_always_run->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Game::always_run_Select, this ) );
 
973
        combo_always_run->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Game::Always_Run_Select, this ) );
951
974
 
952
975
        // Camera Horizontal Speed
953
 
        Spinner *spinner_camera_hor_speed = static_cast<Spinner *>(windowmanager.getWindow( "spinner_camera_hor_speed" ));
954
 
        spinner_camera_hor_speed->setCurrentValue( pCamera->hor_offset_speed );
 
976
        CEGUI::Spinner *spinner_camera_hor_speed = static_cast<CEGUI::Spinner *>(windowmanager.getWindow( "spinner_camera_hor_speed" ));
 
977
        spinner_camera_hor_speed->setCurrentValue( pLevel_Manager->camera->hor_offset_speed );
955
978
 
956
 
        spinner_camera_hor_speed->subscribeEvent( Spinner::EventValueChanged, Event::Subscriber( &cMenu_Options_Game::camera_hor_Select, this ) );
 
979
        spinner_camera_hor_speed->subscribeEvent( CEGUI::Spinner::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Game::Camera_Hor_Select, this ) );
957
980
 
958
981
        // Camera Vertical Speed
959
 
        Spinner *spinner_camera_ver_speed = static_cast<Spinner *>(windowmanager.getWindow( "spinner_camera_ver_speed" ));
960
 
        spinner_camera_ver_speed->setCurrentValue( pCamera->ver_offset_speed );
961
 
 
962
 
        spinner_camera_ver_speed->subscribeEvent( Spinner::EventValueChanged, Event::Subscriber( &cMenu_Options_Game::camera_ver_Select, this ) );
 
982
        CEGUI::Spinner *spinner_camera_ver_speed = static_cast<CEGUI::Spinner *>(windowmanager.getWindow( "spinner_camera_ver_speed" ));
 
983
        spinner_camera_ver_speed->setCurrentValue( pLevel_Manager->camera->ver_offset_speed );
 
984
 
 
985
        spinner_camera_ver_speed->subscribeEvent( CEGUI::Spinner::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Game::Camera_Ver_Select, this ) );
 
986
 
 
987
        // language
 
988
        CEGUI::Combobox *combo_language = static_cast<CEGUI::Combobox *>(windowmanager.getWindow( "combo_language" ));
 
989
 
 
990
        item = new CEGUI::ListboxTextItem( UTF8_("default"), 0 );
 
991
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
 
992
        combo_language->addItem( item );
 
993
 
 
994
        // get available languages
 
995
        vector<string> language_files = Get_Directory_Files( DATA_DIR "/" GAME_TRANSLATION_DIR, ".none", 1, 0 );
 
996
        // add english as it is the base language and not in the translation directory
 
997
        language_files.push_back( DATA_DIR "/" GAME_TRANSLATION_DIR "/" "en" );
 
998
 
 
999
        for( vector<string>::iterator itr = language_files.begin(), itr_end = language_files.end(); itr != itr_end; ++itr )
 
1000
        {
 
1001
                // get filename
 
1002
                string filename = (*itr);
 
1003
 
 
1004
                // if not directory
 
1005
                if( filename.rfind( "." ) != string::npos )
 
1006
                {
 
1007
                        continue;
 
1008
                }
 
1009
 
 
1010
                // remove data dir
 
1011
                filename.erase( 0, strlen( DATA_DIR "/" GAME_TRANSLATION_DIR "/" ) );
 
1012
 
 
1013
                item = new CEGUI::ListboxTextItem( filename, 1 );
 
1014
                item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
 
1015
                combo_language->addItem( item );
 
1016
        }
 
1017
 
 
1018
        if( pPreferences->language.empty() )
 
1019
        {
 
1020
                combo_language->setText( UTF8_("default") );
 
1021
        }
 
1022
        else
 
1023
        {
 
1024
                combo_language->setText( pPreferences->language );
 
1025
        }
 
1026
 
 
1027
        combo_language->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Game::Language_Select, this ) );
963
1028
}
964
1029
 
965
1030
void cMenu_Options_Game :: Update( void )
984
1049
        // always run
985
1050
        if( pMenuCore->handler->active == 5 )
986
1051
        {
987
 
                // todo : handle joy init failed
988
1052
                pPreferences->always_run = !pPreferences->always_run;
989
1053
 
990
1054
                if( pPreferences->always_run )
991
1055
                {
992
 
                        WindowManager::getSingleton().getWindow( "combo_always_run" )->setText( "On" );
 
1056
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_always_run" )->setText( UTF8_("On") );
993
1057
                }
994
1058
                else
995
1059
                {
996
 
                        WindowManager::getSingleton().getWindow( "combo_always_run" )->setText( "Off" );
 
1060
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_always_run" )->setText( UTF8_("Off") );
997
1061
                }
998
1062
        }
999
1063
        // Camera Horizontal
1006
1070
        {
1007
1071
                // nothing
1008
1072
        }
 
1073
        // language
 
1074
        if( pMenuCore->handler->active == 8 )
 
1075
        {
 
1076
                CEGUI::Combobox *combo_language = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_language" ));
 
1077
                unsigned int selected = combo_language->getItemIndex( combo_language->findItemWithText( combo_language->getText(), NULL ) );
 
1078
 
 
1079
                CEGUI::ListboxItem *new_selected = NULL;
 
1080
 
 
1081
                // last item selected
 
1082
                if( selected == combo_language->getItemCount() - 1 )
 
1083
                {
 
1084
                        new_selected = combo_language->getListboxItemFromIndex( 0 );
 
1085
                }
 
1086
                // select next item
 
1087
                else
 
1088
                {
 
1089
                        new_selected = combo_language->getListboxItemFromIndex( selected + 1 );
 
1090
                }
 
1091
                
 
1092
                combo_language->setText( new_selected->getText() );
 
1093
                combo_language->setItemSelectState( new_selected, 1 );
 
1094
                Language_Select( CEGUI::WindowEventArgs( combo_language ) );
 
1095
        }
1009
1096
}
1010
1097
 
1011
1098
void cMenu_Options_Game :: Draw( void )
1014
1101
        Draw_End();
1015
1102
}
1016
1103
 
1017
 
bool cMenu_Options_Game :: always_run_Select( const EventArgs &event )
 
1104
bool cMenu_Options_Game :: Always_Run_Select( const CEGUI::EventArgs &event )
1018
1105
{
1019
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1020
 
        ListboxItem *item = static_cast<Combobox*>( windowEventArgs.window )->getSelectedItem();
 
1106
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1107
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox*>( windowEventArgs.window )->getSelectedItem();
1021
1108
 
1022
1109
        bool always_run = 0;
1023
1110
 
1024
 
        if( item->getText().compare( "On" ) == 0 )
 
1111
        if( item->getText().compare( UTF8_("On") ) == 0 )
1025
1112
        {
1026
1113
                always_run = 1;
1027
1114
        }
1031
1118
        return 1;
1032
1119
}
1033
1120
 
1034
 
bool cMenu_Options_Game :: camera_hor_Select( const EventArgs &event )
1035
 
{
1036
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1037
 
        Spinner *spinner_camera_hor = static_cast<Spinner*>( windowEventArgs.window );
1038
 
        
1039
 
        pCamera->hor_offset_speed = spinner_camera_hor->getCurrentValue();
1040
 
 
1041
 
        return 1;
1042
 
}
1043
 
 
1044
 
bool cMenu_Options_Game :: camera_ver_Select( const EventArgs &event )
1045
 
{
1046
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1047
 
        Spinner *spinner_camera_ver = static_cast<Spinner*>( windowEventArgs.window );
1048
 
        
1049
 
        pCamera->ver_offset_speed = spinner_camera_ver->getCurrentValue();
 
1121
bool cMenu_Options_Game :: Camera_Hor_Select( const CEGUI::EventArgs &event )
 
1122
{
 
1123
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1124
        CEGUI::Spinner *spinner_camera_hor = static_cast<CEGUI::Spinner *>( windowEventArgs.window );
 
1125
        
 
1126
        pLevel_Manager->camera->hor_offset_speed = spinner_camera_hor->getCurrentValue();
 
1127
        pPreferences->camera_hor_speed = spinner_camera_hor->getCurrentValue();
 
1128
 
 
1129
        return 1;
 
1130
}
 
1131
 
 
1132
bool cMenu_Options_Game :: Camera_Ver_Select( const CEGUI::EventArgs &event )
 
1133
{
 
1134
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1135
        CEGUI::Spinner *spinner_camera_ver = static_cast<CEGUI::Spinner *>( windowEventArgs.window );
 
1136
        
 
1137
        pLevel_Manager->camera->ver_offset_speed = spinner_camera_ver->getCurrentValue();
 
1138
        pPreferences->camera_ver_speed = spinner_camera_ver->getCurrentValue();
 
1139
 
 
1140
        return 1;
 
1141
}
 
1142
 
 
1143
bool cMenu_Options_Game :: Language_Select( const CEGUI::EventArgs &event )
 
1144
{
 
1145
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1146
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox*>( windowEventArgs.window )->getSelectedItem();
 
1147
 
 
1148
        // default
 
1149
        if( item->getText().compare( UTF8_("default") ) == 0 )
 
1150
        {
 
1151
                pPreferences->language = "";
 
1152
        }
 
1153
        // force
 
1154
        else
 
1155
        {
 
1156
                pPreferences->language = item->getText().c_str();
 
1157
        }
1050
1158
 
1051
1159
        return 1;
1052
1160
}
1056
1164
cMenu_Options_Video :: cMenu_Options_Video( void )
1057
1165
: cMenu_Options()
1058
1166
{
1059
 
        fullscreen = new cHudSprite();
 
1167
 
1060
1168
}
1061
1169
 
1062
1170
cMenu_Options_Video :: ~cMenu_Options_Video( void )
1063
1171
{
1064
 
        delete fullscreen;
 
1172
 
1065
1173
}
1066
1174
 
1067
1175
void cMenu_Options_Video :: Init( void )
1068
1176
{
1069
1177
        cMenu_Options::Init();
1070
1178
 
1071
 
        // Fullscreen
1072
 
        fullscreen->Set_Image( pVideo->Get_Surface( "menu/items/fullscreen.png" ), 1 );
1073
 
 
1074
 
        cMenu_Item *temp_item = NULL;
1075
 
 
1076
1179
        layout_file = "menu_video.layout";
1077
 
        menu_posy = 220;
1078
 
 
1079
 
        GL_Surface *video_resolution = pFont->RenderText( pFont->font_normal, "Resolution", text_color );
1080
 
        GL_Surface *video_bpp = pFont->RenderText( pFont->font_normal, "Bpp", text_color );
1081
 
        GL_Surface *video_fullscreen = pFont->RenderText( pFont->font_normal, "Fullscreen", text_color );
1082
 
        GL_Surface *video_vsync = pFont->RenderText( pFont->font_normal, "VSync", text_color );
1083
 
        GL_Surface *video_apply = pFont->RenderText( pFont->font_normal, "Apply", text_color );
1084
 
 
1085
 
        // Resolution
1086
 
        temp_item = new cMenu_Item();
1087
 
        temp_item->image_default->Set_Image( video_resolution );
1088
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1089
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1090
 
        drawlist.push_back( new cHudSprite( video_resolution, -200, 0, 1 ) );
1091
 
        // Bpp
1092
 
        temp_item = new cMenu_Item();
1093
 
        menu_posy += 50;
1094
 
        temp_item->image_default->Set_Image( video_bpp );
1095
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1096
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1097
 
        drawlist.push_back( new cHudSprite( video_bpp, -200, 0, 1 ) );
1098
 
        // Fullscreen
1099
 
        temp_item = new cMenu_Item();
1100
 
        menu_posy += 50;
1101
 
        temp_item->image_default->Set_Image( video_fullscreen );
1102
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1103
 
        fullscreen->Set_Pos( GAME_RES_W / 1.8f + fullscreen->col_rect.w + 50, menu_posy - 5 );
1104
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1105
 
        drawlist.push_back( new cHudSprite( video_fullscreen, -200, 0, 1 ) );
1106
 
        // VSync
1107
 
        temp_item = new cMenu_Item();
1108
 
        menu_posy += 50;
1109
 
        temp_item->image_default->Set_Image( video_vsync );
1110
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1111
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1112
 
        drawlist.push_back( new cHudSprite( video_vsync, -200, 0, 1 ) );
1113
 
        // Apply
1114
 
        temp_item = new cMenu_Item();
1115
 
        menu_posy += 50;
1116
 
        temp_item->image_default->Set_Image( video_apply );
1117
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1118
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1119
 
        drawlist.push_back( new cHudSprite( video_apply, -200, 0, 1 ) );
 
1180
 
1120
1181
 
1121
1182
        // Video Info
1122
1183
        vid_w = pPreferences->video_screen_w;
1124
1185
        vid_bpp = pPreferences->video_screen_bpp;
1125
1186
        vid_fullscreen = pPreferences->video_fullscreen;
1126
1187
        vid_vsync = pPreferences->video_vsync;
 
1188
        vid_geometry_detail = pVideo->geometry_detail;
 
1189
        vid_texture_detail = pVideo->texture_detail;
1127
1190
 
1128
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/video.png" ), GAME_RES_W * 0.47f, 140 ) );
1129
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/video.png" ), GAME_RES_W / 2.6f, 140 ) );
 
1191
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/video.png" ), game_res_w * 0.5f, game_res_h * 0.1f ) );
 
1192
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/video.png" ), game_res_w * 0.4f, game_res_h * 0.1f ) );
1130
1193
 
1131
1194
        pMenuCore->handler->Set_Active( MENU_VIDEO );
1132
1195
 
1138
1201
        cMenu_Options::Init_GUI();
1139
1202
 
1140
1203
        // Resolution
1141
 
        Combobox *combo_resolution = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_resolution" ));
1142
 
 
1143
 
        ListboxTextItem *item = new ListboxTextItem( "640x480", 1 );
1144
 
        item->setTextColours( colour( 1, 0, 0 ) );
1145
 
        combo_resolution->addItem( item );
1146
 
        item = new ListboxTextItem( "800x600", 2 );
1147
 
        item->setTextColours( colour( 1, 1, 0 ) );
1148
 
        combo_resolution->addItem( item );
1149
 
        item = new ListboxTextItem( "1024x768", 2 );
1150
 
        item->setTextColours( colour( 0, 1, 0 ) );
1151
 
        combo_resolution->addItem( item );
1152
 
        item = new ListboxTextItem( "1280x1024", 3 );
1153
 
        item->setTextColours( colour( 0.1f, 0.5f, 0.9f ) );
1154
 
        combo_resolution->addItem( item );
1155
 
        item = new ListboxTextItem( "1600x1200", 4 );
1156
 
        item->setTextColours( colour( 0.5f, 0.8f, 1 ) );
1157
 
        combo_resolution->addItem( item );
1158
 
        item = new ListboxTextItem( "2048x1536", 5 );
1159
 
        item->setTextColours( colour( 0.8f, 0.2f, 0.9f ) );
1160
 
        combo_resolution->addItem( item );
 
1204
        CEGUI::Combobox *combo_resolution = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_resolution" ));
 
1205
 
 
1206
        vector<cSize_Int> valid_resolutions = pVideo->Get_Supported_Resolutions();
 
1207
 
 
1208
        CEGUI::ListboxTextItem *item;
 
1209
 
 
1210
        // add to listbox
 
1211
        for( vector<cSize_Int>::iterator itr = valid_resolutions.begin(), itr_end = valid_resolutions.end(); itr != itr_end; ++itr )
 
1212
        {
 
1213
                // get resolution
 
1214
                cSize_Int res = (*itr);
 
1215
 
 
1216
                if( res.m_width <= 0 || res.m_height <= 0 )
 
1217
                {
 
1218
                        continue;
 
1219
                }
 
1220
 
 
1221
                // calculate aspect ratio
 
1222
                float ar = static_cast<float>(res.m_width) / static_cast<float>(res.m_height);
 
1223
 
 
1224
                item = new CEGUI::ListboxTextItem( int_to_string( res.m_width ) + "x" + int_to_string( res.m_height ), 3 );
 
1225
                CEGUI::colour color( 0, 0, 0 );
 
1226
                // if badly stretched resolution display it in red
 
1227
                if( ar < 1.1f || ar > 1.5f )
 
1228
                {
 
1229
                        color.setGreen( 0 );
 
1230
                        color.setRed( 1 );
 
1231
                }
 
1232
                // good resolution
 
1233
                else
 
1234
                {
 
1235
                        // calculate difference from a default 1.333 resolution
 
1236
                        float diff_from_default;
 
1237
 
 
1238
                        if( ar > 1.333f )
 
1239
                        {
 
1240
                                diff_from_default = ( ar - 1.333f ) * 4;
 
1241
                        }
 
1242
                        else
 
1243
                        {
 
1244
                                diff_from_default = -( ar - 1.333f ) * 4;
 
1245
                        }
 
1246
 
 
1247
                        color.setGreen( 1 - diff_from_default );
 
1248
                        color.setRed( diff_from_default );
 
1249
                }
 
1250
                item->setTextColours( color );
 
1251
                combo_resolution->addItem( item );
 
1252
        }
1161
1253
 
1162
1254
        string temp = int_to_string( pPreferences->video_screen_w ) + "x" + int_to_string( pPreferences->video_screen_h );
1163
1255
        combo_resolution->setText( temp.c_str() );
1164
1256
 
1165
 
        combo_resolution->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Video::res_Select, this ) );
 
1257
        combo_resolution->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Video::Res_Select, this ) );
1166
1258
 
1167
1259
        // Bpp
1168
 
        Combobox *combo_bpp = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_bpp" ));
 
1260
        CEGUI::Combobox *combo_bpp = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_bpp" ));
1169
1261
 
1170
 
        item = new ListboxTextItem( "16", 0 );
1171
 
        item->setTextColours( colour( 1, 0.6f, 0.3f ) );
 
1262
        item = new CEGUI::ListboxTextItem( "16", 0 );
 
1263
        item->setTextColours( CEGUI::colour( 1, 0.6f, 0.3f ) );
1172
1264
        combo_bpp->addItem( item );
1173
 
        item = new ListboxTextItem( "32", 1 );
1174
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
1265
        item = new CEGUI::ListboxTextItem( "32", 1 );
 
1266
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
1175
1267
        combo_bpp->addItem( item );
1176
1268
 
1177
1269
        combo_bpp->setText( int_to_string( pPreferences->video_screen_bpp ).c_str() );
1178
1270
 
1179
 
        combo_bpp->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Video::bpp_Select, this ) );
 
1271
        combo_bpp->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Video::Bpp_Select, this ) );
1180
1272
 
1181
1273
        // Fullscreen
1182
 
        Combobox *combo_fullscreen = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_fullscreen" ));
 
1274
        CEGUI::Combobox *combo_fullscreen = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_fullscreen" ));
1183
1275
 
1184
 
        item = new ListboxTextItem( "On", 0 );
1185
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
1276
        item = new CEGUI::ListboxTextItem( UTF8_("On"), 0 );
 
1277
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
1186
1278
        combo_fullscreen->addItem( item );
1187
 
        item = new ListboxTextItem( "Off", 1 );
1188
 
        item->setTextColours( colour( 0, 0, 1 ) );
 
1279
        item = new CEGUI::ListboxTextItem( UTF8_("Off"), 1 );
 
1280
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
1189
1281
        combo_fullscreen->addItem( item );
1190
1282
 
1191
1283
        if( pPreferences->video_fullscreen )
1192
1284
        {
1193
 
                combo_fullscreen->setText( "On" );
 
1285
                combo_fullscreen->setText( UTF8_("On") );
1194
1286
        }
1195
1287
        else
1196
1288
        {
1197
 
                combo_fullscreen->setText( "Off" );
 
1289
                combo_fullscreen->setText( UTF8_("Off") );
1198
1290
        }
1199
1291
 
1200
 
        combo_fullscreen->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Video::fullscreen_Select, this ) );
 
1292
        combo_fullscreen->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Video::Fullscreen_Select, this ) );
1201
1293
 
1202
1294
        // VSync
1203
 
        Combobox *combo_vsync = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_vsync" ));
 
1295
        CEGUI::Combobox *combo_vsync = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_vsync" ));
1204
1296
 
1205
 
        item = new ListboxTextItem( "On", 0 );
1206
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
1297
        item = new CEGUI::ListboxTextItem( UTF8_("On"), 0 );
 
1298
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
1207
1299
        combo_vsync->addItem( item );
1208
 
        item = new ListboxTextItem( "Off", 1 );
1209
 
        item->setTextColours( colour( 0, 0, 1 ) );
 
1300
        item = new CEGUI::ListboxTextItem( UTF8_("Off"), 1 );
 
1301
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
1210
1302
        combo_vsync->addItem( item );
1211
1303
 
1212
1304
        if( pPreferences->video_vsync )
1213
1305
        {
1214
 
                combo_vsync->setText( "On" );
 
1306
                combo_vsync->setText( UTF8_("On") );
1215
1307
        }
1216
1308
        else
1217
1309
        {
1218
 
                combo_vsync->setText( "Off" );
 
1310
                combo_vsync->setText( UTF8_("Off") );
1219
1311
        }
1220
1312
 
1221
 
        combo_vsync->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Video::vsync_Select, this ) );
 
1313
        combo_vsync->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Video::Vsync_Select, this ) );
 
1314
 
 
1315
        // Geometry detail
 
1316
        CEGUI::Slider *slider_geometry_detail = static_cast<CEGUI::Slider *>(CEGUI::WindowManager::getSingleton().getWindow( "slider_geometry_detail" ));
 
1317
        slider_geometry_detail->setCurrentValue( pVideo->geometry_detail );
 
1318
        slider_geometry_detail->subscribeEvent( CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Video::Slider_Geometry_Detail_Changed, this ) );
 
1319
 
 
1320
        // Texture detail
 
1321
        CEGUI::Slider *slider_texture_detail = static_cast<CEGUI::Slider *>(CEGUI::WindowManager::getSingleton().getWindow( "slider_texture_detail" ));
 
1322
        slider_texture_detail->setCurrentValue( pVideo->texture_detail );
 
1323
        slider_texture_detail->subscribeEvent( CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Video::Slider_Texture_Detail_Changed, this ) );
 
1324
 
 
1325
 
 
1326
        // Apply
 
1327
        CEGUI::PushButton *button_apply = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_apply" ));
 
1328
        button_apply->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Options_Video::Button_Apply_Clicked, this ) );
 
1329
 
 
1330
        // Recreate Cache
 
1331
        CEGUI::PushButton *button_recreate_cache = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_recreate_cache" ));
 
1332
        button_recreate_cache->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cMenu_Options_Video::Button_Recreate_Cache_Clicked, this ) );
1222
1333
}
1223
1334
 
1224
1335
void cMenu_Options_Video :: Update( void )
1244
1355
        if( pMenuCore->handler->active == 5 )
1245
1356
        {
1246
1357
                // Resolution
1247
 
                Combobox *combo_resolution = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_resolution" ));
 
1358
                CEGUI::Combobox *combo_resolution = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_resolution" ));
1248
1359
                unsigned int selected = combo_resolution->getItemIndex( combo_resolution->findItemWithText( combo_resolution->getText(), NULL ) );
1249
1360
 
1250
 
                ListboxItem *new_selected = NULL;
 
1361
                CEGUI::ListboxItem *new_selected = NULL;
1251
1362
 
1252
1363
                // last item selected
1253
1364
                if( selected == combo_resolution->getItemCount() - 1 )
1262
1373
                
1263
1374
                combo_resolution->setText( new_selected->getText() );
1264
1375
                combo_resolution->setItemSelectState( new_selected, 1 );
1265
 
                res_Select( WindowEventArgs( combo_resolution ) );
 
1376
                Res_Select( CEGUI::WindowEventArgs( combo_resolution ) );
1266
1377
        }
1267
1378
        // BPP
1268
1379
        else if( pMenuCore->handler->active == 6 )
1276
1387
                        vid_bpp = 16;
1277
1388
                }
1278
1389
 
1279
 
                WindowManager::getSingleton().getWindow( "combo_bpp" )->setText( int_to_string( vid_bpp ).c_str() );    
 
1390
                CEGUI::WindowManager::getSingleton().getWindow( "combo_bpp" )->setText( int_to_string( vid_bpp ).c_str() );     
1280
1391
        }
1281
1392
        // Fullscreen
1282
1393
        else if( pMenuCore->handler->active == 7 )
1285
1396
 
1286
1397
                if( vid_fullscreen )
1287
1398
                {
1288
 
                        WindowManager::getSingleton().getWindow( "combo_fullscreen" )->setText( "On" ); 
 
1399
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_fullscreen" )->setText( UTF8_("On") );   
1289
1400
                }
1290
1401
                else
1291
1402
                {
1292
 
                        WindowManager::getSingleton().getWindow( "combo_fullscreen" )->setText( "Off" );
 
1403
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_fullscreen" )->setText( UTF8_("Off") );
1293
1404
                }
1294
1405
        }
1295
1406
        // VSync
1299
1410
 
1300
1411
                if( vid_vsync )
1301
1412
                {
1302
 
                        WindowManager::getSingleton().getWindow( "combo_vsync" )->setText( "On" );      
1303
 
                }
1304
 
                else
1305
 
                {
1306
 
                        WindowManager::getSingleton().getWindow( "combo_vsync" )->setText( "Off" );
1307
 
                }
1308
 
        }
1309
 
        // Apply
1310
 
        else if( pMenuCore->handler->active == 9 )
1311
 
        {
1312
 
                // draw reinitialization text
1313
 
                Draw_StaticText( "Reinitialization", &green, NULL, 0 );
1314
 
 
1315
 
                pGuiSystem->renderGUI();
1316
 
                pRenderer->Render();
1317
 
                SDL_GL_SwapBuffers();
1318
 
 
1319
 
                // if no resolution, vsync or bpp changed
1320
 
                if( pPreferences->video_screen_w == vid_w && pPreferences->video_screen_h == vid_h && pPreferences->video_screen_bpp == vid_bpp && pPreferences->video_vsync == vid_vsync )
1321
 
                {
1322
 
                        // if only fullscreen changed
1323
 
                        if( pPreferences->video_fullscreen != vid_fullscreen )
1324
 
                        {
1325
 
                                pVideo->Toggle_Fullscreen();
1326
 
                        }
1327
 
                }
1328
 
                else
1329
 
                {
1330
 
                        // new settings
1331
 
                        pPreferences->video_screen_w = vid_w;
1332
 
                        pPreferences->video_screen_h = vid_h;
1333
 
                        pPreferences->video_screen_bpp = vid_bpp;
1334
 
                        pPreferences->video_fullscreen = vid_fullscreen;
1335
 
                        pPreferences->video_vsync = vid_vsync;
1336
 
 
1337
 
                        // apply new settings
1338
 
                        pPreferences->Apply();
1339
 
                }
1340
 
 
1341
 
                // clear
1342
 
                pMenuCore->next_menu = MENU_OPTIONS;
1343
 
                Game_Action = GA_ENTER_MENU;
 
1413
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_vsync" )->setText( UTF8_("On") );        
 
1414
                }
 
1415
                else
 
1416
                {
 
1417
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_vsync" )->setText( UTF8_("Off") );
 
1418
                }
1344
1419
        }
1345
1420
}
1346
1421
 
1348
1423
{
1349
1424
        cMenu_Options::Draw();
1350
1425
 
1351
 
        if( vid_fullscreen )
 
1426
        Draw_End();
 
1427
}
 
1428
 
 
1429
bool cMenu_Options_Video :: Res_Select( const CEGUI::EventArgs &event )
 
1430
{
 
1431
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1432
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1433
 
 
1434
        std::string temp = item->getText().c_str();
 
1435
 
 
1436
        // get end of height value if text is after resolution string
 
1437
        std::string::size_type height_end = temp.find( " " );
 
1438
 
 
1439
        if( height_end == std::string::npos )
1352
1440
        {
1353
 
                fullscreen->Draw();
 
1441
                height_end = temp.length();
1354
1442
        }
1355
1443
 
1356
 
        Draw_End();
1357
 
}
1358
 
 
1359
 
bool cMenu_Options_Video :: res_Select( const EventArgs &event )
1360
 
{
1361
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1362
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
1363
 
 
1364
 
        string temp = item->getText().c_str();
1365
 
 
 
1444
        // get resolution
1366
1445
        unsigned int w = string_to_int( temp.substr( 0, temp.find( "x" ) ) );
1367
 
        unsigned int h = string_to_int( temp.substr( temp.find( "x" ) + 1, temp.length() ) );
 
1446
        unsigned int h = string_to_int( temp.substr( temp.find( "x" ) + 1, height_end ) );
1368
1447
 
 
1448
        // is it supported
1369
1449
        if( !pVideo->Test_Video( w, h, vid_bpp ) )
1370
1450
        {
1371
1451
                return 0;
1372
1452
        }
1373
1453
 
 
1454
        // set new selected resolution
1374
1455
        vid_w = w;
1375
1456
        vid_h = h;
1376
1457
 
1377
1458
        return 1;
1378
1459
}
1379
1460
 
1380
 
bool cMenu_Options_Video :: bpp_Select( const EventArgs &event )
 
1461
bool cMenu_Options_Video :: Bpp_Select( const CEGUI::EventArgs &event )
1381
1462
{
1382
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1383
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1463
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1464
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
1384
1465
 
1385
1466
        unsigned int bpp = string_to_int( item->getText().c_str() );
1386
1467
 
1394
1475
        return 1;
1395
1476
}
1396
1477
 
1397
 
bool cMenu_Options_Video :: fullscreen_Select( const EventArgs &event )
 
1478
bool cMenu_Options_Video :: Fullscreen_Select( const CEGUI::EventArgs &event )
1398
1479
{
1399
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1400
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1480
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1481
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
1401
1482
 
1402
1483
        bool bfullscreen = 0;
1403
1484
 
1404
 
        if( item->getText().compare( "On" ) == 0 )
 
1485
        if( item->getText().compare( UTF8_("On") ) == 0 )
1405
1486
        {
1406
1487
                bfullscreen = 1;
1407
1488
        }
1411
1492
        return 1;
1412
1493
}
1413
1494
 
1414
 
bool cMenu_Options_Video :: vsync_Select( const EventArgs &event )
 
1495
bool cMenu_Options_Video :: Vsync_Select( const CEGUI::EventArgs &event )
1415
1496
{
1416
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1417
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1497
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1498
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
1418
1499
 
1419
1500
        bool bvsync = 0;
1420
1501
 
1421
 
        if( item->getText().compare( "On" ) == 0 )
 
1502
        if( item->getText().compare( UTF8_("On") ) == 0 )
1422
1503
        {
1423
1504
                bvsync = 1;
1424
1505
        }
1428
1509
        return 1;
1429
1510
}
1430
1511
 
 
1512
bool cMenu_Options_Video :: Slider_Geometry_Detail_Changed( const CEGUI::EventArgs &event )
 
1513
{
 
1514
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1515
        // set new value
 
1516
        vid_geometry_detail = static_cast<CEGUI::Slider *>( windowEventArgs.window )->getCurrentValue();
 
1517
 
 
1518
        return 1;
 
1519
}
 
1520
 
 
1521
bool cMenu_Options_Video :: Slider_Texture_Detail_Changed( const CEGUI::EventArgs &event )
 
1522
{
 
1523
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1524
        // set new value
 
1525
        vid_texture_detail = static_cast<CEGUI::Slider *>( windowEventArgs.window )->getCurrentValue();
 
1526
 
 
1527
        return 1;
 
1528
}
 
1529
 
 
1530
bool cMenu_Options_Video :: Button_Apply_Clicked( const CEGUI::EventArgs &event )
 
1531
{
 
1532
        // draw reinitialization text
 
1533
        Draw_Static_Text( _("Reinitialization"), &green, NULL, 0 );
 
1534
 
 
1535
        pGuiSystem->renderGUI();
 
1536
        pRenderer->Render();
 
1537
        SDL_GL_SwapBuffers();
 
1538
 
 
1539
        // apply new settings
 
1540
        pPreferences->Apply_Video( vid_w, vid_h, vid_bpp, vid_fullscreen, vid_vsync, vid_geometry_detail, vid_texture_detail );
 
1541
 
 
1542
        // clear
 
1543
        pMenuCore->next_menu = MENU_OPTIONS;
 
1544
        Game_Action = GA_ENTER_MENU;
 
1545
 
 
1546
        return 1;
 
1547
}
 
1548
 
 
1549
bool cMenu_Options_Video :: Button_Recreate_Cache_Clicked( const CEGUI::EventArgs &event )
 
1550
{
 
1551
        Loading_Screen_Init();
 
1552
 
 
1553
        // save textures for reloading from file
 
1554
        pImage_Manager->Grab_Textures( 1, 1 );
 
1555
 
 
1556
        // recreate cache
 
1557
        pVideo->Init_Image_Cache( 1, 1 );
 
1558
 
 
1559
        // restore textures
 
1560
        pImage_Manager->Restore_Textures( 1 );
 
1561
 
 
1562
        Loading_Screen_Exit();
 
1563
 
 
1564
        return 1;
 
1565
}
 
1566
 
1431
1567
/* *** *** *** *** *** *** *** *** cMenu_Options_Audio *** *** *** *** *** *** *** *** *** */
1432
1568
 
1433
1569
cMenu_Options_Audio :: cMenu_Options_Audio( void )
1434
1570
: cMenu_Options()
1435
1571
{
1436
 
        music = new cHudSprite();
1437
 
        sounds = new cHudSprite();
 
1572
 
1438
1573
}
1439
1574
 
1440
1575
cMenu_Options_Audio :: ~cMenu_Options_Audio( void )
1441
1576
{
1442
 
        delete music;
1443
 
        delete sounds;
 
1577
 
1444
1578
}
1445
1579
 
1446
1580
void cMenu_Options_Audio :: Init( void )
1447
1581
{
1448
1582
        cMenu_Options::Init();
1449
1583
 
1450
 
        // Audio
1451
 
        music->Set_Image( pVideo->Get_Surface( "menu/items/music.png" ), 1 );
1452
 
        sounds->Set_Image( pVideo->Get_Surface( "menu/items/sounds.png" ), 1 );
1453
 
 
1454
 
        cMenu_Item *temp_item = NULL;
1455
 
 
1456
 
        GL_Surface *audio_hz = pFont->RenderText( pFont->font_normal, "Hz", text_color );
1457
 
        GL_Surface *audio_music = pFont->RenderText( pFont->font_normal, "Music", text_color );
1458
 
        GL_Surface *audio_sounds = pFont->RenderText( pFont->font_normal, "Sounds", text_color );
1459
 
 
1460
1584
        layout_file = "menu_audio.layout";
1461
 
        menu_posy = 220;
1462
 
 
1463
 
 
1464
 
        // Audio Hz
1465
 
        temp_item = new cMenu_Item();
1466
 
        temp_item->image_default->Set_Image( audio_hz );
1467
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1468
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1469
 
        drawlist.push_back( new cHudSprite( audio_hz, -200, 0, 1 ) );
1470
 
 
1471
 
        // Music
1472
 
        temp_item = new cMenu_Item();
1473
 
        menu_posy += 85;
1474
 
        temp_item->image_default->Set_Image( audio_music );
1475
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1476
 
        music->Set_Pos( GAME_RES_W / 1.8f + music->col_rect.w + 50, menu_posy - 5 );
1477
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1478
 
        drawlist.push_back( new cHudSprite( audio_music, -200, 0, 1 ) );
1479
 
        // Sounds
1480
 
        temp_item = new cMenu_Item();
1481
 
        menu_posy += 55;
1482
 
        temp_item->image_default->Set_Image( audio_sounds );
1483
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1484
 
        sounds->Set_Pos( GAME_RES_W / 1.8f + sounds->col_rect.w + 50, menu_posy - 5 );
1485
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5, grey );
1486
 
        drawlist.push_back( new cHudSprite( audio_sounds, -200, 0, 1 ) );
1487
 
 
1488
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/audio.png" ), GAME_RES_W * 0.47f, 140 ) );
1489
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/audio.png" ), GAME_RES_W / 2.6f, 140 ) );
 
1585
 
 
1586
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/audio.png" ), game_res_w * 0.5f, game_res_h * 0.1f ) );
 
1587
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/audio.png" ), game_res_w * 0.4f, game_res_h * 0.1f ) );
1490
1588
        
1491
1589
        pMenuCore->handler->Set_Active( MENU_AUDIO );
1492
1590
 
1498
1596
        cMenu_Options::Init_GUI();
1499
1597
 
1500
1598
        // Audio Hz
1501
 
        Combobox *combo_audio_hz = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_audio_hz" ));
 
1599
        CEGUI::Combobox *combo_audio_hz = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_audio_hz" ));
1502
1600
 
1503
 
        ListboxTextItem *item = new ListboxTextItem( "44800", 0 );
1504
 
        item->setTextColours( colour( 0, 0, 1 ) );
1505
 
        combo_audio_hz->addItem( item );
1506
 
        item = new ListboxTextItem( "44100", 1 );
1507
 
        item->setTextColours( colour( 0, 1, 0 ) );
1508
 
        combo_audio_hz->addItem( item );
1509
 
        item = new ListboxTextItem( "22050", 1 );
1510
 
        item->setTextColours( colour( 1, 0, 0 ) );
 
1601
        CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( "22050", 0 );
 
1602
        item->setTextColours( CEGUI::colour( 1, 0, 0 ) );
 
1603
        combo_audio_hz->addItem( item );
 
1604
        item = new CEGUI::ListboxTextItem( "44100", 1 );
 
1605
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
 
1606
        combo_audio_hz->addItem( item );
 
1607
        item = new CEGUI::ListboxTextItem( "44800", 2 );
 
1608
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
1511
1609
        combo_audio_hz->addItem( item );
1512
1610
 
1513
1611
        // Set current value
1514
1612
        combo_audio_hz->setText( int_to_string( pPreferences->audio_hz ) );
1515
1613
 
1516
 
        combo_audio_hz->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Audio::Audio_Hz_Select, this ) );
 
1614
        combo_audio_hz->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Audio::Audio_Hz_Select, this ) );
1517
1615
 
1518
1616
 
1519
1617
        // Music
1520
 
        Combobox *combo_music = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_music" ));
 
1618
        CEGUI::Combobox *combo_music = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_music" ));
1521
1619
 
1522
 
        item = new ListboxTextItem( "On", 0 );
1523
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
1620
        item = new CEGUI::ListboxTextItem( UTF8_("On"), 0 );
 
1621
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
1524
1622
        combo_music->addItem( item );
1525
 
        item = new ListboxTextItem( "Off", 1 );
1526
 
        item->setTextColours( colour( 0, 0, 1 ) );
 
1623
        item = new CEGUI::ListboxTextItem( UTF8_("Off"), 1 );
 
1624
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
1527
1625
        combo_music->addItem( item );
1528
1626
 
1529
1627
        if( pAudio->music_enabled )
1530
1628
        {
1531
 
                combo_music->setText( "On" );
 
1629
                combo_music->setText( UTF8_("On") );
1532
1630
        }
1533
1631
        else
1534
1632
        {
1535
 
                combo_music->setText( "Off" );
 
1633
                combo_music->setText( UTF8_("Off") );
1536
1634
        }
1537
1635
 
1538
 
        combo_music->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Audio::music_Select, this ) );
 
1636
        combo_music->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Audio::Music_Select, this ) );
1539
1637
 
1540
1638
        // music volume slider
1541
 
        Slider *slider_music = (Slider *)WindowManager::getSingleton().getWindow( "slider_music_volume" );
 
1639
        CEGUI::Slider *slider_music = static_cast<CEGUI::Slider *>(CEGUI::WindowManager::getSingleton().getWindow( "slider_music_volume" ));
1542
1640
        slider_music->setCurrentValue( static_cast<float>(pAudio->music_volume) );
1543
 
        slider_music->subscribeEvent( Slider::EventValueChanged, Event::Subscriber( &cMenu_Options_Audio::music_vol_changed, this ) );
 
1641
        slider_music->subscribeEvent( CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Audio::Music_Vol_Changed, this ) );
1544
1642
        
1545
1643
 
1546
1644
        // Sounds
1547
 
        Combobox *combo_sounds = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_sounds" ));
 
1645
        CEGUI::Combobox *combo_sounds = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_sounds" ));
1548
1646
 
1549
 
        item = new ListboxTextItem( "On", 0 );
1550
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
1647
        item = new CEGUI::ListboxTextItem( UTF8_("On"), 0 );
 
1648
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
1551
1649
        combo_sounds->addItem( item );
1552
 
        item = new ListboxTextItem( "Off", 1 );
1553
 
        item->setTextColours( colour( 1, 0.6f, 0.3f ) );
 
1650
        item = new CEGUI::ListboxTextItem( UTF8_("Off"), 1 );
 
1651
        item->setTextColours( CEGUI::colour( 1, 0.6f, 0.3f ) );
1554
1652
        combo_sounds->addItem( item );
1555
1653
 
1556
1654
        if( pAudio->sound_enabled )
1557
1655
        {
1558
 
                combo_sounds->setText( "On" );
 
1656
                combo_sounds->setText( UTF8_("On") );
1559
1657
        }
1560
1658
        else
1561
1659
        {
1562
 
                combo_sounds->setText( "Off" );
 
1660
                combo_sounds->setText( UTF8_("Off") );
1563
1661
        }
1564
1662
 
1565
 
        combo_sounds->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Audio::sound_Select, this ) );
 
1663
        combo_sounds->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Audio::Sound_Select, this ) );
1566
1664
 
1567
1665
        // sound volume slider
1568
 
        Slider *slider_sound = (Slider *)WindowManager::getSingleton().getWindow( "slider_sound_volume" );
 
1666
        CEGUI::Slider *slider_sound = static_cast<CEGUI::Slider *>(CEGUI::WindowManager::getSingleton().getWindow( "slider_sound_volume" ));
1569
1667
        slider_sound->setCurrentValue( static_cast<float>(pAudio->sound_volume) );
1570
 
        slider_sound->subscribeEvent( Slider::EventValueChanged, Event::Subscriber( &cMenu_Options_Audio::sound_vol_changed, this ) );
 
1668
        slider_sound->subscribeEvent( CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Audio::Sound_Vol_Changed, this ) );
1571
1669
}
1572
1670
 
1573
1671
void cMenu_Options_Audio :: Update( void )
1589
1687
 
1590
1688
        action = 0;
1591
1689
 
 
1690
        // Hz
 
1691
        if( pMenuCore->handler->active == 5 )
 
1692
        {
 
1693
                CEGUI::Combobox *combo_hz = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_audio_hz" ));
 
1694
                unsigned int selected = combo_hz->getItemIndex( combo_hz->findItemWithText( combo_hz->getText(), NULL ) );
 
1695
 
 
1696
                CEGUI::ListboxItem *new_selected = NULL;
 
1697
 
 
1698
                // last item selected
 
1699
                if( selected == combo_hz->getItemCount() - 1 )
 
1700
                {
 
1701
                        new_selected = combo_hz->getListboxItemFromIndex( 0 );
 
1702
                }
 
1703
                // select next item
 
1704
                else
 
1705
                {
 
1706
                        new_selected = combo_hz->getListboxItemFromIndex( selected + 1 );
 
1707
                }
 
1708
                
 
1709
                combo_hz->setText( new_selected->getText() );
 
1710
                combo_hz->setItemSelectState( new_selected, 1 );
 
1711
                Audio_Hz_Select( CEGUI::WindowEventArgs( combo_hz ) );
 
1712
        }
1592
1713
        // Music
1593
 
        if( pMenuCore->handler->active == 5 )
 
1714
        else if( pMenuCore->handler->active == 6 )
1594
1715
        {
1595
 
                pAudio->ToggleMusic();
 
1716
                pAudio->Toggle_Music();
1596
1717
 
1597
1718
                if( pAudio->music_enabled )
1598
1719
                {
1599
 
                        WindowManager::getSingleton().getWindow( "combo_music" )->setText( "On" );
 
1720
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_music" )->setText( UTF8_("On") );
1600
1721
                }
1601
1722
                else
1602
1723
                {
1603
 
                        WindowManager::getSingleton().getWindow( "combo_music" )->setText( "Off" );
 
1724
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_music" )->setText( UTF8_("Off") );
1604
1725
                }
1605
1726
        }
1606
1727
        // Sounds
1607
 
        else if( pMenuCore->handler->active == 6 )
 
1728
        else if( pMenuCore->handler->active == 7 )
1608
1729
        {
1609
 
                pAudio->ToggleSounds();
 
1730
                pAudio->Toggle_Sounds();
1610
1731
 
1611
1732
                if( pAudio->sound_enabled )
1612
1733
                {
1613
 
                        WindowManager::getSingleton().getWindow( "combo_sounds" )->setText( "On" );
 
1734
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_sounds" )->setText( UTF8_("On") );
1614
1735
                }
1615
1736
                else
1616
1737
                {
1617
 
                        WindowManager::getSingleton().getWindow( "combo_sounds" )->setText( "Off" );
 
1738
                        CEGUI::WindowManager::getSingleton().getWindow( "combo_sounds" )->setText( UTF8_("Off") );
1618
1739
                }
1619
1740
        }
1620
1741
}
1623
1744
{
1624
1745
        cMenu_Options::Draw();
1625
1746
 
1626
 
        // Music image
1627
 
        if( pAudio->music_enabled )
1628
 
        {
1629
 
                music->Draw();
1630
 
        }
1631
 
        // Sounds image
1632
 
        if( pAudio->sound_enabled )
1633
 
        {
1634
 
                sounds->Draw();
1635
 
        }
1636
 
 
1637
1747
        Draw_End();
1638
1748
}
1639
1749
 
1640
 
bool cMenu_Options_Audio :: Audio_Hz_Select( const EventArgs &event )
 
1750
bool cMenu_Options_Audio :: Audio_Hz_Select( const CEGUI::EventArgs &event )
1641
1751
{
1642
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1643
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1752
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1753
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
1644
1754
 
1645
1755
        pPreferences->audio_hz = string_to_int( item->getText().c_str() );
1646
 
        // todo : add Audio function to reload sounds and music when needed
1647
 
        //pAudio->Init( pPreferences->Sounds, pPreferences->Music );
1648
 
        Draw_StaticText( "You need to restart for the change to take effect.", &white, &lightgreyalpha64 );
 
1756
 
 
1757
        // draw reloading text
 
1758
        Draw_Static_Text( _("Reloading"), &green, NULL, 0 );
 
1759
        // reload
 
1760
        pAudio->Close();
 
1761
        pSound_Manager->Delete_All();
 
1762
        pAudio->Init();
 
1763
        // todo : add sound manager function to reload sounds and music when needed
 
1764
        Preload_Sounds();
1649
1765
 
1650
1766
        return 1;
1651
1767
}
1652
1768
 
1653
 
bool cMenu_Options_Audio :: music_Select( const EventArgs &event )
 
1769
bool cMenu_Options_Audio :: Music_Select( const CEGUI::EventArgs &event )
1654
1770
{
1655
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1656
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1771
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1772
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
1657
1773
 
1658
1774
        bool bmusic = 0;
1659
1775
 
1660
 
        if( item->getText().compare( "On" ) == 0 )
 
1776
        if( item->getText().compare( UTF8_("On") ) == 0 )
1661
1777
        {
1662
1778
                bmusic = 1;
1663
1779
        }
1664
1780
 
1665
1781
        if( pAudio->music_enabled != bmusic )
1666
1782
        {
1667
 
                pAudio->ToggleMusic();
 
1783
                pAudio->Toggle_Music();
1668
1784
        }
1669
1785
 
1670
1786
        return 1;
1671
1787
}
1672
1788
 
1673
 
bool cMenu_Options_Audio :: music_vol_changed( const EventArgs &event )
 
1789
bool cMenu_Options_Audio :: Music_Vol_Changed( const CEGUI::EventArgs &event )
1674
1790
{
1675
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1676
 
        Uint8 val = static_cast<Uint8>(static_cast<Slider *>( windowEventArgs.window )->getCurrentValue());
 
1791
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1792
        Uint8 val = static_cast<Uint8>(static_cast<CEGUI::Slider *>( windowEventArgs.window )->getCurrentValue());
1677
1793
 
1678
 
        pAudio->SetMusicVolume( val );
 
1794
        pAudio->Set_Music_Volume( val );
1679
1795
 
1680
1796
        return 1;
1681
1797
}
1682
1798
 
1683
 
bool cMenu_Options_Audio :: sound_Select( const EventArgs &event )
 
1799
bool cMenu_Options_Audio :: Sound_Select( const CEGUI::EventArgs &event )
1684
1800
{
1685
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1686
 
        ListboxItem *item = static_cast<Combobox *>( windowEventArgs.window )->getSelectedItem();
 
1801
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1802
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();
1687
1803
 
1688
1804
        bool bsound = 0;
1689
1805
 
1690
 
        if( item->getText().compare( "On" ) == 0 )
 
1806
        if( item->getText().compare( UTF8_("On") ) == 0 )
1691
1807
        {
1692
1808
                bsound= 1;
1693
1809
        }
1694
1810
 
1695
1811
        if( pAudio->sound_enabled != bsound )
1696
1812
        {
1697
 
                pAudio->ToggleSounds();
 
1813
                pAudio->Toggle_Sounds();
1698
1814
        }
1699
1815
 
1700
1816
        return 1;
1701
1817
}
1702
1818
 
1703
 
bool cMenu_Options_Audio :: sound_vol_changed( const EventArgs &event )
 
1819
bool cMenu_Options_Audio :: Sound_Vol_Changed( const CEGUI::EventArgs &event )
1704
1820
{
1705
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
1706
 
        Uint8 val = static_cast<Uint8>(static_cast<Slider *>( windowEventArgs.window )->getCurrentValue());
 
1821
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
1822
        Uint8 val = static_cast<Uint8>(static_cast<CEGUI::Slider *>( windowEventArgs.window )->getCurrentValue());
1707
1823
 
1708
 
        pAudio->SetSoundVolume( val );
 
1824
        pAudio->Set_Sound_Volume( val );
1709
1825
 
1710
1826
        return 1;
1711
1827
}
1717
1833
{
1718
1834
        // Keyboard
1719
1835
        gamepad = new cHudSprite();
1720
 
        keyboard_up_keyname = new cHudSprite( NULL, 0, -200, 0 );
1721
 
        keyboard_up_keyname->Set_Shadow( grey, 1.5f );
1722
 
        keyboard_down_keyname = keyboard_up_keyname->Copy();
1723
 
        keyboard_left_keyname = keyboard_up_keyname->Copy();
1724
 
        keyboard_right_keyname = keyboard_up_keyname->Copy();
1725
 
        keyboard_jump_keyname = keyboard_up_keyname->Copy();
1726
 
        keyboard_shoot_keyname = keyboard_up_keyname->Copy();
1727
 
        keyboard_action_keyname = keyboard_up_keyname->Copy();
1728
 
        // Joypad
1729
 
        joypad_jump_keyname = keyboard_up_keyname->Copy();
1730
 
        joypad_item_keyname = keyboard_up_keyname->Copy();
1731
 
        joypad_shoot_keyname = keyboard_up_keyname->Copy();
1732
 
        joypad_action_keyname = keyboard_up_keyname->Copy();
1733
 
        joypad_exit_keyname = keyboard_up_keyname->Copy();
1734
1836
}
1735
1837
 
1736
1838
cMenu_Options_Controls :: ~cMenu_Options_Controls( void )
1737
1839
{
1738
1840
        delete gamepad;
1739
 
        // Keyboard
1740
 
        delete keyboard_up_keyname;
1741
 
        delete keyboard_down_keyname;
1742
 
        delete keyboard_left_keyname;
1743
 
        delete keyboard_right_keyname;
1744
 
        delete keyboard_jump_keyname;
1745
 
        delete keyboard_shoot_keyname;
1746
 
        delete keyboard_action_keyname;
1747
 
        // Joypad
1748
 
        delete joypad_jump_keyname;
1749
 
        delete joypad_item_keyname;
1750
 
        delete joypad_shoot_keyname;
1751
 
        delete joypad_action_keyname;
1752
 
        delete joypad_exit_keyname;
1753
1841
}
1754
1842
 
1755
1843
void cMenu_Options_Controls :: Init( void )
1756
1844
{
1757
1845
        cMenu_Options::Init();
1758
1846
 
 
1847
        cMenu_Item *temp_item = NULL;
 
1848
 
 
1849
        layout_file = "menu_controls.layout";
 
1850
        menu_posy = 220;
 
1851
        
1759
1852
        // gamepad
1760
1853
        gamepad->Set_Image( pVideo->Get_Surface( "menu/items/gamepad.png" ), 1 );
1761
 
        // Keyboard
1762
 
        keyboard_up_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_up ), text_color_value ), 1, 1 );
1763
 
        keyboard_down_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_down ), text_color_value ), 1, 1 );
1764
 
        keyboard_left_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_left ), text_color_value ), 1, 1 );
1765
 
        keyboard_right_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_right ), text_color_value ), 1, 1 );
1766
 
        keyboard_jump_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_jump ), text_color_value ), 1, 1 );
1767
 
        keyboard_shoot_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_shoot ), text_color_value ), 1, 1 );
1768
 
        keyboard_action_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_action ), text_color_value ), 1, 1 );
1769
 
        // Joystick/Gamepad
1770
 
        joypad_jump_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_jump ), text_color_value ), 1, 1 );
1771
 
        joypad_item_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_item ), text_color_value ), 1, 1 );
1772
 
        joypad_shoot_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_shoot ), text_color_value ), 1, 1 );
1773
 
        joypad_action_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_action ), text_color_value ), 1, 1 );
1774
 
        joypad_exit_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_exit ), text_color_value ), 1, 1 );
1775
 
 
1776
 
        cMenu_Item *temp_item = NULL;
1777
 
 
1778
 
        GL_Surface *keyboard_up = pFont->RenderText( pFont->font_normal, "Up", text_color );
1779
 
        GL_Surface *keyboard_down = pFont->RenderText( pFont->font_normal, "Down", text_color );
1780
 
        GL_Surface *keyboard_left = pFont->RenderText( pFont->font_normal, "Left", text_color );
1781
 
        GL_Surface *keyboard_right = pFont->RenderText( pFont->font_normal, "Right", text_color );
1782
 
        GL_Surface *keyboard_jump = pFont->RenderText( pFont->font_normal, "Jump", text_color );
1783
 
        GL_Surface *keyboard_shoot = pFont->RenderText( pFont->font_normal, "Shoot", text_color );
1784
 
        GL_Surface *keyboard_action = pFont->RenderText( pFont->font_normal, "Action/Run", text_color );
1785
 
 
1786
 
        GL_Surface *joypad_jump = pFont->RenderText( pFont->font_normal, "Jump", text_color );
1787
 
        GL_Surface *joypad_item = pFont->RenderText( pFont->font_normal, "Item", text_color );
1788
 
        GL_Surface *joypad_shoot = pFont->RenderText( pFont->font_normal, "Shoot", text_color );
1789
 
        GL_Surface *joypad_action = pFont->RenderText( pFont->font_normal, "Action/Run", text_color );
1790
 
        GL_Surface *joypad_exit = pFont->RenderText( pFont->font_normal, "Exit", text_color );
1791
 
 
1792
 
        GL_Surface *controls_joy_enabled = pFont->RenderText( pFont->font_normal, "Joystick", text_color );
1793
 
        GL_Surface *controls_joy_analog_jump = pFont->RenderText( pFont->font_normal, "Analog Jump", text_color );
1794
 
 
1795
 
        layout_file = "menu_controls.layout";
1796
 
        menu_posy = 220;
1797
 
 
1798
 
        // ## Keyboard
1799
 
        // Up
1800
 
        temp_item = new cMenu_Item();
1801
 
        temp_item->image_default->Set_Image( keyboard_up );
1802
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1803
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1804
 
        keyboard_up_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1805
 
        drawlist.push_back( new cHudSprite( keyboard_up, -200, 0, 1 ) );
1806
 
        // Down
1807
 
        temp_item = new cMenu_Item();
1808
 
        menu_posy += 30;
1809
 
        temp_item->image_default->Set_Image( keyboard_down );
1810
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1811
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1812
 
        keyboard_down_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1813
 
        drawlist.push_back( new cHudSprite( keyboard_down, -200, 0, 1 ) );
1814
 
        // Left
1815
 
        temp_item = new cMenu_Item();
1816
 
        menu_posy += 30;
1817
 
        temp_item->image_default->Set_Image( keyboard_left );
1818
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1819
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1820
 
        keyboard_left_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1821
 
        drawlist.push_back( new cHudSprite( keyboard_left, -200, 0, 1 ) );
1822
 
        // Right
1823
 
        temp_item = new cMenu_Item();
1824
 
        menu_posy += 30;
1825
 
        temp_item->image_default->Set_Image( keyboard_right );
1826
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1827
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1828
 
        keyboard_right_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1829
 
        drawlist.push_back( new cHudSprite( keyboard_right, -200, 0, 1 ) );
1830
 
        // Jump
1831
 
        temp_item = new cMenu_Item();
1832
 
        menu_posy += 30;
1833
 
        temp_item->image_default->Set_Image( keyboard_jump );
1834
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1835
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1836
 
        keyboard_jump_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1837
 
        drawlist.push_back( new cHudSprite( keyboard_jump, -200, 0, 1 ) );
1838
 
        // Shoot
1839
 
        temp_item = new cMenu_Item();
1840
 
        menu_posy += 30;
1841
 
        temp_item->image_default->Set_Image( keyboard_shoot );
1842
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1843
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1844
 
        keyboard_shoot_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1845
 
        drawlist.push_back( new cHudSprite( keyboard_shoot, -200, 0, 1 ) );
1846
 
        // Action
1847
 
        temp_item = new cMenu_Item();
1848
 
        menu_posy += 30;
1849
 
        temp_item->image_default->Set_Image( keyboard_action );
1850
 
        temp_item->Set_Pos( GAME_RES_W / 3, menu_posy );
1851
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1852
 
        keyboard_action_keyname->Set_Pos( GAME_RES_W / 2, menu_posy );
1853
 
        drawlist.push_back( new cHudSprite( keyboard_action, -200, 0, 1 ) );
1854
 
 
1855
 
        // ## right side
1856
 
        menu_posy = 220;
1857
 
 
1858
 
        // ## Joypad
1859
 
        // Jump
1860
 
        temp_item = new cMenu_Item();
1861
 
        temp_item->image_default->Set_Image( joypad_jump );
1862
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1863
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1864
 
        joypad_jump_keyname->Set_Pos( GAME_RES_W / 1.25f, menu_posy );
1865
 
        drawlist.push_back( new cHudSprite( joypad_jump, -200, 0, 1 ) );
1866
 
        // Item
1867
 
        temp_item = new cMenu_Item();
1868
 
        menu_posy += 30;
1869
 
        temp_item->image_default->Set_Image( joypad_item );
1870
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1871
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1872
 
        joypad_item_keyname->Set_Pos( GAME_RES_W / 1.25f, menu_posy );
1873
 
        drawlist.push_back( new cHudSprite( joypad_item, -200, 0, 1 ) );
1874
 
        // Shoot
1875
 
        temp_item = new cMenu_Item();
1876
 
        menu_posy += 30;
1877
 
        temp_item->image_default->Set_Image( joypad_shoot );
1878
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1879
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1880
 
        joypad_shoot_keyname->Set_Pos( GAME_RES_W / 1.25f, menu_posy );
1881
 
        drawlist.push_back( new cHudSprite( joypad_shoot, -200, 0, 1 ) );
1882
 
        // Action
1883
 
        temp_item = new cMenu_Item();
1884
 
        menu_posy += 30;
1885
 
        temp_item->image_default->Set_Image( joypad_action );
1886
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1887
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1888
 
        joypad_action_keyname->Set_Pos( GAME_RES_W / 1.25f, menu_posy );
1889
 
        drawlist.push_back( new cHudSprite( joypad_action, -200, 0, 1 ) );
1890
 
        // Exit
1891
 
        temp_item = new cMenu_Item();
1892
 
        menu_posy += 30;
1893
 
        temp_item->image_default->Set_Image( joypad_exit );
1894
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1895
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1896
 
        joypad_exit_keyname->Set_Pos( GAME_RES_W / 1.25f, menu_posy );
1897
 
        drawlist.push_back( new cHudSprite( joypad_exit, -200, 0, 1 ) );
1898
 
        
1899
 
        // use joystick
1900
 
        temp_item = new cMenu_Item();
1901
 
        menu_posy += 30;
1902
 
        temp_item->image_default->Set_Image( controls_joy_enabled );
1903
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1904
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1905
 
        gamepad->Set_Pos( GAME_RES_W * 0.74f, menu_posy - gamepad->col_rect.h * 0.2f );
1906
 
        drawlist.push_back( new cHudSprite( controls_joy_enabled, -200, 0, 1 ) );
1907
 
        // allow analog jump
1908
 
        temp_item = new cMenu_Item();
1909
 
        menu_posy += 30;
1910
 
        temp_item->image_default->Set_Image( controls_joy_analog_jump );
1911
 
        temp_item->Set_Pos( GAME_RES_W / 1.6f, menu_posy );
1912
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
1913
 
        drawlist.push_back( new cHudSprite( controls_joy_analog_jump, -200, 0, 1 ) );
1914
 
 
1915
 
 
1916
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/controls.png" ), GAME_RES_W * 0.47f, 140 ) );
1917
 
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/controls.png" ), GAME_RES_W / 2.6f, 140 ) );
 
1854
        gamepad->Set_Pos( game_res_w * 0.7f, game_res_h * 0.1f );
 
1855
 
 
1856
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/controls.png" ), game_res_w * 0.5f, game_res_h * 0.1f ) );
 
1857
        drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/controls.png" ), game_res_w * 0.4f, game_res_h * 0.1f ) );
1918
1858
 
1919
1859
        pMenuCore->handler->Set_Active( MENU_CONTROLS );
1920
1860
 
1925
1865
{
1926
1866
        cMenu_Options::Init_GUI();
1927
1867
 
 
1868
        // Keyboard listbox
 
1869
        CEGUI::MultiColumnList *listbox_keyboard = static_cast<CEGUI::MultiColumnList *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_keyboard" ));
 
1870
 
 
1871
        listbox_keyboard->addColumn( _("Name"), 0, CEGUI::UDim( 0.47f, 0 ) );
 
1872
        listbox_keyboard->addColumn( _("Key"), 1, CEGUI::UDim( 0.47f, 0 ) );
 
1873
        Build_Shortcut_List();
 
1874
 
 
1875
        listbox_keyboard->subscribeEvent( CEGUI::MultiColumnList::EventMouseDoubleClick, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Keyboard_List_Double_Click, this ) );
 
1876
 
 
1877
        // Keyboard scroll speed
 
1878
        CEGUI::Slider *slider_scoll_speed = static_cast<CEGUI::Slider *>(CEGUI::WindowManager::getSingleton().getWindow( "slider_keyboard_scroll_speed" ));
 
1879
        slider_scoll_speed->setCurrentValue( pPreferences->scroll_speed );
 
1880
        slider_scoll_speed->subscribeEvent( CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Keyboard_Slider_Scroll_Speed_Changed, this ) );
 
1881
 
 
1882
        // Joystick name text
 
1883
        CEGUI::Window *text_joystick_name = CEGUI::WindowManager::getSingleton().getWindow( "text_joystick_name" );
 
1884
        text_joystick_name->subscribeEvent( CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_Name_Click, this ) );
 
1885
 
 
1886
        // Joystick analog jump text
 
1887
        CEGUI::Window *text_joystick_analog_jump = CEGUI::WindowManager::getSingleton().getWindow( "text_joystick_analog_jump" );
 
1888
        text_joystick_analog_jump->subscribeEvent( CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_Analog_Jump_Click, this ) );
 
1889
 
1928
1890
        // Joystick enabled
1929
 
        Combobox *combo_joy = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_joy" ));
 
1891
        CEGUI::Combobox *combo_joy = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_joy" ));
1930
1892
 
1931
1893
        // Add None
1932
 
        ListboxTextItem *item = new ListboxTextItem( "None", 0 );
1933
 
        item->setTextColours( colour( 0, 0, 1 ) );
 
1894
        CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( UTF8_("None"), 0 );
 
1895
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
1934
1896
        combo_joy->addItem( item );
1935
1897
 
1936
1898
        // Add all Joy names
1938
1900
 
1939
1901
        for( unsigned int i = 0; i < joy_names.size(); i++ )
1940
1902
        {
1941
 
                item = new ListboxTextItem( joy_names[i], 1 );
1942
 
                item->setTextColours( colour( 0.3f, 1, 0.3f ) );
 
1903
                item = new CEGUI::ListboxTextItem( joy_names[i], 1 );
 
1904
                item->setTextColours( CEGUI::colour( 0.3f, 1, 0.3f ) );
1943
1905
                combo_joy->addItem( item );
1944
1906
        }
1945
1907
 
1946
1908
        // Selected Item
1947
 
        ListboxTextItem *selected_item = NULL;
 
1909
        CEGUI::ListboxTextItem *selected_item = NULL;
1948
1910
 
1949
1911
        // Set current Joy name
1950
1912
        if( pPreferences->joy_enabled )
1951
1913
        {
1952
 
                selected_item = static_cast<ListboxTextItem *>( combo_joy->findItemWithText( pJoystick->Get_Name(), NULL ) );
 
1914
                selected_item = static_cast<CEGUI::ListboxTextItem *>( combo_joy->findItemWithText( pJoystick->Get_Name(), NULL ) );
1953
1915
        }
1954
1916
        // disabled
1955
1917
        else
1956
1918
        {
1957
 
                selected_item = static_cast<ListboxTextItem *>( combo_joy->getListboxItemFromIndex( 0 ) );
 
1919
                selected_item = static_cast<CEGUI::ListboxTextItem *>( combo_joy->getListboxItemFromIndex( 0 ) );
1958
1920
        }
1959
1921
        // set Item
1960
1922
        combo_joy->setText( selected_item->getText() );
1961
1923
 
1962
 
        combo_joy->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Controls::joy_name_Select, this ) );
 
1924
        combo_joy->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_Name_Select, this ) );
1963
1925
 
1964
1926
        // Joystick analog jump
1965
 
        Combobox *combo_joy_analog_jump = static_cast<Combobox *>(WindowManager::getSingleton().getWindow( "combo_joy_analog_jump" ));
 
1927
        CEGUI::Combobox *combo_joy_analog_jump = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_joy_analog_jump" ));
1966
1928
 
1967
 
        item = new ListboxTextItem( "On", 0 );
1968
 
        item->setTextColours( colour( 0, 1, 0 ) );
 
1929
        item = new CEGUI::ListboxTextItem( _("On"), 0 );
 
1930
        item->setTextColours( CEGUI::colour( 0, 0, 1 ) );
1969
1931
        combo_joy_analog_jump->addItem( item );
1970
 
        item = new ListboxTextItem( "Off", 1 );
1971
 
        item->setTextColours( colour( 0, 0, 1 ) );
 
1932
        item = new CEGUI::ListboxTextItem( _("Off"), 1 );
 
1933
        item->setTextColours( CEGUI::colour( 0, 1, 0 ) );
1972
1934
        combo_joy_analog_jump->addItem( item );
1973
1935
 
1974
1936
        if( pPreferences->joy_analog_jump )
1975
1937
        {
1976
 
                combo_joy_analog_jump->setText( "On" );
 
1938
                combo_joy_analog_jump->setText( _("On") );
1977
1939
        }
1978
1940
        else
1979
1941
        {
1980
 
                combo_joy_analog_jump->setText( "Off" );
 
1942
                combo_joy_analog_jump->setText( _("Off") );
1981
1943
        }
1982
1944
 
1983
 
        combo_joy_analog_jump->subscribeEvent( Combobox::EventListSelectionAccepted, Event::Subscriber( &cMenu_Options_Controls::joy_analog_jump_Select, this ) );
 
1945
        combo_joy_analog_jump->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_Analog_Jump_Select, this ) );
 
1946
 
 
1947
        // Joystick axis horizontal
 
1948
        CEGUI::Spinner *spinner_joystick_axis_hor = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_joystick_axis_hor" ));
 
1949
        spinner_joystick_axis_hor->setCurrentValue( static_cast<float>(pPreferences->joy_axis_hor) );
 
1950
        spinner_joystick_axis_hor->subscribeEvent( CEGUI::Spinner::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_Spinner_Axis_Hor_Changed, this ) );
 
1951
 
 
1952
        // Joystick axis vertical
 
1953
        CEGUI::Spinner *spinner_joystick_axis_ver = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_joystick_axis_ver" ));
 
1954
        spinner_joystick_axis_ver->setCurrentValue( static_cast<float>(pPreferences->joy_axis_ver) );
 
1955
        spinner_joystick_axis_ver->subscribeEvent( CEGUI::Spinner::EventValueChanged, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_Spinner_Axis_Ver_Changed, this ) );
 
1956
 
 
1957
        // Joystick listbox
 
1958
        CEGUI::MultiColumnList *listbox_joystick = static_cast<CEGUI::MultiColumnList *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_joystick" ));
 
1959
 
 
1960
        listbox_joystick->addColumn( UTF8_("Name"), 0, CEGUI::UDim( 0.47f, 0 ) );
 
1961
        listbox_joystick->addColumn( UTF8_("Button"), 1, CEGUI::UDim( 0.47f, 0 ) );
 
1962
        Build_Shortcut_List( 1 );
 
1963
 
 
1964
        listbox_joystick->subscribeEvent( CEGUI::MultiColumnList::EventMouseDoubleClick, CEGUI::Event::Subscriber( &cMenu_Options_Controls::Joystick_List_Double_Click, this ) );
1984
1965
}
1985
1966
 
1986
1967
void cMenu_Options_Controls :: Update( void )
2001
1982
        }
2002
1983
 
2003
1984
        action = 0;
2004
 
 
2005
 
        // Joystick name
2006
 
        if( pMenuCore->handler->active == 17 )
2007
 
        {
2008
 
                // Get Joy Combo
2009
 
                Combobox *combo_joy = static_cast<Combobox *>( WindowManager::getSingleton().getWindow( "combo_joy" ) );
 
1985
}
 
1986
 
 
1987
void cMenu_Options_Controls :: Draw( void )
 
1988
{
 
1989
        cMenu_Options::Draw();
 
1990
 
 
1991
        if( pPreferences->joy_enabled )
 
1992
        {
 
1993
                gamepad->Draw();
 
1994
        }
 
1995
 
 
1996
        Draw_End();
 
1997
}
 
1998
 
 
1999
void cMenu_Options_Controls :: Build_Shortcut_List( bool joystick /* = 0 */ )
 
2000
{
 
2001
        // Get Listbox
 
2002
        CEGUI::MultiColumnList *listbox = NULL;
 
2003
 
 
2004
        // Keyboard
 
2005
        if( !joystick )
 
2006
        {
 
2007
                listbox = static_cast<CEGUI::MultiColumnList *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_keyboard" ));
 
2008
        }
 
2009
        // Joystick
 
2010
        else
 
2011
        {
 
2012
                listbox = static_cast<CEGUI::MultiColumnList *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_joystick" ));
 
2013
        }
 
2014
 
 
2015
        listbox->resetList();
 
2016
 
 
2017
        // build shortcut list
 
2018
        vector<cShortcut_item> shortcuts;
 
2019
 
 
2020
        // only keyboard
 
2021
        if( !joystick )
 
2022
        {
 
2023
                shortcuts.push_back( cShortcut_item( _("Up"), INP_UP ) );
 
2024
                shortcuts.push_back( cShortcut_item( _("Down"), INP_DOWN ) );
 
2025
                shortcuts.push_back( cShortcut_item( _("Left"), INP_LEFT ) );
 
2026
                shortcuts.push_back( cShortcut_item( _("Right"), INP_RIGHT ) );
 
2027
        }
 
2028
 
 
2029
        shortcuts.push_back( cShortcut_item( _("Jump"), INP_JUMP ) );
 
2030
        shortcuts.push_back( cShortcut_item( _("Shoot"), INP_SHOOT ) );
 
2031
        shortcuts.push_back( cShortcut_item( _("Action"), INP_ACTION ) );
 
2032
 
 
2033
        // only joystick
 
2034
        if( joystick )
 
2035
        {
 
2036
                shortcuts.push_back( cShortcut_item( _("Item"), INP_ITEM ) );
 
2037
                shortcuts.push_back( cShortcut_item( _("Exit"), INP_EXIT ) );
 
2038
        }
 
2039
 
 
2040
        // add all available shortcuts
 
2041
        for( vector<cShortcut_item>::iterator itr = shortcuts.begin(), itr_end = shortcuts.end(); itr != itr_end; ++itr )
 
2042
        {
 
2043
                cShortcut_item shortcut_item = (*itr);
2010
2044
                
2011
 
                // selected item id
2012
 
                int selected_item = 0;
2013
 
                // current list item
2014
 
                ListboxTextItem *list_item = static_cast<ListboxTextItem *>( combo_joy->findItemWithText( combo_joy->getText(), NULL ) );
2015
 
 
2016
 
                // if selected
2017
 
                if( list_item )
2018
 
                {
2019
 
                        selected_item = combo_joy->getItemIndex( list_item );
2020
 
                }
2021
 
 
2022
 
                // select first
2023
 
                if( selected_item >= SDL_NumJoysticks() )
2024
 
                {
2025
 
                        selected_item = 0;
2026
 
                }
2027
 
                // select next item
2028
 
                else
2029
 
                {
2030
 
                        selected_item++;
2031
 
                }
2032
 
 
2033
 
                // Disable Joy
2034
 
                if( selected_item == 0 )
2035
 
                {
2036
 
                        Joy_Disable();
2037
 
                }
2038
 
                // Select Joy
2039
 
                else
2040
 
                {
2041
 
                        Joy_Default( selected_item - 1 );
2042
 
                }
2043
 
 
2044
 
                // check if initialization succeeded
2045
 
                if( selected_item )
2046
 
                {
2047
 
                        // initialised
2048
 
                        if( pPreferences->joy_enabled )
2049
 
                        {
2050
 
                                Draw_StaticText( "Enabled : " + pJoystick->Get_Name(), &yellow );
2051
 
                        }
2052
 
                        // failed
2053
 
                        else
2054
 
                        {
2055
 
                                selected_item = 0;
2056
 
                        }
2057
 
                }
2058
 
 
2059
 
                combo_joy->setText( combo_joy->getListboxItemFromIndex( selected_item )->getText() );
2060
 
        }
2061
 
 
2062
 
        // Joystick analog jump
2063
 
        if( pMenuCore->handler->active == 18 )
2064
 
        {
2065
 
                pPreferences->joy_analog_jump = !pPreferences->joy_analog_jump;
2066
 
 
2067
 
                if( pPreferences->joy_analog_jump )
2068
 
                {
2069
 
                        WindowManager::getSingleton().getWindow( "combo_joy_analog_jump" )->setText( "On" );
2070
 
                }
2071
 
                else
2072
 
                {
2073
 
                        WindowManager::getSingleton().getWindow( "combo_joy_analog_jump" )->setText( "Off" );
2074
 
                }
2075
 
        }
2076
 
 
2077
 
        // Keys / Joy Buttons
2078
 
        if( pMenuCore->handler->active > 16 )
2079
 
        {
2080
 
                return;
2081
 
        }
2082
 
 
2083
 
        Draw_StaticText( "Press a key. ( ESC to cancel )", &orange, NULL, 0 );
 
2045
                CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( shortcut_item.m_name, shortcut_item.m_id );
 
2046
                //item->setTextColours( colour( 0.6f, 0.6f, 0.6f ) );
 
2047
                item->setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
 
2048
                item->setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
 
2049
                unsigned int row_id = listbox->addRow( item, 0 );
 
2050
 
 
2051
                // Get shortcut key name
 
2052
                string shortcut_key;
 
2053
                // Keyboard
 
2054
                if( !joystick )
 
2055
                {
 
2056
                        SDLKey *key = pKeyboard->Get_Shortcut( shortcut_item.m_id );
 
2057
                        shortcut_key = SDL_GetKeyName( *key );
 
2058
                }
 
2059
                // Joystick
 
2060
                else
 
2061
                {
 
2062
                        Uint8 *button = pJoystick->Get_Shortcut( shortcut_item.m_id );
 
2063
                        shortcut_key = int_to_string( *button );
 
2064
                }
 
2065
 
 
2066
                item = new CEGUI::ListboxTextItem( shortcut_key, 0 );
 
2067
                //item->setTextColours( colour( 0.6f, 0.6f, 0.6f ) );
 
2068
                item->setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
 
2069
                item->setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
 
2070
                listbox->setItem( item, 1, row_id );
 
2071
        }
 
2072
}
 
2073
 
 
2074
void cMenu_Options_Controls :: Set_Shortcut( string shortcut_name, input_identifier shortcut_id, bool joystick /* = 0 */ )
 
2075
{
 
2076
        string info_text;
 
2077
 
 
2078
        if( !joystick )
 
2079
        {
 
2080
                info_text += _("Press a key");
 
2081
        }
 
2082
        else
 
2083
        {
 
2084
                info_text += _("Press a button");
 
2085
        }
 
2086
 
 
2087
        Draw_Static_Text( info_text + _(" for ") + shortcut_name + _(". Press ESC to cancel."), &orange, NULL, 0 );
2084
2088
 
2085
2089
        bool sub_done = 0;
2086
2090
 
2092
2096
                        continue;
2093
2097
                }
2094
2098
 
2095
 
                if( input_event.type != SDL_KEYDOWN && input_event.type != SDL_JOYBUTTONDOWN )
2096
 
                {
2097
 
                        continue;
2098
 
                }
2099
 
 
2100
2099
                if( input_event.key.keysym.sym == SDLK_ESCAPE || input_event.key.keysym.sym == SDLK_BACKSPACE )
2101
2100
                {
2102
2101
                        sub_done = 1;
2103
2102
                        break;
2104
2103
                }
2105
2104
 
2106
 
                switch( pMenuCore->handler->active )
2107
 
                {
2108
 
                // up
2109
 
                case 5:
2110
 
                {
2111
 
                        pPreferences->key_up = input_event.key.keysym.sym; 
2112
 
                        keyboard_up_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_up ), black ), 1, 1 );
2113
 
                        break;
2114
 
                }
2115
 
                // down
2116
 
                case 6:
2117
 
                {
2118
 
                        pPreferences->key_down = input_event.key.keysym.sym; 
2119
 
                        keyboard_down_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_down ), black ), 1, 1 );
2120
 
                        break;
2121
 
                }
2122
 
                // left
2123
 
                case 7:
2124
 
                {
2125
 
                        pPreferences->key_left = input_event.key.keysym.sym; 
2126
 
                        keyboard_left_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_left ), black ), 1, 1 );
2127
 
                        break;
2128
 
                }
2129
 
                // right
2130
 
                case 8:
2131
 
                {
2132
 
                        pPreferences->key_right = input_event.key.keysym.sym; 
2133
 
                        keyboard_right_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_right ), black ), 1, 1 );
2134
 
                        break;
2135
 
                }
2136
 
                // jump
2137
 
                case 9:
2138
 
                {
2139
 
                        pPreferences->key_jump = input_event.key.keysym.sym; 
2140
 
                        keyboard_jump_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_jump ), black ), 1, 1 );
2141
 
                        break;
2142
 
                }
2143
 
                // shoot
2144
 
                case 10:
2145
 
                {
2146
 
                        pPreferences->key_shoot = input_event.key.keysym.sym; 
2147
 
                        keyboard_shoot_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_shoot ), black ), 1, 1 );
2148
 
                        break;
2149
 
                }
2150
 
                // action
2151
 
                case 11:
2152
 
                {
2153
 
                        pPreferences->key_action = input_event.key.keysym.sym; 
2154
 
                        keyboard_action_keyname->Set_Image( pFont->RenderText( pFont->font_normal, SDL_GetKeyName( pPreferences->key_action ), black ), 1, 1 );
2155
 
                        break;
2156
 
                }
2157
 
                // joy jump
2158
 
                case 12:
2159
 
                {
2160
 
                        pPreferences->joy_button_jump = input_event.jbutton.button; 
2161
 
                        joypad_jump_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_jump ), black ), 1, 1 );
2162
 
                        break;
2163
 
                }
2164
 
                // joy item
2165
 
                case 13:
2166
 
                {
2167
 
                        pPreferences->joy_button_item = input_event.jbutton.button; 
2168
 
                        joypad_item_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_item ), black ), 1, 1 );
2169
 
                        break;
2170
 
                }
2171
 
                // joy shoot
2172
 
                case 14:
2173
 
                {
2174
 
                        pPreferences->joy_button_shoot = input_event.jbutton.button; 
2175
 
                        joypad_shoot_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_shoot ), black ), 1, 1 );
2176
 
                        break;
2177
 
                }
2178
 
                // joy action
2179
 
                case 15:
2180
 
                {
2181
 
                        pPreferences->joy_button_action = input_event.jbutton.button; 
2182
 
                        joypad_action_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_action ), black ), 1, 1 );
2183
 
                        break;
2184
 
                }
2185
 
                // joy exit
2186
 
                case 16:
2187
 
                {
2188
 
                        pPreferences->joy_button_exit = input_event.jbutton.button; 
2189
 
                        joypad_exit_keyname->Set_Image( pFont->RenderText( pFont->font_normal, int_to_string( pPreferences->joy_button_exit ), black ), 1, 1 );
2190
 
                        break;
2191
 
                }
2192
 
                default:
2193
 
                {
2194
 
                        break;
2195
 
                }
 
2105
                if( !joystick && input_event.type != SDL_KEYDOWN )
 
2106
                {
 
2107
                        continue;
 
2108
                }
 
2109
                else if( joystick && input_event.type != SDL_JOYBUTTONDOWN )
 
2110
                {
 
2111
                        continue;
 
2112
                }
 
2113
 
 
2114
                // Keyboard
 
2115
                if( !joystick )
 
2116
                {
 
2117
                        pKeyboard->Assign_Shortcut( shortcut_id, input_event.key.keysym.sym );
 
2118
                }
 
2119
                // Joystick
 
2120
                else
 
2121
                {
 
2122
                        pJoystick->Assign_Shortcut( shortcut_id, input_event.jbutton.button );
2196
2123
                }
2197
2124
 
2198
2125
                sub_done = 1;
2199
2126
        }
2200
 
}
2201
 
 
2202
 
void cMenu_Options_Controls :: Draw( void )
2203
 
{
2204
 
        cMenu_Options::Draw();
2205
 
 
2206
 
        // Keyboard
2207
 
        keyboard_up_keyname->Draw();
2208
 
        keyboard_down_keyname->Draw();
2209
 
        keyboard_left_keyname->Draw();
2210
 
        keyboard_right_keyname->Draw();
2211
 
        keyboard_jump_keyname->Draw();
2212
 
        keyboard_shoot_keyname->Draw();
2213
 
        keyboard_action_keyname->Draw();
2214
 
        // Joypad
2215
 
        joypad_jump_keyname->Draw();
2216
 
        joypad_item_keyname->Draw();
2217
 
        joypad_shoot_keyname->Draw();
2218
 
        joypad_action_keyname->Draw();
2219
 
        joypad_exit_keyname->Draw();
2220
 
 
2221
 
        if( pPreferences->joy_enabled )
2222
 
        {
2223
 
                gamepad->Draw();
2224
 
        }
2225
 
 
2226
 
        Draw_End();
 
2127
 
 
2128
        Build_Shortcut_List( joystick );
2227
2129
}
2228
2130
 
2229
2131
void cMenu_Options_Controls :: Joy_Default( unsigned int index )
2244
2146
        pJoystick->Stick_Close();
2245
2147
}
2246
2148
 
2247
 
bool cMenu_Options_Controls :: joy_name_Select( const EventArgs &event )
2248
 
{
2249
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
2250
 
        Combobox *combo = static_cast<Combobox*>( windowEventArgs.window );
2251
 
        ListboxItem *item = combo->getSelectedItem();
2252
 
 
2253
 
        if( item->getText().compare( "None" ) == 0 )
 
2149
bool cMenu_Options_Controls :: Keyboard_List_Double_Click( const CEGUI::EventArgs &event )
 
2150
{
 
2151
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2152
        CEGUI::ListboxItem *item = static_cast<CEGUI::MultiColumnList *>( windowEventArgs.window )->getFirstSelectedItem();
 
2153
 
 
2154
        // set shortcut
 
2155
        if( item )
 
2156
        {
 
2157
                Set_Shortcut( item->getText().c_str(), static_cast<input_identifier>(item->getID()) );
 
2158
        }
 
2159
 
 
2160
        return 1;
 
2161
}
 
2162
 
 
2163
bool cMenu_Options_Controls :: Keyboard_Slider_Scroll_Speed_Changed( const CEGUI::EventArgs &event )
 
2164
{
 
2165
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2166
        // set new value
 
2167
        pPreferences->scroll_speed = static_cast<CEGUI::Slider *>( windowEventArgs.window )->getCurrentValue();
 
2168
 
 
2169
        return 1;
 
2170
}
 
2171
 
 
2172
bool cMenu_Options_Controls :: Joystick_Name_Click( const CEGUI::EventArgs &event )
 
2173
{
 
2174
        // Get Joystick Combo
 
2175
        CEGUI::Combobox *combo_joy = static_cast<CEGUI::Combobox *>( CEGUI::WindowManager::getSingleton().getWindow( "combo_joy" ) );
 
2176
        
 
2177
        // selected item id
 
2178
        int selected_item = 0;
 
2179
        // current list item
 
2180
        CEGUI::ListboxTextItem *list_item = static_cast<CEGUI::ListboxTextItem *>( combo_joy->findItemWithText( combo_joy->getText(), NULL ) );
 
2181
 
 
2182
        // if selected
 
2183
        if( list_item )
 
2184
        {
 
2185
                selected_item = combo_joy->getItemIndex( list_item );
 
2186
        }
 
2187
 
 
2188
        // select first
 
2189
        if( selected_item >= SDL_NumJoysticks() )
 
2190
        {
 
2191
                selected_item = 0;
 
2192
        }
 
2193
        // select next item
 
2194
        else
 
2195
        {
 
2196
                selected_item++;
 
2197
        }
 
2198
 
 
2199
        // Disable Joy
 
2200
        if( selected_item == 0 )
 
2201
        {
 
2202
                Joy_Disable();
 
2203
        }
 
2204
        // Select Joy
 
2205
        else
 
2206
        {
 
2207
                Joy_Default( selected_item - 1 );
 
2208
        }
 
2209
 
 
2210
        // check if initialization succeeded
 
2211
        if( selected_item )
 
2212
        {
 
2213
                // initialised
 
2214
                if( pPreferences->joy_enabled )
 
2215
                {
 
2216
                        Draw_Static_Text( _("Enabled : ") + pJoystick->Get_Name(), &yellow );
 
2217
                }
 
2218
                // failed
 
2219
                else
 
2220
                {
 
2221
                        selected_item = 0;
 
2222
                }
 
2223
        }
 
2224
 
 
2225
        combo_joy->setText( combo_joy->getListboxItemFromIndex( selected_item )->getText() );
 
2226
 
 
2227
        return 1;
 
2228
}
 
2229
 
 
2230
bool cMenu_Options_Controls :: Joystick_Analog_Jump_Click( const CEGUI::EventArgs &event )
 
2231
{
 
2232
        pPreferences->joy_analog_jump = !pPreferences->joy_analog_jump;
 
2233
 
 
2234
        if( pPreferences->joy_analog_jump )
 
2235
        {
 
2236
                CEGUI::WindowManager::getSingleton().getWindow( "combo_joy_analog_jump" )->setText( _("On") );
 
2237
        }
 
2238
        else
 
2239
        {
 
2240
                CEGUI::WindowManager::getSingleton().getWindow( "combo_joy_analog_jump" )->setText( _("Off") );
 
2241
        }
 
2242
 
 
2243
        return 1;
 
2244
}
 
2245
 
 
2246
bool cMenu_Options_Controls :: Joystick_Name_Select( const CEGUI::EventArgs &event )
 
2247
{
 
2248
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2249
        CEGUI::Combobox *combo = static_cast<CEGUI::Combobox*>( windowEventArgs.window );
 
2250
        CEGUI::ListboxItem *item = combo->getSelectedItem();
 
2251
 
 
2252
        if( item->getText().compare( _("None") ) == 0 )
2254
2253
        {
2255
2254
                Joy_Disable();
2256
2255
        }
2262
2261
        return 1;
2263
2262
}
2264
2263
 
2265
 
bool cMenu_Options_Controls :: joy_analog_jump_Select( const EventArgs &event )
 
2264
bool cMenu_Options_Controls :: Joystick_Analog_Jump_Select( const CEGUI::EventArgs &event )
2266
2265
{
2267
 
        const WindowEventArgs &windowEventArgs = static_cast<const WindowEventArgs&>( event );
2268
 
        ListboxItem *item = static_cast<Combobox*>( windowEventArgs.window )->getSelectedItem();
 
2266
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2267
        CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox*>( windowEventArgs.window )->getSelectedItem();
2269
2268
 
2270
2269
        bool analog_jump = 0;
2271
2270
 
2272
 
        if( item->getText().compare( "On" ) == 0 )
 
2271
        if( item->getText().compare( _("On") ) == 0 )
2273
2272
        {
2274
2273
                analog_jump = 1;
2275
2274
        }
2279
2278
        return 1;
2280
2279
}
2281
2280
 
 
2281
bool cMenu_Options_Controls :: Joystick_Spinner_Axis_Hor_Changed( const CEGUI::EventArgs &event )
 
2282
{
 
2283
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2284
        // set new value
 
2285
        pPreferences->joy_axis_hor = static_cast<int>(static_cast<CEGUI::Spinner *>( windowEventArgs.window )->getCurrentValue());
 
2286
 
 
2287
        return 1;
 
2288
}
 
2289
 
 
2290
bool cMenu_Options_Controls :: Joystick_Spinner_Axis_Ver_Changed( const CEGUI::EventArgs &event )
 
2291
{
 
2292
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2293
        // set new value
 
2294
        pPreferences->joy_axis_ver = static_cast<int>(static_cast<CEGUI::Spinner *>( windowEventArgs.window )->getCurrentValue());
 
2295
 
 
2296
        return 1;
 
2297
}
 
2298
 
 
2299
bool cMenu_Options_Controls :: Joystick_List_Double_Click( const CEGUI::EventArgs &event )
 
2300
{
 
2301
        const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
 
2302
        CEGUI::ListboxItem *item = static_cast<CEGUI::MultiColumnList *>( windowEventArgs.window )->getFirstSelectedItem();
 
2303
 
 
2304
        // set shortcut
 
2305
        if( item )
 
2306
        {
 
2307
                Set_Shortcut( item->getText().c_str(), static_cast<input_identifier>(item->getID()), 1 );
 
2308
        }
 
2309
 
 
2310
        return 1;
 
2311
}
 
2312
 
2282
2313
/* *** *** *** *** *** *** *** *** cMenu_Savegames *** *** *** *** *** *** *** *** *** */
2283
2314
 
2284
2315
cMenu_Savegames :: cMenu_Savegames( bool ntype_save )
2308
2339
 
2309
2340
        cMenu_Item *temp_item = NULL;
2310
2341
 
2311
 
        GL_Surface *back1 = pFont->RenderText( pFont->font_normal, "Back", text_color );
 
2342
        GL_Surface *back1 = pFont->Render_Text( pFont->font_normal, _("Back"), text_color );
2312
2343
 
2313
 
        Update_SavedGames_Text();
 
2344
        Update_Saved_Games_Text();
2314
2345
 
2315
2346
        // savegame descriptions
2316
2347
        for( HudSpriteList::iterator itr = savegame_temp.begin(), itr_end = savegame_temp.end(); itr != itr_end; ++itr )
2317
2348
        {
2318
2349
                temp_item = new cMenu_Item();
2319
2350
                temp_item->image_default->Set_Image( (*itr)->image );
2320
 
                temp_item->Set_Pos( GAME_RES_W / 5, menu_posy );
2321
 
                pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
 
2351
                temp_item->Set_Pos( static_cast<float>(game_res_w) / 5, menu_posy );
 
2352
                pMenuCore->handler->Add_Menu_Item( temp_item, 1.5f, grey );
2322
2353
                
2323
2354
                menu_posy += temp_item->image_default->col_rect.h;
2324
2355
        }
2326
2357
        // back
2327
2358
        temp_item = new cMenu_Item();
2328
2359
        temp_item->image_default->Set_Image( back1 );
2329
 
        temp_item->Set_Pos( GAME_RES_W / 18, 450 );
 
2360
        temp_item->Set_Pos( static_cast<float>(game_res_w) / 18, 450 );
2330
2361
        temp_item->isquit = 1;
2331
 
        pMenuCore->handler->Add_MenuItem( temp_item, 1.5f, grey );
 
2362
        pMenuCore->handler->Add_Menu_Item( temp_item, 1.5f, grey );
2332
2363
 
2333
2364
        if( type_save )
2334
2365
        {
2335
 
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/save.png" ), GAME_RES_W * 0.5f, GAME_RES_H * 0.1f ) );
2336
 
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/save.png" ), GAME_RES_W * 0.07f, GAME_RES_H * 0.24f ) );
 
2366
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/save.png" ), game_res_w * 0.5f, game_res_h * 0.1f ) );
 
2367
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/save.png" ), game_res_w * 0.07f, game_res_h * 0.24f ) );
2337
2368
        }
2338
2369
        else
2339
2370
        {
2340
 
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/load.png" ), GAME_RES_W * 0.5f, GAME_RES_H * 0.1f ) );
2341
 
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/load.png" ), GAME_RES_W * 0.07f, GAME_RES_H * 0.24f ) );
 
2371
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/load.png" ), game_res_w * 0.5f, game_res_h * 0.1f ) );
 
2372
                drawlist.push_back( new cHudSprite( pVideo->Get_Surface( "menu/items/load.png" ), game_res_w * 0.07f, game_res_h * 0.24f ) );
2342
2373
        }
2343
2374
        drawlist.push_back( new cHudSprite( back1, -200, 0, 1 ) );
2344
2375
 
2393
2424
void cMenu_Savegames :: Update_Load( void )
2394
2425
{
2395
2426
        // savegame
2396
 
        if( pSavegame->is_valid( pMenuCore->handler->active + 1 ) )
 
2427
        if( pSavegame->Is_Valid( pMenuCore->handler->active + 1 ) )
2397
2428
        {
2398
 
                pAudio->FadeOutMusic( 1000 );
2399
 
                pAudio->PlaySound( "savegame_load.ogg" );
 
2429
                pAudio->Fadeout_Music( 1000 );
 
2430
                pAudio->Play_Sound( "savegame_load.ogg" );
2400
2431
 
2401
2432
                int save_type = pSavegame->Load_Game( pMenuCore->handler->active + 1 );
2402
2433
 
2416
2447
void cMenu_Savegames :: Update_Save( void )
2417
2448
{
2418
2449
        // savegame
2419
 
        if( pOverworld_Player->current_waypoint >= 0 || pLevel->is_Loaded() )
 
2450
        if( pOverworld_Player->current_waypoint >= 0 || pActive_Level->Is_Loaded() )
2420
2451
        {
2421
 
                string descripion = Set_SaveDescription( pMenuCore->handler->active + 1 );
 
2452
                string descripion = Set_Save_Description( pMenuCore->handler->active + 1 );
2422
2453
                
2423
2454
                pFramerate->Reset();
2424
2455
 
2434
2465
                        return;
2435
2466
                }
2436
2467
 
2437
 
                pAudio->PlaySound( "savegame_save.ogg" );
 
2468
                pAudio->Play_Sound( "savegame_save.ogg" );
2438
2469
 
2439
2470
                // no costs in debug builds
2440
2471
#ifndef _DEBUG
2441
 
                if( pLevel->is_Loaded() )
 
2472
                if( pActive_Level->Is_Loaded() )
2442
2473
                {
2443
2474
                        pointsdisplay->Set_Points( pPlayer->points - 3000 );
2444
2475
                }
2450
2481
                pMenuCore->next_menu = MENU_MAIN;
2451
2482
        }
2452
2483
}
2453
 
string cMenu_Savegames :: Set_SaveDescription( unsigned int save_slot )
 
2484
string cMenu_Savegames :: Set_Save_Description( unsigned int save_slot )
2454
2485
{
2455
2486
        if( save_slot == 0 || save_slot > 9 )
2456
2487
        {
2458
2489
        }
2459
2490
// save always in debug builds
2460
2491
#ifndef _DEBUG
2461
 
        if( pLevel->is_Loaded() && pPlayer->points < 3000 )
 
2492
        if( pActive_Level->Is_Loaded() && pPlayer->points < 3000 )
2462
2493
        {
2463
 
                ClearInputEvents();
2464
 
                Draw_StaticText( "3000 Points needed for saving in a level.\nSaving on the Overworld is free." );
 
2494
                Clear_Input_Events();
 
2495
                Draw_Static_Text( _("3000 Points needed for saving in a level.\nSaving on the Overworld is free.") );
2465
2496
 
2466
2497
                return "Not enough Points";
2467
2498
        }
2471
2502
        bool auto_erase_description = 0;
2472
2503
 
2473
2504
        // if Savegame exists use old description
2474
 
        if( pSavegame->is_valid( save_slot ) )
 
2505
        if( pSavegame->Is_Valid( save_slot ) )
2475
2506
        {
2476
2507
                save_description.clear();
2477
2508
                // get only the description
2480
2511
        else
2481
2512
        {
2482
2513
                // use default description
2483
 
                save_description = "No Description";
 
2514
                save_description = _("No Description");
2484
2515
                auto_erase_description = 1;
2485
2516
        }
2486
2517
 
2487
 
        return Box_Text_Input( save_description, "Enter Description", auto_erase_description );
 
2518
        return Box_Text_Input( save_description, _("Enter Description"), auto_erase_description );
2488
2519
}
2489
2520
 
2490
 
void cMenu_Savegames :: Update_SavedGames_Text( void )
 
2521
void cMenu_Savegames :: Update_Saved_Games_Text( void )
2491
2522
{
2492
2523
        unsigned int save_slot = 0;
2493
2524
 
2494
2525
        for( HudSpriteList::iterator itr = savegame_temp.begin(), itr_end = savegame_temp.end(); itr != itr_end; ++itr )
2495
2526
        {
2496
2527
                save_slot++;
2497
 
                (*itr)->Set_Image( pFont->RenderText( pFont->font_normal, pSavegame->Get_Description( save_slot ), text_color_value ), 1, 1 );
 
2528
                (*itr)->Set_Image( pFont->Render_Text( pFont->font_normal, pSavegame->Get_Description( save_slot ), text_color_value ), 1, 1 );
2498
2529
        }
2499
2530
}
2500
2531
 
2513
2544
 
2514
2545
void cMenu_Credits :: Init( void )
2515
2546
{
2516
 
        pAudio->PlayMusic( "land/hyper_1.ogg", -1, 1, 1500 );
 
2547
        pAudio->Play_Music( "land/hyper_1.ogg", -1, 1, 1500 );
2517
2548
 
2518
2549
        cMenu_Base::Init();
2519
2550
 
2520
 
        pAudio->FadeOutMusic( 1500 );
 
2551
        pAudio->Fadeout_Music( 1500 );
2521
2552
 
2522
2553
        cMenu_Item *temp_item = NULL;
2523
 
        menu_posy = GAME_RES_H * 1.1f;
 
2554
        menu_posy = game_res_h * 1.1f;
2524
2555
 
2525
2556
        // black background
2526
2557
        glClearColor( 0, 0, 0, 1 );
2548
2579
 
2549
2580
                pFramerate->Update();
2550
2581
                // maximum fps
2551
 
                CorrectFrameTime( 100 );
 
2582
                Correct_Frame_Time( 100 );
2552
2583
 
2553
2584
                // set menu gradient colors
2554
2585
                pMenuCore->handler->color_start.alpha = 255 - static_cast<Uint8>(i);
2555
2586
                pMenuCore->handler->color_end.alpha = pMenuCore->handler->color_start.alpha;
2556
2587
        }
2557
2588
 
2558
 
        GL_Surface *back1 = pFont->RenderText( pFont->font_normal, "Back", text_color );
 
2589
        GL_Surface *back1 = pFont->Render_Text( pFont->font_normal, _("Back"), text_color );
2559
2590
 
2560
2591
        // clear credits
2561
2592
        drawlist.clear();
2562
2593
 
2563
2594
        // add credits texts
2564
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Florian Richter (FluXy)", white ), 0, 20, 1 ) );
 
2595
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Florian Richter (FluXy)", white ), 0, 20, 1 ) );
2565
2596
        drawlist.back()->Set_Shadow( black, 1 );
2566
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Dedicated Developer", white ), 0, -3, 1 ) );
2567
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Organizer and Project Leader", white ), 0, -3, 1 ) );
 
2597
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Dedicated Developer", white ), 0, -3, 1 ) );
 
2598
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Organizer and Project Leader", white ), 0, -3, 1 ) );
2568
2599
 
2569
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Holger Fey (Nemo)", white ), 0, 20, 1 ) );
 
2600
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Holger Fey (Nemo)", white ), 0, 20, 1 ) );
2570
2601
        drawlist.back()->Set_Shadow( lila, 1 );
2571
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Game Tester", white ), 0, -3, 1 ) );
2572
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - German Publicity", white ), 0, -3, 1 ) );
2573
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Torrent Packager", white ), 0, -3, 1 ) );
 
2602
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Game Tester", white ), 0, -3, 1 ) );
 
2603
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - German Publicity", white ), 0, -3, 1 ) );
 
2604
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Torrent Packager", white ), 0, -3, 1 ) );
2574
2605
 
2575
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Grant ... (youngheart80)", white ), 0, 20, 1 ) );
 
2606
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Grant ... (youngheart80)", white ), 0, 20, 1 ) );
2576
2607
        drawlist.back()->Set_Shadow( green, 1 );
2577
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
2578
 
 
2579
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Mark Richards (dteck)", white ), 0, 20, 1 ) );
2580
 
        drawlist.back()->Set_Shadow( blue, 1 );
2581
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2608
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
2582
2609
 
2583
2610
        // Most Valued Persons (MVP)
2584
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "-- Most Valued Persons (MVP) --", white ), 0, 20, 1 ) );
 
2611
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "-- Most Valued Persons (MVP) --", white ), 0, 20, 1 ) );
2585
2612
        drawlist.back()->Set_Shadow( lightgrey, 1 );
2586
2613
 
2587
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Tristan Heaven (nyhm)", white ), 0, 20, 1 ) );
2588
 
        drawlist.back()->Set_Shadow( lightblue, 1 );
2589
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Gentoo eBuild Maintainer", white ), 0, -3, 1 ) );
2590
 
 
2591
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Muammar El Khatib (muammar)", white ), 0, 20, 1 ) );
2592
 
        drawlist.back()->Set_Shadow( lightred, 1 );
2593
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Debian Package Maintainer", white ), 0, -3, 1 ) );
2594
 
 
2595
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Robert W... (BowserJr)", white ), 0, 20, 1 ) );
 
2614
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "... (Helios)", white ), 0, 20, 1 ) );
 
2615
        drawlist.back()->Set_Shadow( Color( 0.8f, 0.8f, 0.1f ), 1 );
 
2616
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2617
 
 
2618
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Robert W... (BowserJr)", white ), 0, 20, 1 ) );
2596
2619
        drawlist.back()->Set_Shadow( lightgreen, 1 );
2597
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Forum and Wiki Moderator", white ), 0, -3, 1 ) );
 
2620
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Forum and Wiki Moderator", white ), 0, -3, 1 ) );
 
2621
 
 
2622
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "... (Sauer2)", white ), 0, 20, 1 ) );
 
2623
        drawlist.back()->Set_Shadow( Color( 0.1f, 0.6f, 0.1f ), 1 );
 
2624
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Level Contributor", white ), 0, -3, 1 ) );
 
2625
 
 
2626
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "... (Simpletoon)", white ), 0, 20, 1 ) );
 
2627
        drawlist.back()->Set_Shadow( Color( 0.2f, 0.2f, 0.8f ), 1 );
 
2628
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Developer", white ), 0, -3, 1 ) );
 
2629
 
 
2630
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Markus Hiebl (Frostbringer)", white ), 0, 20, 1 ) );
 
2631
        drawlist.back()->Set_Shadow( Color( 0.9f, 0.1f, 0.8f ), 1 );
 
2632
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2633
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Level Contributor", white ), 0, -3, 1 ) );
 
2634
 
 
2635
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Tristan Heaven (nyhm)", white ), 0, 20, 1 ) );
 
2636
        drawlist.back()->Set_Shadow( lightblue, 1 );
 
2637
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Gentoo eBuild Maintainer", white ), 0, -3, 1 ) );
 
2638
 
 
2639
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Muammar El Khatib (muammar)", white ), 0, 20, 1 ) );
 
2640
        drawlist.back()->Set_Shadow( lightred, 1 );
 
2641
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Debian Package Maintainer", white ), 0, -3, 1 ) );
 
2642
 
 
2643
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "David Hernandez (vencabot_teppoo)", white ), 0, 20, 1 ) );
 
2644
        drawlist.back()->Set_Shadow( Color( 0.8f, 0.6f, 0.2f ), 1 );
 
2645
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Music Artist", white ), 0, -3, 1 ) );
2598
2646
 
2599
2647
        // Retired
2600
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "-- Retired --", white ), 0, 20, 1 ) );
 
2648
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "-- Retired --", white ), 0, 20, 1 ) );
2601
2649
        drawlist.back()->Set_Shadow( lightgrey, 1 );
2602
2650
 
2603
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Mario Fink (maYO)", white ), 0, 20, 1 ) );
2604
 
        drawlist.back()->Set_Shadow( blue, 1 );
2605
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
2606
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Website Graphic Designer", white ), 0, -3, 1 ) );
2607
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Other Support", white ), 0, -3, 1 ) );
2608
 
 
2609
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Ursula ... (Pipgirl)", white ), 0, 20, 1 ) );
 
2651
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Mark Richards (dteck)", white ), 0, 20, 1 ) );
 
2652
        drawlist.back()->Set_Shadow( blue, 1 );
 
2653
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2654
 
 
2655
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Mario Fink (maYO)", white ), 0, 20, 1 ) );
 
2656
        drawlist.back()->Set_Shadow( blue, 1 );
 
2657
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2658
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Website Graphic Designer", white ), 0, -3, 1 ) );
 
2659
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Other Support", white ), 0, -3, 1 ) );
 
2660
 
 
2661
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "... (Polilla86)", white ), 0, 20, 1 ) );
 
2662
        drawlist.back()->Set_Shadow( Color( 0.7f, 0.1f, 0.2f ), 1 );
 
2663
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2664
 
 
2665
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Ursula ... (Pipgirl)", white ), 0, 20, 1 ) );
2610
2666
        drawlist.back()->Set_Shadow( Color( 0.2f, 0.9f, 0.2f ), 1 );
2611
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2667
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
2612
2668
 
2613
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Tobias Maasland (Weirdnose)", white ), 0, 20, 1 ) );
 
2669
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Tobias Maasland (Weirdnose)", white ), 0, 20, 1 ) );
2614
2670
        drawlist.back()->Set_Shadow( Color( 0.9f, 0.7f, 0.2f ), 1 );
2615
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Level and World Contributor", white ), 0, -3, 1 ) );
2616
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Assistant Developer", white ), 0, -3, 1 ) );
2617
 
 
2618
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Markus Hiebl (Frostbringer)", white ), 0, 20, 1 ) );
2619
 
        drawlist.back()->Set_Shadow( Color( 0.9f, 0.1f, 0.8f ), 1 );
2620
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
2621
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Level Contributor", white ), 0, -3, 1 ) );
2622
 
 
2623
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Robert ... (Consonance)", white ), 0, 20, 1 ) );
 
2671
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Level and World Contributor", white ), 0, -3, 1 ) );
 
2672
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Assistant Developer", white ), 0, -3, 1 ) );
 
2673
 
 
2674
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Robert ... (Consonance)", white ), 0, 20, 1 ) );
2624
2675
        drawlist.back()->Set_Shadow( lightred, 1 );
2625
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Sound and Music Artist", white ), 0, -3, 1 ) );
 
2676
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Sound and Music Artist", white ), 0, -3, 1 ) );
2626
2677
 
2627
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Justin ... (LoXodonte)", white ), 0, 20, 1 ) );
 
2678
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Justin ... (LoXodonte)", white ), 0, 20, 1 ) );
2628
2679
        drawlist.back()->Set_Shadow( lightblue, 1 );
2629
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Music Artist", white ), 0, -3, 1 ) );
 
2680
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Music Artist", white ), 0, -3, 1 ) );
2630
2681
 
2631
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Matt J... (mattwj)", white ), 0, 20, 1 ) );
 
2682
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Matt J... (mattwj)", white ), 0, 20, 1 ) );
2632
2683
        drawlist.back()->Set_Shadow( red, 1 );
2633
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - eDonkey Packager", white ), 0, -3, 1 ) );
2634
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Quality Assurance", white ), 0, -3, 1 ) );
 
2684
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - eDonkey Packager", white ), 0, -3, 1 ) );
 
2685
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Quality Assurance", white ), 0, -3, 1 ) );
2635
2686
 
2636
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Bodhi Crandall-Rus (Boder)", white ), 0, 20, 1 ) );
 
2687
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Bodhi Crandall-Rus (Boder)", white ), 0, 20, 1 ) );
2637
2688
        drawlist.back()->Set_Shadow( green, 1 );
2638
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - All Hands Person", white ), 0, -3, 1 ) );
2639
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Game Tester", white ), 0, -3, 1 ) );
2640
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Assistant Graphic Designer", white ), 0, -3, 1 ) );
 
2689
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - All Hands Person", white ), 0, -3, 1 ) );
 
2690
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Game Tester", white ), 0, -3, 1 ) );
 
2691
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Assistant Graphic Designer", white ), 0, -3, 1 ) );
2641
2692
 
2642
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "John Daly (Johnlein)", white ), 0, 20, 1 ) );
 
2693
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "John Daly (Johnlein)", white ), 0, 20, 1 ) );
2643
2694
        drawlist.back()->Set_Shadow( yellow, 1 );
2644
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
 
2695
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Graphic Designer", white ), 0, -3, 1 ) );
2645
2696
 
2646
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Gustavo Gutierrez (Enzakun)", white ), 0, 20, 1 ) );
 
2697
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Gustavo Gutierrez (Enzakun)", white ), 0, 20, 1 ) );
2647
2698
        drawlist.back()->Set_Shadow( lightred, 1 );
2648
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Maryo Graphic Designer", white ), 0, -3, 1 ) );
 
2699
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Maryo Graphic Designer", white ), 0, -3, 1 ) );
2649
2700
 
2650
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Thomas Huth (Thothy)", white ), 0, 20, 1 ) );
 
2701
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Thomas Huth (Thothy)", white ), 0, 20, 1 ) );
2651
2702
        drawlist.back()->Set_Shadow( greenyellow, 1 );
2652
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, " - Linux Maintainer", white ), 0, -3, 1 ) );
 
2703
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, " - Linux Maintainer", white ), 0, -3, 1 ) );
2653
2704
 
2654
2705
        // Thanks
2655
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "-- Thanks --", white ), 0, 20, 1 ) );
 
2706
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "-- Thanks --", white ), 0, 20, 1 ) );
2656
2707
        drawlist.back()->Set_Shadow( lightblue, 1 );
2657
2708
 
2658
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Jason Cox (XOC)", white ), 0, 0, 1 ) );
2659
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Ricardo Cruz", white ), 0, 0, 1 ) );
2660
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Devendra (Yuki),", white ), 0, 0, 1 ) );
2661
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "Hans de Goede (Hans)", white ), 0, 0, 1 ) );
2662
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "... (xPatrickx)", white ), 0, 0, 1 ) );
2663
 
        drawlist.push_back( new cHudSprite( pFont->RenderText( pFont->font_normal, "... (rolosworld)", white ), 0, 0, 1 ) );
 
2709
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Jason Cox (XOC)", white ), 0, 0, 1 ) );
 
2710
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Ricardo Cruz", white ), 0, 0, 1 ) );
 
2711
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Devendra (Yuki),", white ), 0, 0, 1 ) );
 
2712
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Hans de Goede (Hans)", white ), 0, 0, 1 ) );
 
2713
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "... (xPatrickx)", white ), 0, 0, 1 ) );
 
2714
        drawlist.push_back( new cHudSprite( pFont->Render_Text( pFont->font_normal, "Rolando Gonzalez (rolosworld)", white ), 0, 0, 1 ) );
2664
2715
 
2665
2716
        // set credits position
2666
2717
        for( HudSpriteList::iterator itr = drawlist.begin(), itr_end = drawlist.end(); itr != itr_end; ++itr )
2674
2725
                        obj->Set_Shadow( grey, 1 );
2675
2726
                }
2676
2727
                // set position
2677
 
                obj->posx += GAME_RES_W / 5;
 
2728
                obj->posx += game_res_w / 5;
2678
2729
                obj->posy += menu_posy;
2679
2730
                // set posz behind ground
2680
2731
                obj->posz = 0.109f;
2689
2740
        // back
2690
2741
        temp_item = new cMenu_Item();
2691
2742
        temp_item->image_default->Set_Image( back1 );
2692
 
        temp_item->Set_Pos( GAME_RES_W / 18, 250 );
 
2743
        temp_item->Set_Pos( static_cast<float>(game_res_w) / 18, 250 );
2693
2744
        temp_item->isquit = 1;
2694
 
        pMenuCore->handler->Add_MenuItem( temp_item, 2, grey );
 
2745
        pMenuCore->handler->Add_Menu_Item( temp_item, 2, grey );
2695
2746
        
2696
2747
        drawlist.push_back( new cHudSprite( back1, -200, 0, 1 ) );
2697
2748
 
2712
2763
                cHudSprite *obj = (*itr);
2713
2764
 
2714
2765
                // long inactive reset
2715
 
                if( obj->posy < -1800 )
 
2766
                if( obj->posy < -2400 )
2716
2767
                {
2717
 
                        obj->Set_PosY( GAME_RES_H * 1.1 );
 
2768
                        obj->Set_Pos_Y( static_cast<float>(game_res_h) * 1.1f );
2718
2769
                }
2719
2770
                // fading out
2720
 
                else if( obj->posy < GAME_RES_H * 0.3f )
 
2771
                else if( obj->posy < game_res_h * 0.3f )
2721
2772
                {
2722
2773
                        float new_value = obj->combine_col[0] - ( pFramerate->speedfactor * 0.01f );
2723
2774
 
2731
2782
                        obj->shadow_color.alpha = obj->color.alpha;
2732
2783
                }
2733
2784
                // fading in
2734
 
                else if( obj->posy < GAME_RES_H * 0.9f )
 
2785
                else if( obj->posy < game_res_h * 0.9f )
2735
2786
                {
2736
2787
                        float new_value = obj->combine_col[0] + ( pFramerate->speedfactor * 0.01f );
2737
2788
 
2742
2793
                                // add particles
2743
2794
                                if( obj->combine_col[0] < 1 )
2744
2795
                                {
2745
 
                                        cParticleAnimation *anim = new cParticleAnimation( static_cast<float>( rand() % GAME_RES_W ), static_cast<float>( rand() % 200 ) );
2746
 
                                        anim->Set_Quota( rand() % 25 );
2747
 
                                        anim->Set_Image( pVideo->Get_Surface( "animation/particles/star.png" ) );
2748
 
                                        anim->Set_DirectionRange( 0, 360 );
2749
 
                                        anim->Set_Time_to_Live( 1.2f, 1 );
 
2796
                                        cParticle_Emitter *anim = new cParticle_Emitter();
 
2797
                                        anim->Set_Pos( Get_Random_Float( game_res_w * 0.1f, game_res_w * 0.8f ), Get_Random_Float( game_res_h * 0.1f, game_res_h * 0.2f ) );
 
2798
                                        anim->Set_Quota( 5 + (rand() % 25) );
 
2799
                                        if( rand() % 2 )
 
2800
                                        {
 
2801
                                                anim->Set_Image( pVideo->Get_Surface( "animation/particles/snowflake_1.png" ) );
 
2802
                                                anim->Set_Direction_Range( Get_Random_Float( 30, 70 ), 80 );
 
2803
                                                anim->Set_Scale( 0.3f, 0.2f );
 
2804
                                                anim->Set_Blending( BLEND_ADD );
 
2805
                                        }
 
2806
                                        else
 
2807
                                        {
 
2808
                                                anim->Set_Image( pVideo->Get_Surface( "animation/particles/star.png" ) );
 
2809
                                                anim->Set_Direction_Range( 0, 360 );
 
2810
                                                anim->Set_Scale( 0.2f, 0.1f );
 
2811
                                        }
 
2812
                                        anim->Set_Time_to_Live( 1.4f, 0.5f );
2750
2813
                                        anim->Set_Fading_Size( 1 );
2751
 
                                        anim->Set_Scale( 0.2f, 0.1f );
2752
2814
                                        anim->Set_Color( Color( static_cast<Uint8>( 100 + ( rand() % 155 ) ), 100 + ( rand() % 155 ), 100 + ( rand() % 155 ) ) );
2753
 
                                        anim->Set_Speed( 2, 1 );
2754
 
                                        anim->Set_ConstRotationZ( 1, 8 );
2755
 
                                        anim->Set_ZPos( 0.16f );
 
2815
                                        anim->Set_Speed( 1.6f, 0.7f );
 
2816
                                        anim->Set_Const_Rotation_Z( -5, 10 );
 
2817
                                        anim->Set_Vertical_Gravity( 0.02f );
 
2818
                                        anim->Set_Pos_Z( 0.16f );
2756
2819
                                        pMenuCore->pMenu_AnimManager->Add( anim );
2757
2820
                                }
2758
2821
                        }
2798
2861
void cMenu_Credits :: Exit( void )
2799
2862
{
2800
2863
        // stop credits music
2801
 
        pAudio->FadeOutMusic();
2802
 
        pAudio->PlayMusic( "game/menu.ogg", -1, 0, 1500 );
 
2864
        pAudio->Fadeout_Music();
 
2865
        pAudio->Play_Music( "game/menu.ogg", -1, 0, 1500 );
2803
2866
 
2804
2867
        pMenuCore->next_menu = MENU_MAIN;
2805
2868
        Game_Action = GA_ENTER_MENU;