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
This commit is contained in:
alpine 2014-12-31 04:22:23 +00:00
parent 59876bd86b
commit 6daed23e51
7 changed files with 99 additions and 16 deletions

View File

@ -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();

View File

@ -501,11 +501,16 @@ 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 );
};
@ -513,6 +518,32 @@ void GameInit() {
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);
#endif
@ -595,6 +626,37 @@ void GameInit() {
};
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;
soundbuf_init(&game.sound_hit, soundlen);
@ -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

View File

@ -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;

View File

@ -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 );

View File

@ -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 ) ) {
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--;

View File

@ -28,9 +28,8 @@
//#define L_TECHDEMO_LINE1 "THI5 I5 TECHDEM0` "
#define L_TECHDEMO_LINE1 "U5E ARR0W5 T0 M0VE_ <A> T0 5H00T_ <E5C> 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"

View File

@ -28,7 +28,6 @@
//#define L_TECHDEMO_LINE1 "eT0 TEXH0dEMKA` "
#define L_TECHDEMO_LINE1 "CTPElKi = dBijEHiE_ <A> = B\\CTPEl_ <E5C> = nAY3A "
//#define L_LEVEL_PASSED "dEM0=YP0BEH] nP0^dEH"
#define L_YOUR_SCORE "04K0B HAbPAH0:"
#define L_GAME_OVER "igPA 0K0H4EHA"