home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 February / maximum-cd-2009-02.iso / DiscContents / SMC_1.6_win32.exe / src / level / level_settings.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-08  |  36.7 KB  |  706 lines

  1. /***************************************************************************
  2.  * level_settings.cpp  - level editor settings class
  3.  *
  4.  * Copyright (C) 2006 - 2008 Florian Richter
  5.  ***************************************************************************/
  6. /*
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 3 of the License, or
  10.    (at your option) any later version.
  11.    
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  14. */
  15.  
  16. #include "../core/globals.h"
  17. #include "../core/main.h"
  18. #include "../core/game_core.h"
  19. #include "../core/camera.h"
  20. #include "../level/level_settings.h"
  21. #include "../input/mouse.h"
  22. #include "../level/level.h"
  23. #include "../video/font.h"
  24. #include "../video/video.h"
  25. #include "../video/renderer.h"
  26. #include "../video/gl_surface.h"
  27.  
  28. /* *** *** *** *** *** cLevel_Settings *** *** *** *** *** *** *** *** *** *** *** *** */
  29.  
  30. cLevel_Settings :: cLevel_Settings( void )
  31. {
  32.     // Main
  33.     background_preview = new cHudSprite();
  34.     // Global Effects
  35.     global_effect_preview = new cHudSprite( NULL, game_res_w * 0.75f, game_res_h * 0.2f );
  36.     global_effect_preview->Set_Shadow( lightgrey, 2 );
  37.     
  38.     camera = new cCamera();
  39.     guiwindow = NULL;
  40.     tabcontrol = NULL;
  41.  
  42.     active = 0;
  43. }
  44.  
  45. cLevel_Settings :: ~cLevel_Settings( void )
  46. {
  47.     delete background_preview;
  48.     delete global_effect_preview;
  49.     delete camera;
  50. }
  51.  
  52. void cLevel_Settings :: Init( void )
  53. {
  54.     // GUI
  55.     guiwindow = CEGUI::WindowManager::getSingleton().loadWindowLayout( "level_settings.layout" );
  56.     pGuiSystem->getGUISheet()->addChildWindow( guiwindow );
  57.     
  58.     // Tab Control
  59.     tabcontrol = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow( "tabcontrol_main" ));
  60.     // tab main
  61.     CEGUI::Window *tabwindow = CEGUI::WindowManager::getSingleton().loadWindowLayout( "level_settings_tab_main.layout" );
  62.     tabcontrol->addTab( tabwindow );
  63.     // Tab background
  64.     tabwindow = CEGUI::WindowManager::getSingleton().loadWindowLayout( "level_settings_tab_background.layout" );
  65.     tabcontrol->addTab( tabwindow );
  66.     // tab global effects
  67.     tabwindow = CEGUI::WindowManager::getSingleton().loadWindowLayout( "level_settings_tab_global_effect.layout" );
  68.     tabcontrol->addTab( tabwindow );
  69.  
  70.     // Main
  71.     // level filename
  72.     CEGUI::Editbox *editbox_level_filename = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_level_filename" ));
  73.     editbox_level_filename->setText( Get_Filename( pActive_Level->data_file, 0, 0 ).c_str() );
  74.     // music filename
  75.     CEGUI::Editbox *editbox_music_filename = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_music_filename" ));
  76.     editbox_music_filename->setText( pActive_Level->Get_Musicfile( 1 ).c_str() );
  77.     // author
  78.     CEGUI::Editbox *editbox_author = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_author" ));
  79.     editbox_author->setText( reinterpret_cast<const CEGUI::utf8*>(pActive_Level->author.c_str()) );
  80.     // version
  81.     CEGUI::Editbox *editbox_version = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_version" ));
  82.     editbox_version->setText( pActive_Level->version.c_str() );
  83.     // camera limits
  84.     CEGUI::Spinner *spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_camera_limit_w" ));
  85.     spinner->setCurrentValue( pLevel_Manager->camera->limit_rect.w );
  86.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_camera_limit_h" ));
  87.     spinner->setCurrentValue( pLevel_Manager->camera->limit_rect.h );
  88.     // fixed camera horizontal velocity
  89.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_camera_hor_vel" ));
  90.     spinner->setCurrentValue( pLevel_Manager->camera->fixed_hor_vel );
  91.     // last save time
  92.     CEGUI::Editbox *editbox_save_time = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_save_time" ));
  93.     editbox_save_time->setText( Time_to_String( pActive_Level->last_saved, "%Y-%m-%d  %H:%M:%S" ) );
  94.  
  95.  
  96.     // add background image button
  97.     CEGUI::PushButton *button_add_background_image = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_add_background_image" ));
  98.     button_add_background_image->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cLevel_Settings::Add_Background_Image, this ) );
  99.     // delete background image button
  100.     CEGUI::PushButton *button_delete_background_image = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_delete_background_image" ));
  101.     button_delete_background_image->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cLevel_Settings::Delete_Background_Image, this ) );
  102.     // save and exit button
  103.     CEGUI::PushButton *button_save = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_save" ));
  104.     button_save->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &cLevel_Settings::Button_Save, this ) );
  105.  
  106.     // Background
  107.     // listbox
  108.     CEGUI::Listbox *listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_backgrounds" ));
  109.     listbox->setSortingEnabled( 1 );
  110.     listbox->subscribeEvent( CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber( &cLevel_Settings::Set_Background_Image, this ) );
  111.     // type
  112.     CEGUI::Combobox *combobox = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_bg_image_type" ));
  113.     CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( "Disabled", 1 );
  114.     combobox->addItem( item );
  115.     item = new CEGUI::ListboxTextItem( "Bottom", 2 );
  116.     combobox->addItem( item );
  117.     item = new CEGUI::ListboxTextItem( "All", 3 );
  118.     combobox->addItem( item );
  119.     combobox->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  120.     // filename
  121.     CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_name" ));
  122.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  123.     // speed
  124.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_x" ));
  125.     spinner->subscribeEvent( CEGUI::Spinner::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  126.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_y" ));
  127.     spinner->subscribeEvent( CEGUI::Spinner::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  128.     // position
  129.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posx" ));
  130.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  131.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posy" ));
  132.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  133.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posz" ));
  134.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  135.     // constant velocity
  136.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_x" ));
  137.     spinner->subscribeEvent( CEGUI::Spinner::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  138.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_y" ));
  139.     spinner->subscribeEvent( CEGUI::Spinner::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Image, this ) );
  140.     // Gradient colors
  141.     bg_color_1 = Color( pActive_Level->background_manager->Get_Pointer(0)->color_1.red, pActive_Level->background_manager->Get_Pointer(0)->color_1.green, pActive_Level->background_manager->Get_Pointer(0)->color_1.blue, 255 );
  142.     bg_color_2 = Color( pActive_Level->background_manager->Get_Pointer(0)->color_2.red, pActive_Level->background_manager->Get_Pointer(0)->color_2.green, pActive_Level->background_manager->Get_Pointer(0)->color_2.blue, 255 );
  143.  
  144.     // color 1
  145.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_start_red" ));
  146.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Colors, this ) );
  147.     editbox->setText( int_to_string( bg_color_1.red ).c_str() );
  148.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_start_green" ));
  149.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Colors, this ) );
  150.     editbox->setText( int_to_string( bg_color_1.green ).c_str() );
  151.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_start_blue" ));
  152.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Colors, this ) );
  153.     editbox->setText( int_to_string( bg_color_1.blue ).c_str() );
  154.     // color 2
  155.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_end_red" ));
  156.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Colors, this ) );
  157.     editbox->setText( int_to_string( bg_color_2.red ).c_str() );
  158.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_end_green" ));
  159.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Colors, this ) );
  160.     editbox->setText( int_to_string( bg_color_2.green ).c_str() );
  161.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_end_blue" ));
  162.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_BG_Colors, this ) );
  163.     editbox->setText( int_to_string( bg_color_2.blue ).c_str() );
  164.     // preview window
  165.     CEGUI::Window *window_background_preview = CEGUI::WindowManager::getSingleton().getWindow( "window_background_preview" );
  166.     background_preview->Set_Pos_X( window_background_preview->getUnclippedPixelRect().d_left * global_downscalex, 1 );
  167.     background_preview->Set_Pos_Y( window_background_preview->getUnclippedPixelRect().d_top * global_downscaley, 1 );
  168.  
  169.     Update_BG_Colors( CEGUI::EventArgs() );
  170.  
  171.     // global effect
  172.     // filename
  173.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_file" ));
  174.     editbox->subscribeEvent( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber( &cLevel_Settings::Update_Global_Effect_Image, this ) );
  175.     // type
  176.     combobox = static_cast<CEGUI::Combobox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_global_effect_type" ));
  177.     item = new CEGUI::ListboxTextItem( "Disabled", 1 );
  178.     combobox->addItem( item );
  179.     item = new CEGUI::ListboxTextItem( "Default", 2 );
  180.     combobox->addItem( item );
  181.     // Z Position
  182.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_pos_z" ));
  183.     editbox->setText( float_to_string( pActive_Level->pGlobal_effect->posz ) );
  184.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_pos_z_rand" ));
  185.     editbox->setText( float_to_string( pActive_Level->pGlobal_effect->posz_rand ) );
  186.     // creation rect
  187.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_x" ));
  188.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->startposx );
  189.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_y" ));
  190.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->startposy );
  191.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_w" ));
  192.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->rect.w );
  193.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_h" ));
  194.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->rect.h );
  195.     // time to live
  196.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_time_to_live" ));
  197.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->time_to_live );
  198.     // scale
  199.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_scale" ));
  200.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->size_scale );
  201.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_scale_rand" ));
  202.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->size_scale_rand );
  203.     // emitter iteration interval
  204.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_emitter_iteration_interval" ));
  205.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->emitter_iteration_interval );
  206.     // velocity
  207.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_vel" ));
  208.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->vel );
  209.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_vel_rand" ));
  210.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->vel_rand );
  211.     // angle
  212.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_angle_start" ));
  213.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->angle_start );
  214.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_angle_range" ));
  215.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->angle_range );
  216.     // rotation z
  217.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rot_z" ));
  218.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->rotz );
  219.     // constant rotation z
  220.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_const_rot_z" ));
  221.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->const_rotz );
  222.     spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_const_rot_z_rand" ));
  223.     spinner->setCurrentValue( pActive_Level->pGlobal_effect->const_rotz_rand );
  224.  
  225.     Clear_Layer_Field();
  226.  
  227.     Load_BG_Image_List();
  228.     Load_Global_Effect();
  229.  
  230.     Update_Global_Effect_Image( CEGUI::EventArgs() );
  231. }
  232.  
  233. void cLevel_Settings :: Enter( void )
  234. {
  235.     // Initialize level data
  236.     Init();
  237.     // change mode
  238.     Change_Game_Mode( MODE_LEVEL_SETTINGS );
  239.     // set active
  240.     active = 1;
  241. }
  242.  
  243. void cLevel_Settings :: Unload( void )
  244. {
  245.     // # Main Tab
  246.     // filename
  247.     if( Get_Filename( pActive_Level->data_file, 0, 0 ).compare( CEGUI::WindowManager::getSingleton().getWindow( "editbox_level_filename" )->getText().c_str() ) != 0 )
  248.     {
  249.         pActive_Level->Set_Levelfile( CEGUI::WindowManager::getSingleton().getWindow( "editbox_level_filename" )->getText().c_str() );
  250.         // show no level saved info text
  251.         debugdisplay->Set_Text( "", 0 );
  252.     }
  253.     // musicfile
  254.     pActive_Level->Set_Musicfile( CEGUI::WindowManager::getSingleton().getWindow( "editbox_music_filename" )->getText().c_str() );
  255.     // Author
  256.     pActive_Level->Set_Author( CEGUI::WindowManager::getSingleton().getWindow( "editbox_author" )->getText().c_str() );
  257.     // Version
  258.     pActive_Level->Set_Version( CEGUI::WindowManager::getSingleton().getWindow( "editbox_version" )->getText().c_str() );
  259.     // Camera Limits
  260.     pLevel_Manager->camera->Set_Limit_W( (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_camera_limit_w" )))->getCurrentValue() );
  261.     pLevel_Manager->camera->Set_Limit_H( (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_camera_limit_h" )))->getCurrentValue() );
  262.     // fixed camera horizontal velocity
  263.     pLevel_Manager->camera->fixed_hor_vel = (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_camera_hor_vel" )))->getCurrentValue();
  264.  
  265.     // # Background Tab
  266.     // Gradient
  267.     pActive_Level->background_manager->Get_Pointer(0)->Set_Color_1( bg_color_1 );
  268.     pActive_Level->background_manager->Get_Pointer(0)->Set_Color_2( bg_color_2 );
  269.  
  270.     // # Global Effect Tab
  271.     pActive_Level->pGlobal_effect->image_filename = CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_file" )->getText().c_str();
  272.     pActive_Level->pGlobal_effect->Set_Pos_Z( string_to_float( ( static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_pos_z" )))->getText().c_str() ), string_to_float( ( static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_pos_z_rand" )))->getText().c_str() ) );
  273.     pActive_Level->pGlobal_effect->Set_Type( CEGUI::WindowManager::getSingleton().getWindow( "combo_global_effect_type" )->getText().c_str() );
  274.     pActive_Level->pGlobal_effect->Init_Anim();
  275.     // creation rect
  276.     CEGUI::Spinner *spinner_rect_x = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_x" ));
  277.     CEGUI::Spinner *spinner_rect_y = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_y" ));
  278.     CEGUI::Spinner *spinner_rect_w = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_w" ));
  279.     CEGUI::Spinner *spinner_rect_h = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rect_h" ));
  280.     pActive_Level->pGlobal_effect->Set_Emitter_Rect( spinner_rect_x->getCurrentValue(), spinner_rect_y->getCurrentValue(), spinner_rect_w->getCurrentValue(), spinner_rect_h->getCurrentValue() );
  281.     // lifetime
  282.     CEGUI::Spinner *spinner_time_to_live = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_time_to_live" ));
  283.     pActive_Level->pGlobal_effect->Set_Time_to_Live( spinner_time_to_live->getCurrentValue() );
  284.     // scale
  285.     CEGUI::Spinner *spinner_scale = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_scale" ));
  286.     CEGUI::Spinner *spinner_scale_rand = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_scale_rand" ));
  287.     pActive_Level->pGlobal_effect->Set_Scale( spinner_scale->getCurrentValue(), spinner_scale_rand->getCurrentValue() );
  288.     // Emitter Iteration Interval
  289.     CEGUI::Spinner *spinner_emitter_iteration_interval = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_emitter_iteration_interval" ));
  290.     pActive_Level->pGlobal_effect->Set_Emitter_Iteration_Interval( spinner_emitter_iteration_interval->getCurrentValue() );
  291.     // velocity
  292.     CEGUI::Spinner *spinner_vel = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_vel" ));
  293.     CEGUI::Spinner *spinner_vel_rand = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_vel_rand" ));
  294.     pActive_Level->pGlobal_effect->Set_Speed( spinner_vel->getCurrentValue(), spinner_vel_rand->getCurrentValue() );
  295.     // direction
  296.     CEGUI::Spinner *spinner_angle_start = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_angle_start" ));
  297.     CEGUI::Spinner *spinner_angle_range = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_angle_range" ));
  298.     pActive_Level->pGlobal_effect->Set_Direction_Range( spinner_angle_start->getCurrentValue(), spinner_angle_range->getCurrentValue() );
  299.     // rotation z
  300.     CEGUI::Spinner *spinner_rot_z = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_rot_z" ));
  301.     pActive_Level->pGlobal_effect->Set_Rotation_Z( spinner_rot_z->getCurrentValue(), 1 );
  302.     // constant rotation z
  303.     CEGUI::Spinner *spinner_const_rot_z = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_const_rot_z" ));
  304.     CEGUI::Spinner *spinner_const_rot_z_rand = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_global_effect_const_rot_z_rand" ));
  305.     pActive_Level->pGlobal_effect->Set_Const_Rotation_Z( spinner_const_rot_z->getCurrentValue(), spinner_const_rot_z_rand->getCurrentValue() );
  306.  
  307.     // destroy CEGUI window
  308.     pGuiSystem->getGUISheet()->removeChildWindow( guiwindow );
  309.     CEGUI::WindowManager::getSingleton().destroyWindow( guiwindow );
  310.  
  311.     // clear preview images
  312.     background_preview->Set_Image( NULL, 1 );
  313.     global_effect_preview->Set_Image( NULL, 1 );
  314.  
  315.     active = 0;
  316. }
  317.  
  318. void cLevel_Settings :: Update( void )
  319. {
  320.  
  321. }
  322.  
  323. void cLevel_Settings :: Draw( void )
  324. {
  325.     pVideo->Clear_Screen();
  326.     pVideo->Draw_Rect( NULL, 0.00001f, &black );
  327.  
  328.     // background Tab
  329.     if( tabcontrol->getSelectedTabIndex() == 1 )
  330.     {
  331.         // create request
  332.         cGradientRequest *gradient_request = new cGradientRequest();
  333.         // draw background gradient
  334.         pVideo->Draw_Gradient( &background_preview->rect, 0.0001f, &bg_color_1, &bg_color_2, DIR_VERTICAL, gradient_request );
  335.         // scale with image
  336.         if( background_preview->image )
  337.         {
  338.             // set scale
  339.             gradient_request->rect.w *= background_preview->scalex;
  340.             gradient_request->rect.h *= background_preview->scaley;
  341.         }
  342.         // add request
  343.         pRenderer_GUI->Add( gradient_request );
  344.  
  345.         // create request
  346.         cSurfaceRequest *request = new cSurfaceRequest();
  347.         // draw background image preview
  348.         background_preview->Draw( request );
  349.         // add request
  350.         pRenderer_GUI->Add( request );
  351.     }
  352.     // Global Effect Tab
  353.     else if( tabcontrol->getSelectedTabIndex() == 2 )
  354.     {
  355.         // create request
  356.         cSurfaceRequest *request = new cSurfaceRequest();
  357.         // draw global effect preview
  358.         global_effect_preview->Draw( request );
  359.         // add request
  360.         pRenderer_GUI->Add( request );
  361.     }
  362. }
  363.  
  364. bool cLevel_Settings :: Key_Down( SDLKey key )
  365. {
  366.     if( !active )
  367.     {
  368.         return 0;
  369.     }
  370.  
  371.     if( key == SDLK_ESCAPE )
  372.     {
  373.         // back to level mode
  374.         Game_Action = GA_ENTER_LEVEL;
  375.     }
  376.     else
  377.     {
  378.         // not processed
  379.         return 0;
  380.     }
  381.  
  382.     // key got processed
  383.     return 1;
  384. }
  385.  
  386. bool cLevel_Settings :: Add_Background_Image( const CEGUI::EventArgs &event )
  387. {
  388.     cBackground *background = new cBackground();
  389.     background->Set_Type( BG_IMG_BOTTOM );
  390.     background->Set_Image( LEVEL_DEFAULT_BACKGROUND );
  391.  
  392.     pActive_Level->background_manager->Add( background );
  393.  
  394.     Load_BG_Image_List();
  395.  
  396.     return 1;
  397. }
  398.  
  399. bool cLevel_Settings :: Delete_Background_Image( const CEGUI::EventArgs &event )
  400. {
  401.     CEGUI::Listbox *listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_backgrounds" ));
  402.     CEGUI::ListboxItem *item = listbox->getFirstSelectedItem();
  403.  
  404.     if( !item )
  405.     {
  406.         return 1;
  407.     }
  408.  
  409.     // get background
  410.     cBackground *background = static_cast<cBackground *>(item->getUserData());
  411.     // delete it
  412.     pActive_Level->background_manager->Delete( background );
  413.  
  414.     // update list
  415.     Load_BG_Image_List();
  416.     // clear background image gui
  417.     Update_BG_Image( CEGUI::EventArgs() );
  418.  
  419.     return 1;
  420. }
  421.  
  422. bool cLevel_Settings :: Set_Background_Image( const CEGUI::EventArgs &event )
  423. {
  424.     CEGUI::Listbox *listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_backgrounds" ));
  425.     CEGUI::ListboxItem *item = listbox->getFirstSelectedItem();
  426.  
  427.     // selected
  428.     if( item )
  429.     {
  430.         // get background
  431.         cBackground *background = static_cast<cBackground *>(item->getUserData());
  432.         string background_filename = background->img_file_1;
  433.  
  434.         // type
  435.         CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_bg_image_type" ));
  436.         editbox->setText( reinterpret_cast<const CEGUI::utf8*>(background->Get_Type_Name().c_str()) );
  437.         // filename
  438.         editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_name" ));
  439.         editbox->setText( background_filename.c_str() );
  440.         // position
  441.         editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posx" ));
  442.         editbox->setText( float_to_string( background->posx ).c_str() );
  443.         editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posy" ));
  444.         editbox->setText( float_to_string( background->posy ).c_str() );
  445.         editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posz" ));
  446.         editbox->setText( float_to_string( background->posz ).c_str() );
  447.         // speed
  448.         CEGUI::Spinner *spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_x" ));
  449.         spinner->setCurrentValue( background->speedx );
  450.         spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_y" ));
  451.         spinner->setCurrentValue( background->speedy );
  452.         // constant velocity
  453.         spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_x" ));
  454.         spinner->setCurrentValue( background->const_velx );
  455.         spinner = static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_y" ));
  456.         spinner->setCurrentValue( background->const_vely );
  457.  
  458.         // set image preview
  459.         background_filename.insert( 0, DATA_DIR "/" GAME_PIXMAPS_DIR "/" );
  460.         Set_Background_Image_Preview( background_filename );
  461.     }
  462.     // deselected
  463.     else
  464.     {
  465.         Clear_Layer_Field();
  466.     }
  467.  
  468.     return 1;
  469. }
  470.  
  471. bool cLevel_Settings :: Button_Save( const CEGUI::EventArgs &event )
  472. {
  473.     // back to level mode
  474.     Game_Action = GA_ENTER_LEVEL;
  475.     return 1;
  476. }
  477.  
  478. bool cLevel_Settings :: Update_BG_Colors( const CEGUI::EventArgs &event )
  479. {
  480.     CEGUI::Editbox *color_start_red = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_start_red" ));
  481.     CEGUI::Editbox *color_start_green = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_start_green" ));
  482.     CEGUI::Editbox *color_start_blue = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_start_blue" ));
  483.     CEGUI::Editbox *color_end_red = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_end_red" ));
  484.     CEGUI::Editbox *color_end_green = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_end_green" ));
  485.     CEGUI::Editbox *color_end_blue = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_color_end_blue" ));
  486.  
  487.     bg_color_1.red = string_to_int( color_start_red->getText().c_str() );
  488.     bg_color_1.green = string_to_int( color_start_green->getText().c_str() );
  489.     bg_color_1.blue = string_to_int( color_start_blue->getText().c_str() );
  490.     bg_color_2.red = string_to_int( color_end_red->getText().c_str() );
  491.     bg_color_2.green = string_to_int( color_end_green->getText().c_str() );
  492.     bg_color_2.blue = string_to_int( color_end_blue->getText().c_str() );
  493.  
  494.  
  495.     // color start
  496.     color_start_red->setProperty( "NormalTextColour", CEGUI::PropertyHelper::colourToString( CEGUI::colour( 1, 1 - ( static_cast<float>(bg_color_1.red) / 255 ), 1 - ( static_cast<float>(bg_color_1.red) / 255 ), 1 ) ) );
  497.     color_start_green->setProperty( "NormalTextColour", CEGUI::PropertyHelper::colourToString( CEGUI::colour( 1 - ( static_cast<float>(bg_color_1.green) / 255 ), 1, 1 - ( static_cast<float>(bg_color_1.green) / 255 ), 1 ) ) );
  498.     color_start_blue->setProperty( "NormalTextColour", CEGUI::PropertyHelper::colourToString( CEGUI::colour( 1 - ( static_cast<float>(bg_color_1.blue) / 255 ), 1 - ( static_cast<float>(bg_color_1.blue) / 255 ), 1, 1 ) ) );
  499.     // color end
  500.     color_end_red->setProperty( "NormalTextColour", CEGUI::PropertyHelper::colourToString( CEGUI::colour( 1, 1 - ( static_cast<float>(bg_color_2.red) / 255 ), 1 - ( static_cast<float>(bg_color_2.red) / 255 ), 1 ) ) );
  501.     color_end_green->setProperty( "NormalTextColour", CEGUI::PropertyHelper::colourToString( CEGUI::colour( 1 - ( static_cast<float>(bg_color_2.green) / 255 ), 1, 1 - ( static_cast<float>(bg_color_2.green) / 255 ), 1 ) ) );
  502.     color_end_blue->setProperty( "NormalTextColour", CEGUI::PropertyHelper::colourToString( CEGUI::colour( 1 - ( static_cast<float>(bg_color_2.blue) / 255 ), 1 - ( static_cast<float>(bg_color_2.blue) / 255 ), 1, 1 ) ) );
  503.  
  504.     CEGUI::Window *statictext = CEGUI::WindowManager::getSingleton().getWindow( "text_color_start" );
  505.     statictext->setProperty( "TextColours", CEGUI::PropertyHelper::colourToString( bg_color_1.Get_cegui_Color() ) );
  506.     statictext = CEGUI::WindowManager::getSingleton().getWindow( "text_color_end" );
  507.     statictext->setProperty( "TextColours", CEGUI::PropertyHelper::colourToString( bg_color_2.Get_cegui_Color() ) );
  508.  
  509.     return 1;
  510. }
  511.  
  512. void cLevel_Settings :: Load_BG_Image_List( void )
  513. {
  514.     CEGUI::Listbox *listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_backgrounds" ));
  515.     listbox->resetList();
  516.  
  517.     for( vector<cBackground *>::iterator itr = pActive_Level->background_manager->objects.begin(), itr_end = pActive_Level->background_manager->objects.end(); itr != itr_end; ++itr )
  518.     {
  519.         cBackground *background = (*itr);
  520.  
  521.         // skip gradients
  522.         if( background->type == BG_GR_HOR || background->type == BG_GR_VER )
  523.         {
  524.             continue;
  525.         }
  526.  
  527.         CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( float_to_string( background->posz ).c_str(), 0, background );
  528.         item->setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
  529.         item->setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
  530.         listbox->addItem( static_cast<CEGUI::ListboxItem *>(item) );
  531.     }
  532.  
  533.     CEGUI::PushButton *button_add = static_cast<CEGUI::PushButton *>(CEGUI::WindowManager::getSingleton().getWindow( "button_add_background_image" ));
  534.     
  535.     // 9 layers + default background maximum
  536.     if( pActive_Level->background_manager->size() >= 10 )
  537.     {
  538.         button_add->disable();
  539.     }
  540.     else
  541.     {
  542.         button_add->enable();
  543.     }
  544. }
  545.  
  546. void cLevel_Settings :: Set_Background_Image_Preview( string filename )
  547. {
  548.     Convert_Path_Separators( filename );
  549.  
  550.     // unset image
  551.     background_preview->Set_Image( NULL );
  552.  
  553.     // set default rect
  554.     CEGUI::Window *window_background_preview = CEGUI::WindowManager::getSingleton().getWindow( "window_background_preview" );
  555.     background_preview->rect.w = window_background_preview->getUnclippedPixelRect().getWidth() * global_downscalex;
  556.     background_preview->rect.h = window_background_preview->getUnclippedPixelRect().getHeight() * global_downscaley;
  557.  
  558.     if( !File_Exists( filename ) )
  559.     {
  560.         return;
  561.     }
  562.  
  563.     GL_Surface *temp = pVideo->Get_Surface( filename );
  564.     
  565.     if( !temp )
  566.     {
  567.         return;
  568.     }
  569.  
  570.     // reset scale
  571.     background_preview->scalex = 1;
  572.     background_preview->scaley = 1;
  573.     // Get zoom before setting image
  574.     float zoom = pVideo->Get_Scale( temp, background_preview->rect.w, background_preview->rect.h );
  575.     // Set image
  576.     background_preview->Set_Image( temp );
  577.     // Set Zoom
  578.     background_preview->scalex *= zoom;
  579.     background_preview->scaley *= zoom;
  580. }
  581.  
  582. bool cLevel_Settings :: Update_BG_Image( const CEGUI::EventArgs &event )
  583. {
  584.     CEGUI::Listbox *listbox = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().getWindow( "listbox_backgrounds" ));
  585.     CEGUI::ListboxItem *item = listbox->getFirstSelectedItem();
  586.  
  587.     // clear
  588.     if( !item )
  589.     {
  590.         Clear_Layer_Field();
  591.         return 1;
  592.     }
  593.  
  594.     string bg_type = CEGUI::WindowManager::getSingleton().getWindow( "combo_bg_image_type" )->getText().c_str();
  595.     string bg_filename = CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_name" )->getText().c_str();
  596.     float posx = string_to_float( ( static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posx" )))->getText().c_str() );
  597.     float posy = string_to_float( ( static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posy" )))->getText().c_str() );
  598.     float posz = string_to_float( ( static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posz" )))->getText().c_str() );
  599.     float speed_x = (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_x" )))->getCurrentValue();
  600.     float speed_y = (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_y" )))->getCurrentValue();
  601.     float const_vel_x = (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_x" )))->getCurrentValue();
  602.     float const_vel_y = (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_y" )))->getCurrentValue();
  603.  
  604.     // full filename for validation
  605.     bg_filename.insert( 0, DATA_DIR "/" GAME_PIXMAPS_DIR "/" );
  606.  
  607.     // get background
  608.     cBackground *background = static_cast<cBackground *>(item->getUserData());
  609.     // set type
  610.     background->Set_Type( bg_type );
  611.     // set position
  612.     background->Set_Pos( posx, posy );
  613.     // set position z
  614.     background->Set_Pos_Z( posz );
  615.     // set scroll speed
  616.     background->Set_Scroll_Speed( speed_x, speed_y );
  617.     // set constant velocity
  618.     background->Set_Const_Velocity_X( const_vel_x );
  619.     background->Set_Const_Velocity_Y( const_vel_y );
  620.  
  621.  
  622.     // valid
  623.     if( File_Exists( bg_filename ) )
  624.     {
  625.         // update image preview
  626.         Set_Background_Image_Preview( bg_filename );
  627.     }
  628.     // invalid
  629.     else
  630.     {
  631.         // clear image
  632.         bg_filename.clear();
  633.     }
  634.  
  635.     // set image
  636.     background->Set_Image( bg_filename );
  637.     // set new item name
  638.     item->setText( float_to_string( posz ).c_str() );
  639.     // fixme : should update sorting because of the new name
  640.     listbox->handleUpdatedItemData();
  641.  
  642.     return 1;
  643. }
  644.  
  645. void cLevel_Settings :: Clear_Layer_Field( void )
  646. {
  647.     (static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_bg_image_type" )))->setText( "Disabled" );
  648.     (static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_name" )))->setText( "" );
  649.     (static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posx" )))->setText( "" );
  650.     (static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posy" )))->setText( "" );
  651.     (static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_bg_image_posz" )))->setText( "" );
  652.     (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_x" )))->setText( "" );
  653.     (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_speed_y" )))->setText( "" );
  654.     (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_x" )))->setText( "" );
  655.     (static_cast<CEGUI::Spinner *>(CEGUI::WindowManager::getSingleton().getWindow( "spinner_bg_image_const_vel_y" )))->setText( "" );
  656.     Set_Background_Image_Preview( "" );
  657. }
  658.  
  659. void cLevel_Settings :: Load_Global_Effect( void )
  660. {
  661.     CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_file" ));
  662.     editbox->setText( pActive_Level->pGlobal_effect->image_filename.c_str() );
  663.  
  664.     editbox = static_cast<CEGUI::Editbox *>(CEGUI::WindowManager::getSingleton().getWindow( "combo_global_effect_type" ));
  665.     editbox->setText( pActive_Level->pGlobal_effect->Get_Type_Name().c_str() );
  666. }
  667.  
  668. void cLevel_Settings :: Set_Global_Effect_Image_Preview( string filename )
  669. {
  670.     Convert_Path_Separators( filename );
  671.  
  672.     if( !File_Exists( filename ) )
  673.     {
  674.         global_effect_preview->Set_Image( NULL );
  675.         return;
  676.     }
  677.  
  678.     GL_Surface *temp = pVideo->Get_Surface( filename );
  679.     
  680.     if( !temp )
  681.     {
  682.         return;
  683.     }
  684.  
  685.     // reset scale
  686.     global_effect_preview->scalex = 1;
  687.     global_effect_preview->scaley = 1;
  688.     // Set image
  689.     global_effect_preview->Set_Image( temp );
  690.     // Set Zoom
  691.     float zoom = pVideo->Get_Scale( temp, 100, 100 );
  692.     global_effect_preview->scalex *= zoom;
  693.     global_effect_preview->scaley *= zoom;
  694. }
  695.  
  696. bool cLevel_Settings :: Update_Global_Effect_Image( const CEGUI::EventArgs &event )
  697. {
  698.     string ge_filename = CEGUI::WindowManager::getSingleton().getWindow( "editbox_global_effect_file" )->getText().c_str();
  699.  
  700.     // image preview
  701.     ge_filename.insert( 0, DATA_DIR "/" GAME_PIXMAPS_DIR "/" );
  702.     Set_Global_Effect_Image_Preview( ge_filename );
  703.  
  704.     return 1;
  705. }
  706.