PageRenderTime 47ms CodeModel.GetById 12ms app.highlight 30ms RepoModel.GetById 1ms app.codeStats 0ms

/project/Naruto_ninja_story/Scene/ScenePromoA.cpp

http://narutortsproject.googlecode.com/
C++ | 679 lines | 518 code | 128 blank | 33 comment | 76 complexity | 275f3f44697cd6820c95389f1809497e MD5 | raw file
  1#include "ScenePromoA.h"
  2
  3#include "Core/Core.h"
  4#include "../Naruto_controls.h"
  5#include "tools/Speedometr.h"
  6#include "tools/tools.h"
  7#include "Graphick/Texture/Texture.h"
  8#include "Graphick/Texture/TextureContainer.h"
  9#include "Graphick/Graphick.h"
 10#include "Graphick/OpenGL/OpenGl.h"
 11#include "Graphick/OpenGL/vertex_shader.h"
 12#include "Graphick/OpenGL/fragment_shader.h"
 13
 14ScenePromoA::ScenePromoA()
 15{
 16  m_promo_string_date[0] = 0;
 17
 18  m_cancel_key = 0;
 19
 20  m_body_naruto_title = 0;
 21  m_body_ninja_story_title = 0;
 22  m_shade_bg = 0;
 23
 24  m_credits_scroll = 0.0;
 25  m_credits_count = 0;
 26  m_credits_line_width = 0;
 27  m_credits_lines = 0;
 28
 29  for (int i = 0; i < m_chars_bg_max; i ++)
 30  {
 31    m_chars_bg[i] = 0;
 32  }
 33
 34  m_glsl_sample_shader = 0;
 35  m_glsl_particle_shader = 0;
 36  m_glsl_outline_shader = 0;
 37  m_glsl_simple_shadow = 0;
 38
 39  m_show_timer_max = 0.0;
 40  m_show_timer = 0.0;
 41  m_show_timer_alpha = 500.0;
 42  m_show_rotation = 0.0;
 43  m_show_rotation_vel = 0.0;
 44
 45  m_show_rotation_bet = 0.0;
 46  m_show_rotation_bet_vel = 0.0;
 47
 48  m_welcome_timer = 0.0;
 49
 50  m_show_posx = 0.0;
 51  m_show_posy = 0.0;
 52  m_show_posz = 0.0;
 53
 54  m_show_velx = 0.0;
 55  m_show_vely = 0.0;
 56  m_show_velz = 0.0;
 57
 58  m_track_id = -1;
 59
 60  m_menu_item_start = -1;
 61  m_menu_item_exit = -1;
 62  m_menu_activated = false;
 63
 64  m_menu_menu_player_count = -1;
 65  m_menu_item_player_1 = -1;
 66  m_menu_item_player_2 = -1;
 67  m_menu_item_player_3 = -1;
 68
 69  m_press_start_message[0] = 0;
 70};
 71
 72ScenePromoA::~ScenePromoA()
 73{
 74
 75};
 76
 77void ScenePromoA::InitShow()
 78{
 79  m_show_timer_max = rndf(3000.0f, 6000.0f);
 80  m_show_timer = 0.0;
 81  m_show_timer_alpha = 1000.0f;
 82
 83  m_show_rotation = rndf(0.0f, 360.0f);
 84  m_show_rotation_vel = rndf(0.0f, 10.0f);
 85
 86  m_show_rotation_bet = rndf(-80.0f, -45.0f);
 87  m_show_rotation_bet_vel = rndf(-4.0f, 4.0f);
 88
 89  m_show_posx = rndf(-30.0f, 30.0f);
 90  m_show_posy = rndf(-10.0f, 0.0f);
 91  m_show_posz = rndf(30.0f, 50.0f);
 92
 93  m_show_velx = rndf(-2.0f, 2.0f);
 94  m_show_vely = rndf(-2.0f, 2.0f);
 95  m_show_velz = rndf(-1.0f, 2.0f);
 96
 97  int new_char = rand()%m_chars_bg_max;
 98  while (m_show_character == new_char)
 99    new_char = rand()%m_chars_bg_max;
100
101  m_show_character = new_char;
102};
103
104void ScenePromoA::Control()
105{
106  double duration = m_speedometer->GetFrameDuration();
107
108  if (duration < 0.001)
109    duration = 0.001;
110
111  if (duration > 40.0)
112    duration = 40.0;
113
114  if (m_menu_activated)
115  {
116    m_menu.Control(duration);
117
118    if (m_key_down && m_key_controller->is_hit(m_key_down))
119      m_menu.SetNextItem();
120
121    if (m_key_up && m_key_controller->is_hit(m_key_up))
122      m_menu.SetPreviousItem();
123
124    if (m_start_key && m_key_controller->is_hit(m_start_key))
125      m_menu.DoStartItem();
126
127    if (m_cancel_key && m_key_controller->is_hit(m_cancel_key))
128      m_menu.DoBackItem();
129  }
130
131  if (m_start_key && m_key_controller->is_hit(m_start_key))
132  {
133    if (m_menu_activated)
134    {
135
136    } else
137    if (m_welcome_timer >= 2000.0)
138    {
139      m_menu_activated = true;
140    }
141  }
142
143  //m_menu_bg->Control(duration);
144  //m_object->Control(duration);
145  if (m_show_timer >= m_show_timer_max)
146    InitShow();
147
148  double mv = duration / 1000.0;
149  m_show_timer += duration;
150  m_show_posx += m_show_velx*mv;
151  m_show_posy += m_show_vely*mv;
152  m_show_posz += m_show_velz*mv;
153
154  m_show_rotation += m_show_rotation_vel*mv;
155
156  m_show_rotation_bet += m_show_rotation_bet_vel*mv;
157
158  double inv_time = m_show_timer_max - m_show_timer;
159  if (m_show_timer <= m_show_timer_alpha)
160  {
161    int alpha = 255 - int(255*(m_show_timer/m_show_timer_alpha));
162    if (alpha < 0)
163      alpha = 0;
164    if (alpha > 255)
165      alpha = 255;
166    m_shade_bg->SetColorDiffuse(20, 40, 70, alpha);
167  }
168  else
169  if (inv_time <= m_show_timer_alpha)
170  {
171    int alpha = 255 - int(255*(inv_time/m_show_timer_alpha));
172    if (alpha < 0)
173      alpha = 0;
174    if (alpha > 255)
175      alpha = 255;
176    m_shade_bg->SetColorDiffuse(20, 40, 70, alpha);
177  }
178  else
179    m_shade_bg->SetColorDiffuse(20, 40, 70, 0);
180
181  m_welcome_timer += duration;
182
183  m_credits_scroll += 0.03*mv;
184}
185
186void ScenePromoA::Paint()
187{
188  double time = m_speedometer->GetTime();
189  if (time > 1500)
190  {
191    //m_bg_changed = true;
192    //SetClearColor(1.0f, 1.0f, 1.0f, 1.0f);
193  };
194
195  m_graphick->PushMatrix();
196
197  glTranslatef(0.0f, -30.0f, -100.0f);
198  glTranslated(m_show_posx, m_show_posy, m_show_posz);  
199
200  //glRotatef(-70.0f, 1.0f, 0.0f, 0.0f);
201  glRotatef(float(m_show_rotation_bet), 1.0f, 0.0f, 0.0f);
202  glRotatef(float(m_show_rotation), 0.0f, 0.0f, 1.0f);
203
204  //m_show_posx += m_show_velx*mv;
205  //m_show_posy += m_show_vely*mv;
206  //m_show_posz += m_show_velz*mv;
207
208  //m_show_rotation += m_show_rotation_vel*mv;
209  //glRotatef(0.0f, 0.0f, 0.0f, 1.0f);
210  if (m_glsl_sample_shader && m_glsl_outline_shader)
211  {
212    glEnable(GL_CULL_FACE);
213    glCullFace(GL_BACK);
214    m_chars_bg[m_show_character]->SetShader(m_glsl_sample_shader);
215    m_chars_bg[m_show_character]->paint();
216    glCullFace(GL_FRONT);
217    m_chars_bg[m_show_character]->SetShader(m_glsl_outline_shader);
218    m_chars_bg[m_show_character]->paint();
219    glDisable(GL_CULL_FACE);
220
221    m_chars_bg[m_show_character]->SetShader(m_glsl_simple_shadow);
222    m_chars_bg[m_show_character]->paint();
223
224    //Tmatrix matrix_shadow;
225    //CalculateShadowMatrix(matrix_shadow.matrix.elements_16, 0.0f, 0.0f, 1.0f, -1.0, 0.0f, 0.0f, 100.0f, 1.0f);
226    //glMultMatrixf(matrix_shadow.matrix.elements_16);
227
228    //m_menu_bg->paint();
229 
230  }else
231  {
232    m_chars_bg[m_show_character]->paint();
233  }
234  m_graphick->PopMatrix();
235
236  m_shade_bg->Paint();
237
238  m_body_naruto_title->Animate(time);
239  m_body_ninja_story_title->Animate(time);
240
241  m_graphick->SetBlend(false);
242
243  //Draw credits
244  double text_height = 0.03;
245  int credit_position = int(m_credits_scroll / text_height);
246  double small_offset = m_credits_scroll - double(credit_position)*text_height;
247  credit_position %= m_credits_count;
248
249  int line_out = 16;
250  double alpha_level = text_height*4.0;
251  double height = text_height*double(line_out);
252  double left = -m_graphick->GetVirtualWidth()/2.0 + 0.1;
253
254  for (int i = 0; i < line_out; i ++)
255  {
256    double y_pos = text_height*double(i) - small_offset;
257    double y_end_pos = height - y_pos - text_height;
258
259    double alpha = 1.0;
260    if (y_pos < alpha_level)
261      alpha = y_pos/alpha_level;
262
263    if (y_end_pos < alpha_level)
264      alpha = y_end_pos/alpha_level;
265
266    int ialpha = int(alpha*255.0);
267    if (ialpha < 0)
268      ialpha = 0;
269    if (ialpha > 255)
270      ialpha = 255;
271
272    int pos = (credit_position + i) % m_credits_count;
273    m_core->TextDraw(Core_base::FONT_DEFAULT, m_credits_lines[pos], float(left), -0.0f - float(y_pos), -1.0f, float(text_height), 0xcfcfcf + (ialpha << 24));
274  }
275
276//sprintf_s(m_promo_string, 2048, "Naruto Ninja Story Project. Restorate Team. Kuznietsov IEvgeny");
277  m_core->TextDraw(Core_base::FONT_DEFAULT, "Naruto Ninja Story Project by Restorate Team", -0.3f, -0.62f, -1.0f, 0.03f, 0xffffffff);
278  m_core->TextDraw(Core_base::FONT_DEFAULT, "Visit us http://res-team.ucoz.com", -0.22f, -0.65f, -1.0f, 0.03f, 0xffffffff);
279  m_core->TextDraw(Core_base::FONT_DEFAULT, m_promo_string_date, -m_graphick->GetVirtualWidth()/2.0f, -0.75f, -1.0f, 0.03f, 0xffffffff);
280
281  if (!m_menu_activated)
282  {
283    if (m_welcome_timer < 1000.0)
284    {
285      float alpha = float(1000.0 - m_welcome_timer)/1000.0f;
286      m_core->TextDraw(Core_base::FONT_DEFAULT, m_press_start_message, -0.1f + alpha, -0.50f, -1.0f, 0.05f, 0xffffffff);
287      m_core->TextDraw(Core_base::FONT_DEFAULT, m_press_start_message, -0.1f - alpha, -0.50f, -1.0f, 0.05f, 0xffffffff);
288    } else
289    if (m_welcome_timer < 2000.0)
290    {
291      float alpha = float(m_welcome_timer - 1000.0)/1000.0f;
292      m_core->TextDraw(Core_base::FONT_DEFAULT, m_press_start_message, -0.1f - alpha*0.1f, -0.50f - alpha*0.025f, -1.0f, 0.05f + alpha*0.05f, 0xffffff + (unsigned int(255 - alpha*255) << 24));
293      m_core->TextDraw(Core_base::FONT_DEFAULT, m_press_start_message, -0.1f, -0.50f, -1.0f, 0.05f, 0xffffffff);
294    } else
295    {
296      float alpha = float((1.0 + cos((2000.0 - m_welcome_timer)/200.0))/2.0)*0.7f + 0.3f;
297      m_core->TextDraw(Core_base::FONT_DEFAULT, m_press_start_message, -0.1f, -0.50f, -1.0f, 0.05f,  0xffffff + (unsigned int(alpha*255) << 24));
298    };
299  } else
300  {
301    m_menu.Paint();
302  }
303  //if (time > 9500.0)
304  //  finish();
305
306  Scene_base::Paint();
307};
308
309void ScenePromoA::CreateMenu()
310{
311  //Fill menu
312  m_menu.SetCore(m_core);
313
314  //Start, Exit menu
315  {
316    TMenu* menu_start_exit = new TMenu;
317    menu_start_exit->SetCore(m_core);
318    menu_start_exit->SetNotify(this);
319    m_menu_menu_start_exit = menu_start_exit->GetId();
320
321    MenuItem* item_start = new MenuItem;
322    item_start->SetPos(-0.1f, -0.40f);
323    item_start->SetText(m_core->GetLocaleString("menu_start"));
324    m_menu_item_start = item_start->GetId();
325    menu_start_exit->AddMenuItem(item_start);
326
327    MenuItem* item_exit = new MenuItem;
328    item_exit->SetPos(-0.1f, -0.45f);
329    item_exit->SetText(m_core->GetLocaleString("menu_exit"));
330    m_menu_item_exit = item_exit->GetId();
331    menu_start_exit->AddMenuItem(item_exit);
332
333    menu_start_exit->SetCurrent(m_menu_item_start);
334
335    m_menu.AddMenu(menu_start_exit);
336
337    m_menu.SetMenu(m_menu_menu_start_exit);
338  }
339
340  //Player Quantity
341  {
342    TMenu* menu_player_count = new TMenu;
343    menu_player_count->SetCore(m_core);
344    menu_player_count->SetNotify(this);
345    m_menu_menu_player_count = menu_player_count->GetId();
346
347    MenuItem* item_player_1 = new MenuItem;
348    item_player_1->SetPos(-0.1f, -0.40f);
349    item_player_1->SetText(m_core->GetLocaleString("menu_start_1p"));
350    m_menu_item_player_1 = item_player_1->GetId();
351    menu_player_count->AddMenuItem(item_player_1);
352
353    MenuItem* item_player_2 = new MenuItem;
354    item_player_2->SetPos(-0.1f, -0.45f);
355    item_player_2->SetText(m_core->GetLocaleString("menu_start_2p"));
356    m_menu_item_player_2 = item_player_2->GetId();
357    menu_player_count->AddMenuItem(item_player_2);
358
359    MenuItem* item_player_3 = new MenuItem;
360    item_player_3->SetPos(-0.1f, -0.50f);
361    item_player_3->SetText(m_core->GetLocaleString("menu_start_3p"));
362    m_menu_item_player_3 = item_player_3->GetId();
363    menu_player_count->AddMenuItem(item_player_3);
364
365    MenuItem* item_back = new MenuItem;
366    item_back->SetPos(-0.1f, -0.55f);
367    item_back->SetText(m_core->GetLocaleString("menu_return"));
368    m_menu_menu_player_count_back = item_back->GetId();
369    menu_player_count->AddMenuItem(item_back);
370
371    menu_player_count->SetCurrent(m_menu_item_player_1);
372    m_menu.AddMenu(menu_player_count);
373  }
374};
375
376void ScenePromoA::LoadCredits()
377{
378  char credits_name[1024];
379  m_core->GetLocaleStringFolder(credits_name, 1024);
380  strcat_s(credits_name, 1024, "credits.txt");
381
382  FILE * file = 0;
383  fopen_s(&file, credits_name, "rb");
384  if (!file)
385  {
386    m_core->OnCoreWarning("W:Can't load Credits '");
387    m_core->OnCoreWarning(credits_name);
388    m_core->OnCoreWarning("'\n");
389    return;
390  }
391
392  _fseeki64(file, 0, SEEK_END);
393  long long file_size = _ftelli64(file);
394  _fseeki64(file, 0, SEEK_SET);
395
396  if (file_size > 65536)
397    file_size = 65536;
398
399  //Read data
400  char* credits_string = new char[int(file_size)+1];
401  fread(credits_string, 1, int(file_size), file);
402  credits_string[file_size] = 0;
403  fclose(file);
404
405  //Initialize credits
406  m_credits_count = 0;
407  for (unsigned int i = 0; i < strlen(credits_string); i ++)
408  {
409    if (credits_string[i] == '\n')
410    {
411      m_credits_count ++;
412    }
413  }
414
415  m_credits_line_width = new double[m_credits_count];
416  m_credits_lines = new char*[m_credits_count];
417
418  for (int i = 0; i < m_credits_count; i ++)
419  {
420    m_credits_line_width[i] = 0;
421    m_credits_lines[i] = new char[512];
422  };
423
424  int line_pos = 0;
425  int credit_num = 0;
426  for (unsigned int i = 0; i < strlen(credits_string); i ++)
427  {
428    if (credits_string[i] == '\n')
429    {
430      m_credits_line_width[credit_num] = line_pos;
431      m_credits_lines[credit_num][line_pos] = 0;
432      credit_num ++;
433      line_pos = 0;
434      if (credit_num < m_credits_count)
435        m_credits_lines[credit_num][0] = 0;
436    } else
437    {
438      m_credits_lines[credit_num][line_pos] = credits_string[i];
439      m_credits_line_width[credit_num] = 0;
440      line_pos++;
441      if (line_pos >= 512)
442        line_pos = 511;
443    }
444  }
445
446  delete[] credits_string;
447};
448
449void ScenePromoA::OnItemEnter(long long id)
450{
451  if (id == m_menu_item_exit)
452  {
453    ShutDown();
454  } else
455  if (id == m_menu_item_start)
456  {
457    m_menu.SetMenu(m_menu_menu_player_count);
458    m_menu.SetMenuItem(m_menu_item_player_1);
459  } else
460  if (id == m_menu_menu_player_count_back)
461  {
462    m_menu.SetMenu(m_menu_menu_start_exit);
463    m_menu.SetMenuItem(m_menu_item_start);
464  } else
465  if (id == m_menu_item_player_1)
466  {
467    m_core->StoreValue("game_player_count", 1.0);
468    Finish();
469  } else
470  if (id == m_menu_item_player_2)
471  {
472    m_core->StoreValue("game_player_count", 2.0);
473    Finish();
474  } else
475  if (id == m_menu_item_player_3)
476  {
477    m_core->StoreValue("game_player_count", 3.0);
478    Finish();
479  };
480}
481
482void ScenePromoA::OnItemBack(long long id)
483{
484
485}
486
487bool ScenePromoA::Initialize()
488{
489  if (!Scene_base::Initialize())
490    return false;
491
492  if (((graphick_OpenGl*)m_graphick)->GlslSupport())
493  {
494    m_glsl_sample_shader = new GlslShader;
495    if (!m_glsl_sample_shader->Create(vertex_cartoon_shader, fragment_cartoon_shader))
496    {
497      delete m_glsl_sample_shader;
498      m_glsl_sample_shader = 0;
499    }
500    m_glsl_particle_shader = new GlslShader;
501    if (!m_glsl_particle_shader->Create(vertex_particle_shader, 0))
502    {
503      delete m_glsl_particle_shader;
504      m_glsl_particle_shader = 0;
505    }
506
507    m_glsl_outline_shader = new GlslShader;
508    if (!m_glsl_outline_shader->Create(vertex_contur_shader, fragment_contur_shader))
509    {
510      delete m_glsl_outline_shader;
511      m_glsl_outline_shader = 0;
512    }
513    m_glsl_simple_shadow = new GlslShader;
514    if (!m_glsl_simple_shadow->Create(vertex_simple_shadow_shader, 0))
515    {
516      delete m_glsl_simple_shadow;
517      m_glsl_simple_shadow = 0;
518    }
519  }
520
521  strcpy_s(m_press_start_message, 4096, m_core->GetLocaleString("menu_press_start"));
522
523  sprintf_s(m_promo_string_date, 2048, "%s Kuznietsov IEvgeny %s %s", m_core->GetLocaleString("menu_build_by"), __DATE__, __TIME__);
524
525  m_chars_bg[0] = new Object_base;
526  InitializeObject(m_chars_bg[0]);
527  m_chars_bg[0]->load("../../data/object/MainMenuRockLee.n3d");
528
529  m_chars_bg[1] = new Object_base;
530  InitializeObject(m_chars_bg[1]);
531  m_chars_bg[1]->load("../../data/object/MainMenuTenTen.n3d");
532
533  m_chars_bg[2] = new Object_base;
534  InitializeObject(m_chars_bg[2]);
535  m_chars_bg[2]->load("../../data/object/MainMenuSasuke.n3d");
536
537  m_chars_bg[3] = new Object_base;
538  InitializeObject(m_chars_bg[3]);
539  m_chars_bg[3]->load("../../data/object/MainMenuHinata.n3d");
540
541  //m_menu_bg->set_animation(10.0*40.0, 100.0*40.0, true);
542
543  {
544    m_shade_bg = new Body_animate;
545    Mesh_base* mesh_shade = new Mesh_base;
546
547    mesh_shade->CreatePlane(3.0f, 3.0f, 1,1);
548    m_shade_bg->SetMesh(mesh_shade);
549    m_shade_bg->Move(0.0f, 0.0f, -1.01f);
550    m_shade_bg->SetColorDiffuse(20, 40, 70, 0);
551    m_object->insert_body(m_shade_bg);
552  }
553
554  {
555    m_body_naruto_title = new Body_animate;
556    Mesh_base* mesh_naruto_title = new Mesh_base;
557    Texture_instance* txt_naruto_title = m_texture->load_texture("../../data/texture/gui/game_menu/Naruto_title.bmp", Texture_instance::TXT_CLAMPING_EDGE);  
558
559    mesh_naruto_title->CreatePlane(2.0f, 1.0f, 1,1);
560    mesh_naruto_title->SetTexture(txt_naruto_title);
561    m_body_naruto_title->SetMesh(mesh_naruto_title);
562    m_body_naruto_title->Move(2.0f, 0.0f, -1.0f);
563    m_body_naruto_title->SetColorDiffuse(255, 255, 255, 255);
564    m_body_naruto_title->SetAlphaTest(true);
565    m_object->insert_body(m_body_naruto_title);
566
567    Body_state state;
568    state.s_time = 0.0;
569    Translatef(state.s_matrix.matrix.elements_16,  2.0f,0.0f,-1.0f);
570    m_body_naruto_title->AddState(&state);
571
572    state.s_time = 500.0;
573    Translatef(state.s_matrix.matrix.elements_16,  -3.0f,0.0f,0.0f);
574    m_body_naruto_title->AddState(&state);
575
576    state.s_time = 1000.0;
577    Translatef(state.s_matrix.matrix.elements_16,  1.0f,0.4f,0.0f);
578    Scalef(state.s_matrix.matrix.elements_16,  0.7f,0.7f,1.0f);
579    m_body_naruto_title->AddState(&state);
580  }
581
582  {
583    //m_body_ninja_story_title
584    //Ninja_story_title.bmp
585
586    m_body_ninja_story_title = new Body_animate;
587    Mesh_base* mesh_ninja_story_title = new Mesh_base;
588    Texture_instance* txt_ninja_story_title = m_texture->load_texture("../../data/texture/gui/game_menu/Ninja_story_title.bmp", Texture_instance::TXT_CLAMPING_EDGE);  
589
590    mesh_ninja_story_title->CreatePlane(0.4f*1.5f, 0.1f*1.5f, 1,1);
591    mesh_ninja_story_title->SetTexture(txt_ninja_story_title);
592    m_body_ninja_story_title->SetMesh(mesh_ninja_story_title);
593    m_body_ninja_story_title->Move(0.0f, 0.0f, -1.0f);
594    m_body_ninja_story_title->SetColorDiffuse(255, 255, 255, 255);
595    //m_body_ninja_story_title->SetAlphaTest(true);
596    m_object->insert_body(m_body_ninja_story_title);
597
598    Body_state state;
599    state.s_time = 0.0;
600    state.s_color.a = 0.0;
601    Translatef(state.s_matrix.matrix.elements_16,  0.4f,0.2f,-1.0f);
602    m_body_ninja_story_title->AddState(&state);
603
604    state.s_time = 1200.0;
605    //Translatef(state.s_matrix.matrix.elements_16,  -3.0,0.0,0.0);
606    m_body_ninja_story_title->AddState(&state);
607
608    state.s_time = 1700.0;
609    state.s_color.a = 1.0;
610    //Translatef(state.s_matrix.matrix.elements_16,  1.0,0.4,0.0);
611    //Scalef(state.s_matrix.matrix.elements_16,  0.7,0.7,1.0);
612    m_body_ninja_story_title->AddState(&state);
613  }
614
615  LoadCredits();
616  m_credits_scroll = 0.0;
617
618  //int                 m_credits_count;
619  //double*             m_credits_line_width;
620  //double              m_credits_scroll;
621
622  if (m_sound_engine)
623  {
624    m_track_id = m_sound_engine->PlayTrack("../../data/music/Toshiro Masuda - Bunta.ogg", true);
625  }
626  m_cancel_key = KeyFind(CTRL_P1_CANCEL);
627  m_start_key =  KeyFind(CTRL_P1_START);
628
629  m_key_down =   KeyFind(CTRL_P1_GO_BACK);
630  m_key_up  =    KeyFind(CTRL_P1_GO_FORWARD);
631
632  SetClearColor(20.0f/255.0f, 40.0f/255.0f, 70.0f/255.0f, 0.0f);
633
634  CreateMenu();
635
636  return true;
637};
638
639void ScenePromoA::Destroy()
640{
641  if (m_sound_engine && m_track_id > -1)
642  {
643    m_sound_engine->StopTrack(m_track_id);
644  }
645
646  if (m_credits_line_width)
647    delete [] m_credits_line_width;
648  m_credits_line_width = 0;
649
650  if (m_credits_lines)
651  {
652    for (int i = 0; i < m_credits_count; i ++)
653    {
654      delete [] m_credits_lines[i];
655    }
656    delete [] m_credits_lines;
657  }
658  m_credits_lines = 0;
659
660  if (m_glsl_sample_shader)
661    delete m_glsl_sample_shader;
662  m_glsl_sample_shader = 0;
663
664  if (m_glsl_outline_shader)
665    delete m_glsl_outline_shader;
666  m_glsl_outline_shader = 0;
667
668  if (m_glsl_simple_shadow)
669    delete m_glsl_simple_shadow;
670  m_glsl_simple_shadow = 0;
671
672  for (int i = 0; i < m_chars_bg_max; i ++)
673  {
674    if (m_chars_bg[i])
675      delete m_chars_bg[i];
676    m_chars_bg[i] = 0;
677  }
678  Scene_base::Destroy();
679};