forked from KolibriOS/kolibrios
Heliothryx game update
- added pause menu (Esc) - lowest frame rate limit decreased downto 5 fps git-svn-id: svn://kolibrios.org@5310 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
225d44665e
commit
cd3b533c6b
@ -250,7 +250,7 @@ void kol_main()
|
||||
};
|
||||
kol_sleep(wait_time);
|
||||
|
||||
if (draw_dt > 10) {
|
||||
if (draw_dt > 19) {
|
||||
low_performance_counter++;
|
||||
}
|
||||
else {
|
||||
|
@ -204,7 +204,7 @@ void soundbuf_fill(rs_soundbuf_t *snd, int amp, int freq_div) {
|
||||
|
||||
void soundbuf_sin(rs_soundbuf_t *snd, float freq) {
|
||||
int i;
|
||||
int amp = 29000;
|
||||
int amp = 19000;
|
||||
for (i = 0; i < snd->length_samples; i++) {
|
||||
snd->data[i] = ( 1.0 - 1.0*i/snd->length_samples ) * sin(freq*i) * amp;
|
||||
};
|
||||
@ -213,7 +213,7 @@ void soundbuf_sin(rs_soundbuf_t *snd, float freq) {
|
||||
|
||||
void soundbuf_sin_fade(rs_soundbuf_t *snd, float freq) {
|
||||
int i;
|
||||
int amp = 29000;
|
||||
int amp = 19000;
|
||||
for (i = 0; i < snd->length_samples; i++) {
|
||||
snd->data[i] = ( 1.0 - 1.0*i/snd->length_samples ) * sin( ( (1.0 - 0.48*i/snd->length_samples) * freq ) *i) * amp;
|
||||
};
|
||||
@ -517,9 +517,32 @@ void GameInit() {
|
||||
rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 2);
|
||||
#endif
|
||||
|
||||
soundbuf_init(&game.sound_test1, 2048);
|
||||
soundbuf_init(&game.sound_test1, 1536);
|
||||
// soundbuf_fill(&game.sound_test1, 2, 50);
|
||||
soundbuf_sin_fade(&game.sound_test1, 0.7);
|
||||
// soundbuf_sin_fade(&game.sound_test1, 0.7);
|
||||
|
||||
|
||||
rs_sgen_init(2, game.sound_test1.length_samples);
|
||||
rs_sgen_func_pm(1, 2900.0, 1.70, 65.0, 17.0, 1.0);
|
||||
rs_sgen_func_normalize(1, 0.6);
|
||||
// rs_sgen_func_lowpass(0, 1, 1.0, 0.0, 4.0);
|
||||
rs_sgen_func_highpass(0, 1, 1.0, 0.0, 3.0);
|
||||
|
||||
rs_sgen_wave_out(0);
|
||||
|
||||
memcpy(game.sound_test1.data, (unsigned char*) rs_sgen_reg.wave_out, game.sound_test1.length_samples*2 );
|
||||
|
||||
rs_sgen_term();
|
||||
soundbuf_update(&game.sound_test1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
soundbuf_init(&game.sound_test2, 1024);
|
||||
//soundbuf_fill(&game.sound_test2, 8, 40);
|
||||
@ -549,7 +572,7 @@ void GameInit() {
|
||||
rs_sgen_func_normalize(0, 1.0);
|
||||
|
||||
rs_sgen_func_lowpass(2, 0, 0.6, 0.0, 20.0);
|
||||
rs_sgen_func_normalize(2, 0.7);
|
||||
rs_sgen_func_normalize(2, 0.5);
|
||||
|
||||
rs_sgen_wave_out(2);
|
||||
|
||||
@ -571,7 +594,7 @@ void GameInit() {
|
||||
rs_sgen_func_normalize(0, 1.0);
|
||||
|
||||
rs_sgen_func_highpass(2, 0, 1.0, 0.3, 20.0);
|
||||
rs_sgen_func_normalize(2, 0.6);
|
||||
rs_sgen_func_normalize(2, 0.5);
|
||||
|
||||
rs_sgen_wave_out(2);
|
||||
|
||||
@ -722,13 +745,14 @@ void GameKeyDown(int key) {
|
||||
// soundbuf_play( &game.sound_music, SND_MODE_LOOP );
|
||||
// break;
|
||||
|
||||
// #ifdef RS_LINUX
|
||||
//
|
||||
// case RS_KEY_Z:
|
||||
// soundbuf_play( &game.sound_music2, 0 );
|
||||
// break;
|
||||
//
|
||||
// #endif
|
||||
#ifdef RS_LINUX
|
||||
|
||||
case RS_KEY_Z:
|
||||
soundbuf_stop( &game.sound_music );
|
||||
soundbuf_play( &game.sound_music2, 0 );
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -771,7 +795,13 @@ void GameKeyDown(int key) {
|
||||
menu_cursor_click();
|
||||
break;
|
||||
case RS_KEY_ESCAPE:
|
||||
if (game.menu_index != MENU_PAUSE) {
|
||||
menu_open(0);
|
||||
}
|
||||
else {
|
||||
game.status = STATUS_PLAYING;
|
||||
return;
|
||||
};
|
||||
break;
|
||||
};
|
||||
|
||||
@ -782,7 +812,7 @@ void GameKeyDown(int key) {
|
||||
|
||||
case RS_KEY_ESCAPE:
|
||||
game.status = STATUS_MENU;
|
||||
menu_open(0);
|
||||
menu_open(MENU_PAUSE);
|
||||
break;
|
||||
case RS_KEY_SPACE:
|
||||
|
||||
|
@ -95,7 +95,6 @@ void player_hit() {
|
||||
|
||||
if (game.health < 1) {
|
||||
game.status = STATUS_MENU;
|
||||
soundbuf_play( &game.sound_music, SND_MODE_LOOP );
|
||||
menu_open( MENU_GAME_OVER );
|
||||
};
|
||||
|
||||
@ -276,7 +275,6 @@ void GameProcess() {
|
||||
else if (game.stage == 10) {
|
||||
|
||||
game.status = STATUS_MENU;
|
||||
soundbuf_play( &game.sound_music, SND_MODE_LOOP );
|
||||
menu_open( MENU_LEVEL_PASSED );
|
||||
|
||||
level_passed_score_str[1] = '0' + (game.score / 100) % 10;
|
||||
@ -419,7 +417,7 @@ void GameProcess() {
|
||||
|
||||
game_draw();
|
||||
|
||||
if (game.status == STATUS_MENU) {
|
||||
if ( (game.status == STATUS_MENU) && (game.menu_index != MENU_PAUSE) ) {
|
||||
soundbuf_loop_check( &game.sound_music );
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,7 @@ PRSFUNC0 menu_actions[] = {
|
||||
/* a */ &menu_action_start,
|
||||
/* b */ &menu_action_exit,
|
||||
/* c */ &menu_action_change_window_scale,
|
||||
// /* d */ &menu_action_
|
||||
/* d */ &menu_action_resume
|
||||
};
|
||||
|
||||
char window_scale_str[] = "c< 2X >";
|
||||
@ -67,6 +67,13 @@ char* menu_game_over_titles[] = {
|
||||
0
|
||||
};
|
||||
|
||||
char* menu_pause_titles[] = {
|
||||
" "L_PAUSE,
|
||||
" ",
|
||||
"d"L_RESUME,
|
||||
"0"L_EXIT_TO_MAIN_MENU,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
char **menu_titles[] = {
|
||||
@ -75,6 +82,7 @@ char **menu_titles[] = {
|
||||
/* 2 */ menu_about_titles,
|
||||
/* 3 */ menu_level_passed_titles,
|
||||
/* 4 */ menu_game_over_titles,
|
||||
/* 5 */ menu_pause_titles,
|
||||
0
|
||||
};
|
||||
|
||||
@ -105,6 +113,10 @@ void menu_cursor_up() {
|
||||
|
||||
void menu_open(int i) {
|
||||
|
||||
if ( (game.menu_index == MENU_PAUSE) && (i != MENU_PAUSE) ){
|
||||
soundbuf_play( &game.sound_music, SND_MODE_LOOP );
|
||||
};
|
||||
|
||||
game.menu_index = i;
|
||||
|
||||
game.menu_item_index = -1;
|
||||
@ -176,3 +188,9 @@ void menu_action_exit() {
|
||||
void menu_action_change_window_scale() {
|
||||
game_change_window_scale(1);
|
||||
};
|
||||
|
||||
void menu_action_resume() {
|
||||
|
||||
game.status = STATUS_PLAYING;
|
||||
|
||||
};
|
||||
|
@ -5,13 +5,14 @@
|
||||
#include "rs/rsplatform.h"
|
||||
|
||||
|
||||
#define MENUS_COUNT 5
|
||||
#define MENUS_COUNT 6
|
||||
|
||||
#define MENU_MAIN 0
|
||||
#define MENU_SETTINGS 1
|
||||
#define MENU_ABOUT 2
|
||||
#define MENU_LEVEL_PASSED 3
|
||||
#define MENU_GAME_OVER 4
|
||||
#define MENU_PAUSE 5
|
||||
|
||||
#define MENU_ITEM_WINDOW_SCALE 1
|
||||
|
||||
@ -32,5 +33,6 @@ void menu_cursor_click();
|
||||
void menu_action_start();
|
||||
void menu_action_exit();
|
||||
void menu_action_change_window_scale();
|
||||
void menu_action_resume();
|
||||
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define RS_STRINGS_H
|
||||
|
||||
#ifndef RS_KOS
|
||||
#include "strings_en.h"
|
||||
#include "strings_ru.h"
|
||||
#else
|
||||
|
||||
//#include "../lang.h"
|
||||
|
@ -28,9 +28,12 @@
|
||||
//#define L_TECHDEMO_LINE1 "THI5 I5 TECHDEM0` "
|
||||
#define L_TECHDEMO_LINE1 "U5E ARR0W5 T0 M0VE_ <A> T0 5H00T_ <E5C> T0 EXIT` "
|
||||
|
||||
#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"
|
||||
#define L_EXIT_TO_MAIN_MENU "EXIT T0 MAIN MENU"
|
||||
|
||||
#endif
|
||||
|
@ -32,4 +32,8 @@
|
||||
#define L_YOUR_SCORE "04K0B HAbPAH0:"
|
||||
#define L_GAME_OVER "igPA 0K0H4EHA"
|
||||
|
||||
#define L_PAUSE "nAY3A"
|
||||
#define L_RESUME "nP0d0ljiT]"
|
||||
#define L_EXIT_TO_MAIN_MENU "B\\^Ti B glABH0E MEHk"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user