Subversion Repositories Kolibri OS

Rev

Rev 5251 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include "rsgamedraw.h"
  2. #include "rsgametext.h"
  3. #include "rsgamemenu.h"
  4.  
  5. #include "rsgentex.h"
  6. #include "rs/rsplatform.h"
  7.  
  8. #include "rskos.h"
  9.  
  10. #include "rsnoise.h"
  11.  
  12. #include "strings.h"
  13.  
  14.  
  15. void game_draw() {
  16.  
  17.         int w = GAME_WIDTH;
  18.         int h = GAME_HEIGHT;
  19.        
  20.         int continue_need_redraw = 0;
  21.        
  22.         if (game.need_redraw) {
  23. //    if (1) {
  24.    
  25.        
  26.  
  27.         if ( (game.status == STATUS_MENU) || (game.status == STATUS_LOADING) ) {
  28.                
  29.             texture_draw(&game.framebuffer, &game.tex_bg, 0, 0, DRAW_MODE_REPLACE);
  30.            
  31.                  
  32.             if (game.status == STATUS_LOADING) {
  33.                 game_textout_at_center( 0, 240, 0, L_LOADING );
  34.                 game_textout_at_center( -3, 240-2, 3, L_LOADING );
  35.             }
  36.             else {
  37.  
  38.                 texture_draw( &game.framebuffer, &game.tex_logo, 0, 50, DRAW_MODE_ALPHA );
  39.  
  40.                 if (game.score) {
  41.                    
  42.                    
  43.                     game_textout_at_center( 0, 230, 0, L_GAME_OVER );
  44.                     game_textout_at_center( -3, 230-2, 3, L_GAME_OVER );
  45.                    
  46.                     char s[] = L_SCORE;
  47.                     char *str_num;
  48.                     str_num = strchr(s, 'x');
  49.                     str_num[0] = '0' + ( (game.score / 100) % 10);
  50.                     str_num[1] = '0' + ( (game.score / 10) % 10);
  51.                     str_num[2] = '0' + ( (game.score / 1) % 10);
  52.                    
  53.                     game_textout_at_center( 0, 260, 0, s );
  54.                     game_textout_at_center( -3, 260-2, 3, s );
  55.                    
  56.                     if (game.score == game.hiscore) {
  57.                         game_textout_at_center( 0, 290, 0, L_NEW_HISCORE);
  58.                         game_textout_at_center( -3, 290-2, 3, L_NEW_HISCORE );
  59.                     }
  60.                     else {
  61.                         char hs[] = L_HISCORE;
  62.                         str_num = strchr(hs, 'x');
  63.                         str_num[0] = '0' + ( (game.hiscore / 100) % 10);
  64.                         str_num[1] = '0' + ( (game.hiscore / 10) % 10);
  65.                         str_num[2] = '0' + ( (game.hiscore / 1) % 10);
  66.                         game_textout_at_center( 0, 290, 0, hs);
  67.                         game_textout_at_center( -3, 290-2, 3, hs );
  68.                     };
  69.  
  70.  
  71.                 }
  72.                 else {
  73.                     if (game.hiscore) {
  74.                         char *str_num;
  75.                         char hs[] = L_HISCORE;
  76.                         str_num = strchr(hs, 'x');
  77.                         str_num[0] = '0' + ( (game.hiscore / 100) % 10);
  78.                         str_num[1] = '0' + ( (game.hiscore / 10) % 10);
  79.                         str_num[2] = '0' + ( (game.hiscore / 1) % 10);
  80.                         game_textout_at_center( 0, 230, 0, hs);
  81.                         game_textout_at_center( -3, 230-2, 3, hs );
  82.                     };
  83.                 };
  84.                
  85.                 if (!game.menu_replay_timeout) {
  86.                     game_textout_at_center( 0, 400, 0, L_START );
  87.                     game_textout_at_center( -3, 400-2, 3, L_START );
  88.                 };
  89.                
  90.                
  91.             };
  92.            
  93.             game_textout( 2, GAME_HEIGHT-10, 2,  L_BOTTOM_LINE_DEVELOPER_INFO);
  94.  
  95.        
  96.         }
  97.         else {
  98.                
  99.             texture_draw(&game.framebuffer, &game.tex_bg_gameplay, 0, 0, DRAW_MODE_REPLACE);
  100.            
  101.             int i, j, y_shift;
  102.             for (i = 0; i < FIELD_HEIGHT; i++) {
  103.                 for (j = 0; j < FIELD_WIDTH; j++) {
  104.                     if ( IS_BIT_SET( game.field[i*FIELD_WIDTH + j], CRYSTAL_VISIBLE_BIT )) {
  105.                         y_shift = 0;
  106.                         if ( IS_BIT_SET( game.field[i*FIELD_WIDTH + j], CRYSTAL_MOVING_BIT ) ) {
  107.                             y_shift = -CRYSTAL_SIZE + CRYSTAL_SIZE*(game.process_timer+1)/(ANIMATION_PROCESS_TIMER_LIMIT+1);
  108.                             continue_need_redraw = 1;
  109.                         };
  110.                         texture_draw( &game.framebuffer, &game.tex_crystals[ game.field[i*FIELD_WIDTH + j] & CRYSTAL_INDEX_MASK ], FIELD_X0+ j*CRYSTAL_SIZE, y_shift + FIELD_Y0+ i*CRYSTAL_SIZE, DRAW_MODE_ALPHA );
  111.                     };
  112.                 };
  113.             };
  114.            
  115.             if (game.selected) {
  116.                 texture_draw( &game.framebuffer, &game.tex_cursor, FIELD_X0+ game.selected_x*CRYSTAL_SIZE, FIELD_Y0+ game.selected_y*CRYSTAL_SIZE, DRAW_MODE_ALPHA );
  117.             };
  118.            
  119.            
  120.             for (i = 0; i < game.explosions_count; i++) {
  121.                 texture_draw( &game.framebuffer, &(game.tex_explosion[  (game.explosions[i]>>16) & 0xFF  ]),
  122.                     FIELD_X0 + CRYSTAL_SIZE*( game.explosions[i] & 0xFF) - (EXPLOSION_SIZE-CRYSTAL_SIZE)/2 ,
  123.                     FIELD_Y0 + CRYSTAL_SIZE*( (game.explosions[i]>>8) & 0xFF) - (EXPLOSION_SIZE-CRYSTAL_SIZE)/2 ,
  124.                     DRAW_MODE_ALPHA);
  125.             };
  126.  
  127.  
  128.  
  129.             int blink_visible = 0;
  130.             if (game.time > 10*25) {
  131.                 blink_visible = 1;
  132.             }
  133.             else if (game.time > 5*25) {
  134.                 blink_visible = (game.time / 8) & 1;
  135.                 continue_need_redraw = 1;
  136.             }
  137.             else {
  138.                 blink_visible = (game.time / 4) & 1;
  139.                 continue_need_redraw = 1;
  140.             };
  141.            
  142.             char *str_num;
  143.             if (blink_visible) {
  144.  
  145.                 char str[] = L_TIME;
  146.                 int time_sec = game.time / 25;
  147.                 str_num = strchr(str, 'x');
  148.                 str_num[0] = '0' + ( (time_sec / 10) % 10);
  149.                 str_num[1] = '0' + ( (time_sec / 1) % 10);
  150. //                str_num[2] = '0' + ( (time_sec / 1) % 10);
  151.                
  152.                 game_textout( 56+3, 32+2, 0, str );
  153.                 game_textout( 56, 32, 3, str );
  154.             };
  155.            
  156.            
  157.             char sstr[] = L_SCORE;
  158.             str_num = strchr(sstr, 'x');
  159.             str_num[0] = '0' + ( (game.score / 100) % 10);
  160.             str_num[1] = '0' + ( (game.score / 10) % 10);
  161.             str_num[2] = '0' + ( (game.score / 1) % 10);
  162.            
  163.             game_textout( 56+3, 64+2, 0, sstr );
  164.             game_textout( 56, 64, 3, sstr );
  165.    
  166.         };
  167.  
  168.  
  169. //        rskos_draw_area(0, 0, w, h, game.window_scale, game.framebuffer.data, NULL, RSKOS_BGRA);
  170.         rskos_draw_area(0, 0, w, h, 1, game.framebuffer.data, game.bgr_framebuffer, 0);
  171.         };
  172.        
  173.         if (!continue_need_redraw) {
  174.         game.need_redraw = 0;
  175.         };
  176.  
  177. };
  178.  
  179.  
  180.  
  181. void game_textures_init_stage1() {
  182.    
  183.     int i;
  184.    
  185.     texture_init(&game.framebuffer, GAME_WIDTH, GAME_HEIGHT);
  186.    
  187. //    texture_init(&game.tex, 64, 64);
  188. //    rs_gen_init(1, 64);
  189. //    rs_gen_func_set(0, 0.0);
  190. //    rs_gen_func_cell(0, 1200, 10, NULL, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0);
  191. //    rs_gen_func_normalize(0, 0.0, 1.0);
  192. //    rs_gen_func_posterize(0, 5);
  193. //    rs_gen_tex_out_rgba(0, 0, 0, -1, 1.0, 1.0, 1.0, 1.0);
  194. //    memcpy(game.tex.data, rs_gen_reg.tex_out, 64*64*4 );
  195. //    rs_gen_term();
  196.    
  197.     texture_init(&game.tex_clouds, 128, 128);
  198.     rs_gen_init(1, 128);
  199.     rs_gen_func_perlin(0, 8, 5, 0.5, 1100);
  200.     rs_gen_func_normalize(0, 0.0, 1.0);
  201.     rs_gen_func_posterize(0, 6);
  202.     rs_gen_func_mult_add_value(0, 0, 0.6, 0.4);
  203. //    rs_gen_func_set(0, 1.0);
  204.     rs_gen_tex_out_rgba(0, 0, 0, -1, 1.0, 1.0, 1.0, 1.0);
  205.     memcpy(game.tex_clouds.data, rs_gen_reg.tex_out, 128*128*4 );
  206.     rs_gen_term();
  207.  
  208.  
  209.     rs_texture_t tex_shadow;
  210.     texture_init(&tex_shadow, 64, 64);
  211.     rs_gen_init(1, 64);
  212.     rs_gen_func_perlin(0, 21, 6, 0.5, 1000);
  213.     rs_gen_func_normalize(0, 0.0, 0.5);
  214.     rs_gen_tex_out_rgba(0, 0, 0, -1, 1.0, 1.0, 1.0, 1.0);
  215.     memcpy(tex_shadow.data, rs_gen_reg.tex_out, 64*64*4 );
  216.     rs_gen_term();
  217.    
  218.    
  219.  
  220.     texture_init(&game.tex_logo, GAME_WIDTH, 128);
  221.     texture_clear(&game.tex_logo, COLOR_TRANSPARENT);
  222.    
  223.     game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192, 4, 1, DRAW_MODE_REPLACE, "MARBLE");
  224.     game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192, 63, 1, DRAW_MODE_REPLACE, "MATCH3");
  225.     texture_draw(&game.tex_logo, &tex_shadow, 0, 0, DRAW_MODE_MULT | DRAW_TILED_FLAG);
  226.     game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192 - 5, 0, 1, DRAW_MODE_ALPHA, "MARBLE");
  227.     game_textout_adv( &game.tex_logo, GAME_WIDTH/2 - 192 - 4, 60, 1, DRAW_MODE_ALPHA, "MATCH3");
  228.     texture_draw(&game.tex_logo, &game.tex_clouds, 0, 0, DRAW_MODE_MULT | DRAW_TILED_FLAG);
  229.    
  230.     texture_free(&tex_shadow);
  231.  
  232.    
  233.     texture_init(&game.tex_bg, 512, 512);
  234.     texture_clear(&game.tex_bg, COLOR_SILVER);
  235.  
  236.     texture_init(&game.tex_bg_gameplay, 512, 512);
  237.     texture_clear(&game.tex_bg_gameplay, COLOR_SILVER);
  238.    
  239.     texture_init(&game.tex_cursor, CRYSTAL_SIZE, CRYSTAL_SIZE);
  240.     rs_gen_init(2, CRYSTAL_SIZE);
  241.    
  242.     rs_gen_func_set(0, 0.0); // inner
  243.     rs_gen_func_radial(0, 0.5, 0.5, 0.5, 1.0, 2.0);
  244.     rs_gen_func_clamp(0, 0.1, 0.5);
  245.     rs_gen_func_normalize(0, 0.0, 1.0);
  246.     rs_gen_func_mult_add_value(0, 0, -1.0, 1.0);
  247.  
  248.     rs_gen_func_set(1, 0.0); // outer
  249.     rs_gen_func_radial(1, 0.5, 0.5, 0.5, 1.0, 2.0);
  250.     rs_gen_func_clamp(1, 0.0, 0.2);
  251.     rs_gen_func_normalize(1, 0.0, 1.0);
  252.    
  253.     rs_gen_func_mult(0, 0, 1);
  254.  
  255.     rs_gen_func_set(1, 1.0);
  256. //    rs_gen_tex_out_rgba_set(0.0, 0.0, 0.0, 0.0);
  257.     rs_gen_tex_out_rgba(1, 1, 1, 0, 1.0, 1.0, 1.0, 1.0);
  258.     memcpy(game.tex_cursor.data, rs_gen_reg.tex_out, CRYSTAL_SIZE*CRYSTAL_SIZE*4 );
  259.     rs_gen_term();
  260.  
  261.     texture_init(&game.tex_field, FIELD_WIDTH*CRYSTAL_SIZE + 7, FIELD_HEIGHT*CRYSTAL_SIZE + 7);
  262.     texture_clear(&game.tex_field, 0xAABBBBBB); // 0x66404060 // 0xAACCCCCC
  263.  
  264.    
  265. //    float cr_r[CRYSTALS_COUNT] = { 0.8, 0.2, 0.1, 0.6, 0.7, 0.0, 0.7 };
  266. //    float cr_g[CRYSTALS_COUNT] = { 0.1, 0.6, 0.4, 0.0, 0.6, 0.0, 0.8 };
  267. //    float cr_b[CRYSTALS_COUNT] = { 0.1, 0.1, 0.7, 0.7, 0.0, 0.3, 0.9 };
  268.  
  269. //    float cr_r[CRYSTALS_COUNT] = { 0.9, 0.3, 0.1, 0.7, 0.8, 0.0, 0.8 };
  270. //    float cr_g[CRYSTALS_COUNT] = { 0.1, 0.8, 0.5, 0.0, 0.7, 0.0, 0.8 };
  271. //    float cr_b[CRYSTALS_COUNT] = { 0.0, 0.1, 0.9, 0.8, 0.0, 0.5, 0.9 };
  272.    
  273.     float cr_r[CRYSTALS_COUNT] = { 1.0, 0.4, 0.10, 0.9, 1.0, 0.2, 0.8 };
  274.     float cr_g[CRYSTALS_COUNT] = { 0.1, 1.0, 0.75, 0.1, 0.9, 0.2, 0.8 };
  275.     float cr_b[CRYSTALS_COUNT] = { 0.0, 0.1, 1.00, 1.0, 0.1, 0.9, 0.9 };
  276.    
  277.  
  278. //    rs_gen_init(5, CRYSTAL_SIZE);
  279. //    for (i = 0; i < CRYSTALS_COUNT; i++) {
  280. //        texture_init(&(game.tex_crystals[i]), CRYSTAL_SIZE, CRYSTAL_SIZE);
  281. //        
  282. //        rs_gen_func_set(0, 0.0);
  283. //        rs_gen_func_radial(0, 0.5, 0.5, 0.5, 0.75, 10.0);
  284. //        
  285. //        rs_gen_func_set(1, 0.0);
  286. //        rs_gen_func_cell(1, 110+100*i, 7+i, NULL, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0);
  287. //        rs_gen_func_normalize(1, 0.0, 1.0);
  288. //        
  289. //        rs_gen_tex_out_rgba_set(0.0, 0.0, 0.0, 0.0);
  290. //        rs_gen_tex_out_rgba(1, 1, 1, 0, cr_b[i], cr_g[i], cr_r[i], 1.0);
  291. //
  292. //        memcpy(game.tex_crystals[i].data, rs_gen_reg.tex_out, CRYSTAL_SIZE*CRYSTAL_SIZE*4 );
  293. //    };
  294. //    rs_gen_term();
  295.    
  296.     rs_gen_init(5, CRYSTAL_SIZE);
  297.     for (i = 0; i < CRYSTALS_COUNT; i++) {
  298.         texture_init(&(game.tex_crystals[i]), CRYSTAL_SIZE, CRYSTAL_SIZE);
  299.        
  300.         rs_gen_func_set(0, 0.0);
  301.         rs_gen_func_radial(0, 0.5, 0.5, 0.5, 0.75, 10.0);
  302.        
  303.         rs_gen_func_set(1, 1.0);
  304.         rs_gen_func_cell(1, 310+100*i, 5, NULL, -0.5, 1.0, 1.0, 0.0, -2.0, 2.0);
  305.         rs_gen_func_normalize(1, 0.0, 1.0);
  306.        
  307.         rs_gen_func_normalmap(2, 3, 4, 1, 1.0);
  308.         rs_gen_func_mult_add_value(3, 3, -1.0, 1.0);
  309.        
  310.         rs_gen_func_clamp(2, 0.5, 1.0);
  311.         rs_gen_func_normalize(2, 0.0, 1.0);
  312.         rs_gen_func_clamp(3, 0.5, 1.0);
  313.         rs_gen_func_normalize(3, 0.0, 1.0);
  314.        
  315.         rs_gen_func_add(4, 2, 3, 0.5, 0.5);
  316.         rs_gen_func_mult(1, 1, 4);
  317.         rs_gen_func_normalize(1, 0.0, 1.0);
  318.        
  319.         rs_gen_tex_out_rgba_set(0.0, 0.0, 0.0, 0.0);
  320.         rs_gen_tex_out_rgba(1, 1, 1, 0, cr_b[i], cr_g[i], cr_r[i], 1.0);
  321. //        rs_gen_tex_out_rgba(4, 4, 4, 0, 0.8-0.8*cr_b[i], 0.8-0.8*cr_g[i], 0.8-0.8*cr_r[i], 0.0);
  322. //        rs_gen_tex_out_rgba(1, 1, 1, 0, 1.0, 1.0, 1.0, 1.0);
  323.  
  324.         memcpy(game.tex_crystals[i].data, rs_gen_reg.tex_out, CRYSTAL_SIZE*CRYSTAL_SIZE*4 );
  325.     };
  326.     rs_gen_term();
  327.    
  328.    
  329.    
  330.     rs_gen_init(3, EXPLOSION_SIZE);
  331.     for (i = 0; i < EXPLOSION_FRAMES_COUNT; i++) {
  332.            
  333.         texture_init(&(game.tex_explosion[i]), EXPLOSION_SIZE, EXPLOSION_SIZE);
  334.  
  335.         rs_gen_func_set(0, 1.0);
  336. //        rs_gen_func_radial(0, 0.5, 0.5, 0.3 + 0.5*i/EXPLOSION_FRAMES_COUNT, 0.975, 4.0);
  337. //        rs_gen_func_set(0, 1.0);
  338.  
  339.         rs_gen_func_set(1, 0.0);
  340.         rs_gen_func_radial(1, 0.5, 0.5, 0.1 + 0.4*i/EXPLOSION_FRAMES_COUNT, 1.0 - 1.0*i/EXPLOSION_FRAMES_COUNT, 2.5 + i%5);
  341.  
  342.         rs_gen_tex_out_rgba_set( 0.0, 0.0, 0.0, 0.0);
  343.         rs_gen_tex_out_rgba(0, 0, 0, 1, 1.0, 1.0, 1.0, 1.0);
  344.  
  345.         memcpy(game.tex_explosion[i].data, rs_gen_reg.tex_out, EXPLOSION_SIZE*EXPLOSION_SIZE*4 );
  346.     };
  347.     rs_gen_term();
  348. };
  349.  
  350. void game_textures_init_stage2() {
  351.      
  352. //            texture_clear(&game.tex_bg, COLOR_SILVER);
  353. //             /*
  354.        
  355.     rs_gen_init(6, 512);
  356.     rs_gen_func_perlin(0, 8, 5, 0.5, 1100);
  357.     rs_gen_func_normalize(0, 0.0, 1.0);
  358.     rs_gen_func_perlin(1, 8, 5, 0.5, 1700);
  359.     rs_gen_func_normalize(1, 0.0, 1.0);
  360.     rs_gen_func_cell(2, 1118, 50, NULL, 1.0, 0.887, -0.333, 1.0, 0.0, 4.0); // 1360
  361.     rs_gen_func_normalize(2, 0.0, 0.5);
  362.  
  363.     rs_gen_func_adr(3, 2, 0, 1, 1.0, 0.3);
  364.    
  365.     rs_gen_func_inv(3, 3, 7.5);
  366.     rs_gen_func_normalize(3, 0.0, 1.0);
  367.  
  368. //            signed short c[] = { 0, 250, 250, 0, 500, 250, 250, 500};
  369.     signed short c[] = { 0, 0, 0, 512, 512, 0, 512, 512};
  370. //            signed short c[] = { 128, 128, 128, 384, 384, 128, 384, 384};
  371.     //rs_gen_func_cell(4, 0, 4, c, 0.0, 0.3, 1.0, 0.5, 0.0, 0.30);
  372.     rs_gen_func_cell(4, 0, 4, c, 1.0, 0.3, 0.0, 0.95, 0.0, 0.30);
  373.     rs_gen_func_normalize(4, 0.0, 1.0);
  374.  
  375. //            rs_gen_func_radial(5, 0.5, 0.5, 0.60, 1.0, 4.0);
  376. //            rs_gen_func_add(4, 4, 5, 0.5, 0.5);
  377. //
  378.     rs_gen_func_mult(4, 4, 3);
  379.    
  380.     // coloring...
  381.     rs_gen_func_mult_add_value(0, 4, 0.8, 0.0);
  382.     rs_gen_func_add(0, 4, 1, 0.95, 0.05);
  383.     rs_gen_func_add(3, 4, 2, 0.95, 0.05);
  384.  
  385.    
  386.     rs_gen_tex_out_rgba(4, 0, 3, -1, 0.9, 0.9, 0.9, 1.0);
  387.     memcpy(game.tex_bg.data, rs_gen_reg.tex_out, 512*512*4 );
  388.     rs_gen_term();
  389.    
  390.     // */
  391.    
  392.     // Background for gameplay
  393.    
  394.     texture_draw( &game.tex_bg_gameplay, &game.tex_bg, 256, 256, DRAW_MODE_REPLACE | DRAW_TILED_FLAG );
  395.     // Bevel
  396.     texture_draw_vline( &game.tex_bg_gameplay, FIELD_X0 - 5, FIELD_Y0 - 5, FIELD_HEIGHT*CRYSTAL_SIZE + 10, 0xFF404060 );
  397.     texture_draw_hline( &game.tex_bg_gameplay, FIELD_X0 - 5, FIELD_Y0 - 5, FIELD_WIDTH*CRYSTAL_SIZE + 10, 0xFF404060 );
  398.     texture_draw_vline( &game.tex_bg_gameplay, FIELD_X0 - 4, FIELD_Y0 - 4, FIELD_HEIGHT*CRYSTAL_SIZE + 8, 0xFF606080 );
  399.     texture_draw_hline( &game.tex_bg_gameplay, FIELD_X0 - 4, FIELD_Y0 - 4, FIELD_WIDTH*CRYSTAL_SIZE + 8, 0xFF606080 );
  400.    
  401.     texture_draw_vline( &game.tex_bg_gameplay, FIELD_X0 + 4 + FIELD_WIDTH*CRYSTAL_SIZE, FIELD_Y0 - 4, FIELD_HEIGHT*CRYSTAL_SIZE + 8, 0xFFC0C0C0 );
  402.     texture_draw_hline( &game.tex_bg_gameplay, FIELD_X0 - 4, FIELD_Y0 + 4 + FIELD_HEIGHT*CRYSTAL_SIZE, FIELD_WIDTH*CRYSTAL_SIZE + 9, 0xFFC0C0C0 );
  403.     texture_draw_vline( &game.tex_bg_gameplay, FIELD_X0 + 5 + FIELD_WIDTH*CRYSTAL_SIZE, FIELD_Y0 - 5, FIELD_HEIGHT*CRYSTAL_SIZE + 10, 0xFFE0E0E0 );
  404.     texture_draw_hline( &game.tex_bg_gameplay, FIELD_X0 - 5, FIELD_Y0 + 5 + FIELD_HEIGHT*CRYSTAL_SIZE, FIELD_WIDTH*CRYSTAL_SIZE + 11, 0xFFE0E0E0 );
  405.    
  406.     texture_draw( &game.tex_bg_gameplay, &game.tex_field, FIELD_X0 - 3, FIELD_Y0 - 3, DRAW_MODE_ALPHA );
  407.    
  408.    
  409. };
  410.  
  411. void game_textures_free() {
  412.     free(game.bgr_framebuffer);
  413.    
  414.     //    texture_free(&game.tex_gui_line);
  415.    
  416.     int i;
  417.     for (i = 0; i < CRYSTALS_COUNT; i++) {
  418.         texture_free(&game.tex_crystals[i]);
  419.     };
  420.    
  421.     for (i = 0; i < EXPLOSION_FRAMES_COUNT; i++) {
  422.         texture_free(&game.tex_explosion[i]);
  423.     };
  424.    
  425.     texture_free(&game.framebuffer);
  426.    
  427.     texture_free(&game.tex_logo);
  428.     texture_free(&game.tex_clouds);
  429.    
  430.     texture_free(&game.tex_bg);
  431.     texture_free(&game.tex_bg_gameplay);
  432. };
  433.