From 6daed23e514833c675c69bb3572219d11aa9451a Mon Sep 17 00:00:00 2001 From: alpine Date: Wed, 31 Dec 2014 04:22:23 +0000 Subject: [PATCH] Heliothryx game update - updated explosions - added huge explosion for boss, sound and animated texture git-svn-id: svn://kolibrios.org@5316 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../games/heliothryx/game/rs/rsplatform_kos.c | 2 +- programs/games/heliothryx/game/rsgame.c | 67 ++++++++++++++++++- programs/games/heliothryx/game/rsgame.h | 7 ++ programs/games/heliothryx/game/rsgamedraw.c | 10 +-- programs/games/heliothryx/game/rsgamelogic.c | 25 ++++++- programs/games/heliothryx/game/strings_en.h | 3 +- programs/games/heliothryx/game/strings_ru.h | 1 - 7 files changed, 99 insertions(+), 16 deletions(-) diff --git a/programs/games/heliothryx/game/rs/rsplatform_kos.c b/programs/games/heliothryx/game/rs/rsplatform_kos.c index 621ed75893..cae41d0b96 100644 --- a/programs/games/heliothryx/game/rs/rsplatform_kos.c +++ b/programs/games/heliothryx/game/rs/rsplatform_kos.c @@ -74,7 +74,7 @@ void kol_wnd_resize(unsigned w, unsigned h) void wnd_draw() { - char tmp[] = "Fps:000 | Heliothryx Beta by Roman Shuvalov"; + char tmp[] = "Fps:000 | Heliothryx "; kol_paint_start(); diff --git a/programs/games/heliothryx/game/rsgame.c b/programs/games/heliothryx/game/rsgame.c index c3317be637..af79d551a1 100755 --- a/programs/games/heliothryx/game/rsgame.c +++ b/programs/games/heliothryx/game/rsgame.c @@ -501,17 +501,48 @@ void GameInit() { // rs_gen_func_radial(0, 0.5, 0.5, 0.3 + 0.5*i/EXPLOSION_FRAMES_COUNT, 0.975, 4.0); // rs_gen_func_set(0, 1.0); + rs_gen_func_perlin(2, 10 + i, 7, 0.5, 100 + i*1000); + rs_gen_func_normalize(2, 0.0, 1.0); + rs_gen_func_set(1, 0.0); rs_gen_func_radial(1, 0.5, 0.5, 0.1 + 0.4*i/EXPLOSIONS_COUNT, 1.0 - 1.0*i/EXPLOSIONS_COUNT, 2.5 + i%5); + + rs_gen_func_add(0, 0, 2, 1.0, -0.8); rs_gen_tex_out_rgba_set( 0.0, 0.0, 0.0, 0.0); - rs_gen_tex_out_rgba(0, 0, 0, 1, 1.0, 1.0, 1.0, 1.0); + rs_gen_tex_out_rgba(0, 0, 0, 1, 0.5*i/EXPLOSIONS_COUNT, 1.0 - 0.7*i/EXPLOSIONS_COUNT, 1.0, 1.0); memcpy(game.tex_explosions[i].data, rs_gen_reg.tex_out, EXPLOSION_RADIUS*2*EXPLOSION_RADIUS*2*4 ); }; rs_gen_term(); + + rs_gen_init(3, HUGE_EXPLOSION_RADIUS*2); + for (i = 0; i < HUGE_EXPLOSIONS_COUNT; i++) { + + texture_init(&(game.tex_huge_explosions[i]), HUGE_EXPLOSION_RADIUS*2, HUGE_EXPLOSION_RADIUS*2); + + rs_gen_func_set(0, 1.0); +// rs_gen_func_radial(0, 0.5, 0.5, 0.3 + 0.5*i/EXPLOSION_FRAMES_COUNT, 0.975, 4.0); +// rs_gen_func_set(0, 1.0); + + rs_gen_func_perlin(2, 10 + i, 7, 0.5, 500 + i*2000); + rs_gen_func_normalize(2, 0.0, 1.0); + + rs_gen_func_set(1, 0.0); + rs_gen_func_radial(1, 0.5, 0.5, 0.1 + 0.4*i/HUGE_EXPLOSIONS_COUNT, 1.0 - 1.0*i/HUGE_EXPLOSIONS_COUNT, 2.5 + i%5); + + rs_gen_func_add(0, 0, 2, 1.0, -0.8); + + rs_gen_tex_out_rgba_set( 0.0, 0.0, 0.0, 0.0); + rs_gen_tex_out_rgba(0, 0, 0, 1, 0.88*i/HUGE_EXPLOSIONS_COUNT, 0.8 - 0.8*i/HUGE_EXPLOSIONS_COUNT, 1.0, 1.0); + + memcpy(game.tex_huge_explosions[i].data, rs_gen_reg.tex_out, HUGE_EXPLOSION_RADIUS*2*HUGE_EXPLOSION_RADIUS*2*4 ); + }; + rs_gen_term(); + + #ifndef RS_KOS rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 2); @@ -594,6 +625,37 @@ void GameInit() { rs_sgen_term(); }; + + + + soundlen = 95000; + + soundbuf_init(&game.sound_huge_explosion, soundlen); + + rs_sgen_init(3, soundlen); + + rs_sgen_func_noise(2, 1000); + //rs_sgen_func_phaser(0, 2, 0.9, 15.2 + 1.0*i/SOUND_EXPLOSIONS_COUNT, 6.0, 3.0, 2000.0, 1.73); + rs_sgen_func_phaser(0, 2, 0.9, 16.2 + 0.5, 6.0, 3.0, 100.0, 0.53); + rs_sgen_func_normalize(0, 1.0); + + rs_sgen_func_lowpass(2, 0, 0.8, 0.0, 10.0); + rs_sgen_func_normalize(2, 0.5); + + rs_sgen_wave_out(2); + + memcpy(game.sound_huge_explosion.data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2); + soundbuf_update(&game.sound_huge_explosion); + + rs_sgen_term(); + + + + + + + + soundlen = 17888; @@ -713,6 +775,7 @@ void GameTerm() { texture_free(&game.tex_rocks[i]); }; + soundbuf_free(&game.sound_huge_explosion); soundbuf_free(&game.sound_hit); soundbuf_free(&game.sound_music); @@ -763,7 +826,7 @@ void GameKeyDown(int key) { case RS_KEY_SPACE: - soundbuf_play( &game.sound_turret_shoot, 0 ); + soundbuf_play( &game.sound_huge_explosion, 0 ); break; #ifdef RS_LINUX diff --git a/programs/games/heliothryx/game/rsgame.h b/programs/games/heliothryx/game/rsgame.h index 2804115e3c..959a6b0c50 100755 --- a/programs/games/heliothryx/game/rsgame.h +++ b/programs/games/heliothryx/game/rsgame.h @@ -110,6 +110,7 @@ void soundbuf_stop(rs_soundbuf_t *snd); #define OBJ_MINIROCK 4 #define OBJ_TURRET 5 #define OBJ_RED_BULLET 6 +#define OBJ_HUGE_EXPLOSION 7 typedef struct game_obj_t { int obj_type; @@ -148,6 +149,10 @@ void game_obj_remove(int index); #define EXPLOSIONS_COUNT 8 #define EXPLOSION_RADIUS 16 +#define HUGE_EXPLOSIONS_COUNT 24 +#define HUGE_EXPLOSION_RADIUS 32 + + #define STATUS_MENU 0 #define STATUS_PLAYING 1 #define STATUS_PAUSED 2 @@ -182,6 +187,7 @@ typedef struct rs_game_t { rs_texture_t tex_minirocks[MINIROCKS_COUNT]; rs_texture_t tex_explosions[EXPLOSIONS_COUNT]; + rs_texture_t tex_huge_explosions[HUGE_EXPLOSIONS_COUNT]; rs_texture_t tex_font[64*FONTS_COUNT]; @@ -197,6 +203,7 @@ typedef struct rs_game_t { rs_soundbuf_t sound_explosions[SOUND_EXPLOSIONS_COUNT]; rs_soundbuf_t sound_hit; + rs_soundbuf_t sound_huge_explosion; rs_soundbuf_t sound_music; // rs_soundbuf_t sound_music2; diff --git a/programs/games/heliothryx/game/rsgamedraw.c b/programs/games/heliothryx/game/rsgamedraw.c index 075f4ad89a..54fc6fc838 100755 --- a/programs/games/heliothryx/game/rsgamedraw.c +++ b/programs/games/heliothryx/game/rsgamedraw.c @@ -111,14 +111,10 @@ void game_draw() { } else if (obj->obj_type == OBJ_EXPLOSION) { - -// char s[] = "00 "; -// s[0] += obj->t / 10; -// s[1] += obj->t % 10; -// game_textout( obj->x, obj->y, 0, s ); - texture_draw( &game.framebuffer, &game.tex_explosions[ obj->t ], obj->x - obj->radius, obj->y - obj->radius, DRAW_MODE_ALPHA ); - + } + else if (obj->obj_type == OBJ_HUGE_EXPLOSION) { + texture_draw( &game.framebuffer, &game.tex_huge_explosions[ obj->t ], obj->x - obj->radius, obj->y - obj->radius, DRAW_MODE_ALPHA ); } else if (obj->obj_type == OBJ_ROCK) { texture_draw( &game.framebuffer, &game.tex_rocks[ obj->tag ], obj->x - obj->radius, obj->y - obj->radius, DRAW_MODE_ALPHA ); diff --git a/programs/games/heliothryx/game/rsgamelogic.c b/programs/games/heliothryx/game/rsgamelogic.c index fb2a7965ab..f6a469df97 100644 --- a/programs/games/heliothryx/game/rsgamelogic.c +++ b/programs/games/heliothryx/game/rsgamelogic.c @@ -406,6 +406,18 @@ void GameProcess() { }; } + + else if (obj->obj_type == OBJ_HUGE_EXPLOSION) { + + obj->t++; + if (obj->t >= HUGE_EXPLOSIONS_COUNT) { + game_obj_remove(i); + i--; + continue; + }; + + } + else if ( (obj->obj_type == OBJ_ROCK) || (obj->obj_type == OBJ_MINIROCK) ) { obj->x -= rock_speed; @@ -443,7 +455,7 @@ void GameProcess() { obj->t--; if (obj->t < 1) { soundbuf_play(&game.sound_turret_shoot, 0); - game_obj_add( game_obj( OBJ_RED_BULLET, 0, 0, 3, obj->x - 30, obj->y, 0, 0) ); + game_obj_add( game_obj( OBJ_RED_BULLET, 0, 0, 3, obj->x - 5, obj->y, 0, 0) ); int c_const = (game.stage_level < 4) ? (10 - 2*game.stage_level) : 3; int c_var = (game.stage_level < 6) ? (20 - 3*game.stage_level) : 3; @@ -465,8 +477,15 @@ void GameProcess() { for (i = 0; i < game.objs_count; i++) { if ( IS_BIT_SET( game.objs[i].flags, OBJ_FLAG_DESTROYED ) ) { - soundbuf_play( &game.sound_explosions[ rs_rand() % SOUND_EXPLOSIONS_COUNT ], 0 ); - game_obj_add( game_obj( OBJ_EXPLOSION, 0, 0, EXPLOSION_RADIUS, game.objs[i].x, game.objs[i].y, 0, 0.0 ) ); + + if (game.objs[i].obj_type == OBJ_TURRET) { + soundbuf_play( &game.sound_huge_explosion, 0 ); + game_obj_add( game_obj( OBJ_HUGE_EXPLOSION, 0, 0, HUGE_EXPLOSION_RADIUS, game.objs[i].x, game.objs[i].y, 0, 0.0 ) ); + } + else { + soundbuf_play( &game.sound_explosions[ rs_rand() % SOUND_EXPLOSIONS_COUNT ], 0 ); + game_obj_add( game_obj( OBJ_EXPLOSION, 0, 0, EXPLOSION_RADIUS, game.objs[i].x, game.objs[i].y, 0, 0.0 ) ); + }; game_obj_remove(i); i--; diff --git a/programs/games/heliothryx/game/strings_en.h b/programs/games/heliothryx/game/strings_en.h index 37d7fb6fc4..58e822f591 100644 --- a/programs/games/heliothryx/game/strings_en.h +++ b/programs/games/heliothryx/game/strings_en.h @@ -28,9 +28,8 @@ //#define L_TECHDEMO_LINE1 "THI5 I5 TECHDEM0` " #define L_TECHDEMO_LINE1 "U5E ARR0W5 T0 M0VE_ T0 5H00T_ T0 PAU5E " -#define L_GAME_OVER "GAME 0VER" -//#define L_LEVEL_PASSED "DEM0=LEVEL PA55ED" #define L_YOUR_SCORE "Y0UR 5C0RE:" +#define L_GAME_OVER "GAME 0VER" #define L_PAUSE "PAU5E" #define L_RESUME "RE5UME PLAYING" diff --git a/programs/games/heliothryx/game/strings_ru.h b/programs/games/heliothryx/game/strings_ru.h index 16e59532d7..b9b499b1e9 100644 --- a/programs/games/heliothryx/game/strings_ru.h +++ b/programs/games/heliothryx/game/strings_ru.h @@ -28,7 +28,6 @@ //#define L_TECHDEMO_LINE1 "eT0 TEXH0dEMKA` " #define L_TECHDEMO_LINE1 "CTPElKi = dBijEHiE_ = B\\CTPEl_ = nAY3A " -//#define L_LEVEL_PASSED "dEM0=YP0BEH] nP0^dEH" #define L_YOUR_SCORE "04K0B HAbPAH0:" #define L_GAME_OVER "igPA 0K0H4EHA"