Marble Match-3 game update (pre-release version)

- added sounds
- changed gameplay mode to time attack

Added this game to menu. 



git-svn-id: svn://kolibrios.org@5251 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
alpine 2014-12-20 17:36:14 +00:00
parent cd411eab90
commit 3e8f7a119c
13 changed files with 372 additions and 197 deletions

View File

@ -36,6 +36,7 @@ Sudoku /sys/games/sudoku
Go-moku /sys/games/gomoku Go-moku /sys/games/gomoku
Reversi /sys/games/reversi Reversi /sys/games/reversi
Pharaoh's crypt /KolibriOS/games/fara/fara Pharaoh's crypt /KolibriOS/games/fara/fara
Marble Match-3 /KolibriOS/games/marblematch3/marblematch3
Sokoban /KolibriOS/games/soko/soko Sokoban /KolibriOS/games/soko/soko
#3 **** ARCADES **** #3 **** ARCADES ****
Tetris /sys/games/tetris Tetris /sys/games/tetris

View File

@ -36,6 +36,7 @@ Sudoku /sys/games/sudoku
Go-moku /sys/games/gomoku Go-moku /sys/games/gomoku
Reversi /sys/games/reversi Reversi /sys/games/reversi
Pharaoh's crypt /KolibriOS/games/fara/fara Pharaoh's crypt /KolibriOS/games/fara/fara
Marble Match-3 /KolibriOS/games/marblematch3/marblematch3
Sokoban /KolibriOS/games/soko/soko Sokoban /KolibriOS/games/soko/soko
#3 **** ARCADES **** #3 **** ARCADES ****
Tetris /sys/games/tetris Tetris /sys/games/tetris

View File

@ -36,6 +36,7 @@ Sudoku /sys/games/sudoku
Go-moku /sys/games/gomoku Go-moku /sys/games/gomoku
Reversi /sys/games/reversi Reversi /sys/games/reversi
Pharaoh's crypt /KolibriOS/games/fara/fara Pharaoh's crypt /KolibriOS/games/fara/fara
Marble Match-3 /KolibriOS/games/marblematch3/marblematch3
Sokoban /KolibriOS/games/soko/soko Sokoban /KolibriOS/games/soko/soko
#3 **** ARCADES **** #3 **** ARCADES ****
Tetris /sys/games/tetris Tetris /sys/games/tetris

View File

@ -39,6 +39,7 @@ Flood-it! /sys/games/flood-it
#3 **** ˆ£àë -> €àª ¤ë **** #3 **** ˆ£àë -> €àª ¤ë ****
ArcanII /sys/games/arcanii ArcanII /sys/games/arcanii
Pharaoh's crypt /KolibriOS/games/fara/fara Pharaoh's crypt /KolibriOS/games/fara/fara
Marble Match-3 /KolibriOS/games/marblematch3/marblematch3
Sokoban /KolibriOS/games/soko/soko Sokoban /KolibriOS/games/soko/soko
Red Square /sys/games/rsquare Red Square /sys/games/rsquare
<EFBFBD> ¤¥­¨¥ /sys/games/padenie <EFBFBD> ¤¥­¨¥ /sys/games/padenie

View File

@ -36,6 +36,7 @@ Sudoku /sys/games/sudoku
Go-moku /sys/games/gomoku Go-moku /sys/games/gomoku
Reversi /sys/games/reversi Reversi /sys/games/reversi
Pharaoh's crypt /KolibriOS/games/fara/fara Pharaoh's crypt /KolibriOS/games/fara/fara
Marble Match-3 /KolibriOS/games/marblematch3/marblematch3
Sokoban /KolibriOS/games/soko/soko Sokoban /KolibriOS/games/soko/soko
#3 **** ARCADES **** #3 **** ARCADES ****
Tetris /sys/games/tetris Tetris /sys/games/tetris

View File

@ -17,5 +17,5 @@ end
CFLAGS = CFLAGS .. " -DRS_KOS -D" .. C_LANG .. " " CFLAGS = CFLAGS .. " -DRS_KOS -D" .. C_LANG .. " "
compile_gcc{ "system/kolibri.c", "game/rs/rsmicrolibc.c", "game/rs/rsplatform_kos.c", "game/rs/rsmx.c", "game/rsnoise.c", "game/rsgentex.c", "game/rsgame.c", "game/rsgamedraw.c", "game/rskos.c", "game/rsgametext.c", "game/rsgamemenu.c"} compile_gcc{ "system/kolibri.c", "game/rs/rsmicrolibc.c", "game/rs/rsplatform_kos.c", "game/rs/rsmx.c", "game/rsnoise.c", "game/rssoundgen.c", "game/rsgentex.c", "game/rsgame.c", "game/rsgamedraw.c", "game/rskos.c", "game/rsgametext.c", "game/rsgamemenu.c"}
link_gcc ("marblematch3") link_gcc ("marblematch3")

View File

@ -148,6 +148,10 @@ void soundbuf_init(rs_soundbuf_t *snd, int length_samples) {
rskos_snd_create_buffer(&snd->hbuf, snd->data, length_samples); rskos_snd_create_buffer(&snd->hbuf, snd->data, length_samples);
}; };
void soundbuf_update(rs_soundbuf_t *snd) {
rskos_snd_update_buffer(&snd->hbuf, snd->data, snd->length_samples);
};
void soundbuf_free(rs_soundbuf_t *snd) { void soundbuf_free(rs_soundbuf_t *snd) {
snd->status = 0; snd->status = 0;
free(snd->data); free(snd->data);
@ -217,21 +221,27 @@ void game_reg_init() {
game.loader_counter = 0; game.loader_counter = 0;
game.menu_replay_timeout = 0;
game.process_timer = 0; game.process_timer = 0;
game.sound_index = 0;
game.need_redraw = 1; game.need_redraw = 1;
game.score = 0; game.score = 0;
game.time = 0; game.time = 0;
// game.game_mode = GAME_MODE_RAMPAGE;
game.selected = 0; game.selected = 0;
game.selected_x = game.selected_y = 0; game.selected_x = game.selected_y = 0;
game.explosions_count = 0; game.explosions_count = 0;
game.tx = 0; // game.tx = 0;
game.ty = 0; // game.ty = 0;
game.tz = 0; // game.tz = 0;
// int i; // int i;
// for (i = 0; i < BULLETS_COUNT; i++) { // for (i = 0; i < BULLETS_COUNT; i++) {
@ -252,8 +262,8 @@ void game_reg_init() {
game.keyboard_state = 0; game.keyboard_state = 0;
game.menu_index = 0; // game.menu_index = 0;
game.menu_item_index = 0; // game.menu_item_index = 0;
}; };
@ -351,18 +361,28 @@ int game_check_and_explode() {
}; };
}; };
if (game.score > 99) { // if (game.score > 99) {
game.status = STATUS_MENU; // game.status = STATUS_MENU;
game.need_redraw = 1; // game.need_redraw = 1;
}; // };
if (found) { if (found) {
game.need_redraw = 1; game.need_redraw = 1;
soundbuf_play(&game.sound_explosion[ game.sound_index ]);
game.sound_index = (game.sound_index+1) % SOUND_EXPLOSION_COUNT;
}; };
return found; return found;
}; };
//void game_check_and_explode_rampage() {
//
//
//
//};
void game_fall() { void game_fall() {
int x, y, fall; int x, y, fall;
for (x = 0; x < FIELD_WIDTH; x++) { for (x = 0; x < FIELD_WIDTH; x++) {
@ -394,6 +414,83 @@ void GameProcess() {
game_textures_init_stage2(); game_textures_init_stage2();
// Sounds...
int soundlen = 40555;
int freqs[SOUND_EXPLOSION_COUNT] = { 440, 523, 587, 698, 783, 880, 1046, 1174 };
int i;
for (i = 0; i < SOUND_EXPLOSION_COUNT; i++) {
soundbuf_init(&game.sound_explosion[i], 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_EXPLOSION_COUNT, 6.0, 3.0, 2000.0, 1.73);
rs_sgen_func_normalize(0, 1.0);
rs_sgen_func_sin(1, freqs[i], 110.3);
rs_sgen_func_sin(2, 1.5*freqs[i], 110.2);
rs_sgen_func_add(0, 0, 1, 1.0, 0.2);
rs_sgen_func_add(0, 0, 2, 1.0, 0.2);
rs_sgen_func_lowpass(2, 0, 1.0, 0.0, 20.0);
rs_sgen_func_normalize(2, 1.0);
rs_sgen_wave_out(2);
memcpy(game.sound_explosion[i].data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2);
soundbuf_update(&game.sound_explosion[i]);
rs_sgen_term();
};
soundlen = 1024;
soundbuf_init(&game.sound_tick, soundlen);
// soundbuf_init(&game.sound_tack, soundlen);
rs_sgen_init(2, soundlen);
rs_sgen_func_noise(1, 1000);
rs_sgen_func_highpass(0, 1, 0.05, 0.0, 16.0);
rs_sgen_func_normalize(0, 1.0);
rs_sgen_wave_out(0);
memcpy(game.sound_tick.data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2);
soundbuf_update(&game.sound_tick);
// rs_sgen_func_lowpass(0, 1, 0.5, 0.0, 22.0);
// rs_sgen_func_normalize(0, 1.0);
// rs_sgen_wave_out(0);
// memcpy(game.sound_tack.data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2);
// soundbuf_update(&game.sound_tack);
rs_sgen_term();
soundlen = 123000;
soundbuf_init(&game.sound_bang, soundlen);
rs_sgen_init(2, soundlen);
rs_sgen_func_pm(1, 220.0, 1.2, 1.0, 880.0*4, 1.0 );
rs_sgen_func_lowpass(0, 1, 1.0, 0.0, 15.0);
rs_sgen_func_normalize(0, 1.0);
rs_sgen_wave_out(0);
memcpy(game.sound_bang.data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2);
soundbuf_update(&game.sound_bang);
soundbuf_init(&game.sound_click, 1024);
soundbuf_sin(&game.sound_click, 0.25);
soundbuf_play(&game.sound_bang); // <-- Loaded. Bang!
game.status = STATUS_MENU; game.status = STATUS_MENU;
game.need_redraw = 1; game.need_redraw = 1;
@ -421,15 +518,38 @@ void GameProcess() {
}; };
}; };
if ((game.time+1)/25 != game.time/25) { if ((game.time-1)/25 != game.time/25) {
game.need_redraw = 1; game.need_redraw = 1;
if (game.time < 10*25) {
soundbuf_play(&game.sound_tick);
};
}; };
game.time++; game.time--;
if (game.time < 1) {
// Game Over
game.status = STATUS_MENU;
game.need_redraw = 1;
soundbuf_play(&game.sound_bang);
game.menu_replay_timeout = 40;
};
}
else if (game.status == STATUS_MENU) {
if (game.menu_replay_timeout > 0) {
game.menu_replay_timeout--;
if (game.menu_replay_timeout == 1) {
game.menu_replay_timeout = 0;
game.need_redraw = 1;
};
};
}; };
game_draw(); game_draw();
@ -463,17 +583,8 @@ void GameInit() {
rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 0); rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 0);
#endif #endif
soundbuf_init(&game.sound_test1, 2048);
// soundbuf_fill(&game.sound_test1, 2, 50);
soundbuf_sin_fade(&game.sound_test1, 0.7);
soundbuf_init(&game.sound_test2, 1024);
//soundbuf_fill(&game.sound_test2, 8, 40);
soundbuf_sin(&game.sound_test2, 0.48);
soundbuf_init(&game.sound_test3, 1024);
//soundbuf_fill(&game.sound_test3, 12, 60);
soundbuf_sin(&game.sound_test3, 0.24);
}; };
@ -495,12 +606,16 @@ void GameTerm() {
game_textures_free(); game_textures_free();
int i;
for (i = 0; i < SOUND_EXPLOSION_COUNT; i++) {
soundbuf_free(&game.sound_explosion[i]);
};
soundbuf_free(&game.sound_click);
soundbuf_free(&game.sound_test1); soundbuf_free(&game.sound_tick);
soundbuf_free(&game.sound_test2); // soundbuf_free(&game.sound_tack);
soundbuf_free(&game.sound_test3); soundbuf_free(&game.sound_bang);
}; };
@ -540,35 +655,35 @@ void GameKeyDown(int key, int first) {
}; };
if (game.status == STATUS_MENU) { // if (game.status == STATUS_MENU) {
//
switch (key) { // switch (key) {
case RS_KEY_LEFT: // case RS_KEY_LEFT:
BIT_SET(game.keyboard_state, RS_ARROW_LEFT_MASK); // BIT_SET(game.keyboard_state, RS_ARROW_LEFT_MASK);
//PlayBuffer(hBuff, 0); // //PlayBuffer(hBuff, 0);
break; // break;
case RS_KEY_RIGHT: // case RS_KEY_RIGHT:
BIT_SET(game.keyboard_state, RS_ARROW_RIGHT_MASK); // BIT_SET(game.keyboard_state, RS_ARROW_RIGHT_MASK);
//StopBuffer(hBuff); // //StopBuffer(hBuff);
break; // break;
case RS_KEY_UP: // case RS_KEY_UP:
BIT_SET(game.keyboard_state, RS_ARROW_UP_MASK); // BIT_SET(game.keyboard_state, RS_ARROW_UP_MASK);
menu_cursor_up(); // menu_cursor_up();
//ResetBuffer(hBuff, 0); // //ResetBuffer(hBuff, 0);
break; // break;
case RS_KEY_DOWN: // case RS_KEY_DOWN:
BIT_SET(game.keyboard_state, RS_ARROW_DOWN_MASK); // BIT_SET(game.keyboard_state, RS_ARROW_DOWN_MASK);
menu_cursor_down(); // menu_cursor_down();
break; // break;
case RS_KEY_RETURN: // case RS_KEY_RETURN:
menu_cursor_click(); // menu_cursor_click();
break; // break;
case RS_KEY_ESCAPE: // case RS_KEY_ESCAPE:
menu_open(0); // menu_open(0);
break; // break;
}; // };
//
}; // };
if (game.status == STATUS_PLAYING) { if (game.status == STATUS_PLAYING) {
@ -577,6 +692,7 @@ void GameKeyDown(int key, int first) {
if (key == RS_KEY_SPACE) { if (key == RS_KEY_SPACE) {
game.score = 101; game.score = 101;
}; };
#endif #endif
if (key == RS_KEY_ESCAPE) { if (key == RS_KEY_ESCAPE) {
@ -586,6 +702,13 @@ void GameKeyDown(int key, int first) {
game.need_redraw = 1; game.need_redraw = 1;
}; };
if (key == RS_KEY_A) {
soundbuf_play(&game.sound_bang);
};
// if (key == RS_KEY_Z) {
// soundbuf_play(&game.sound_tack);
// };
}; };
}; };
@ -621,23 +744,31 @@ typedef struct {
void GameMouseDown(int x, int y) { void GameMouseDown(int x, int y) {
x = (signed short) x;
y = (signed short) y;
game.need_redraw = 1; game.need_redraw = 1;
game.tx = x; // game.tx = x;
game.ty = y; // game.ty = y;
if (game.status == STATUS_MENU) { if (game.status == STATUS_MENU) {
int i; if ( (!game.menu_replay_timeout) && (y > 0) ) {
for (i = 0; i < FIELD_LENGTH; i++) {
game.field[i] = (unsigned char) (0.99 * fabs(rs_noise(i, seed*7 + 10)) * CRYSTALS_COUNT) | CRYSTAL_VISIBLE_BIT; int i;
for (i = 0; i < FIELD_LENGTH; i++) {
game.field[i] = (unsigned char) (0.99 * fabs(rs_noise(i, seed*7 + 10)) * CRYSTALS_COUNT) | CRYSTAL_VISIBLE_BIT;
};
game.sound_index = 0;
game.selected = 0;
game.time = 25*60 - 1;
game.score = 0;
game.status = STATUS_PLAYING;
}; };
game.selected = 0;
game.time = 0;
game.score = 0;
game.status = STATUS_PLAYING;
return; return;
}; };
@ -655,49 +786,59 @@ void GameMouseDown(int x, int y) {
//FIELD_ITEM(field_x, field_y) = 0; //FIELD_ITEM(field_x, field_y) = 0;
if (!game.selected) {
game.selected = 1;
game.selected_x = field_x;
game.selected_y = field_y;
} // if (game.game_mode == GAME_MODE_MATCH3) {
else {
if ( abs(game.selected_x - field_x) + abs(game.selected_y - field_y) == 1 ) {
game.selected = 0;
// Trying to swap
int temp_crystal = FIELD_ITEM(field_x, field_y);
FIELD_ITEM(field_x, field_y) = FIELD_ITEM(game.selected_x, game.selected_y);
FIELD_ITEM(game.selected_x, game.selected_y) = temp_crystal;
if ( !game_check_and_explode() ) {
FIELD_ITEM(game.selected_x, game.selected_y) = FIELD_ITEM(field_x, field_y);
FIELD_ITEM(field_x, field_y) = temp_crystal;
}
else {
// success
game.process_timer = 0;
};
if (!game.selected) {
game.selected = 1;
game.selected_x = field_x;
game.selected_y = field_y;
soundbuf_play(&game.sound_click);
} }
else { else {
if ( (game.selected_x != field_x) && (game.selected_y != field_y) ) {
game.selected_x = field_x; if ( abs(game.selected_x - field_x) + abs(game.selected_y - field_y) == 1 ) {
game.selected_y = field_y; game.selected = 0;
// Trying to swap
int temp_crystal = FIELD_ITEM(field_x, field_y);
FIELD_ITEM(field_x, field_y) = FIELD_ITEM(game.selected_x, game.selected_y);
FIELD_ITEM(game.selected_x, game.selected_y) = temp_crystal;
if ( !game_check_and_explode() ) {
FIELD_ITEM(game.selected_x, game.selected_y) = FIELD_ITEM(field_x, field_y);
FIELD_ITEM(field_x, field_y) = temp_crystal;
}
else {
// success
game.process_timer = 0;
};
} }
else { else {
game.selected = 0; soundbuf_play(&game.sound_click);
if ( (game.selected_x != field_x) && (game.selected_y != field_y) ) {
game.selected_x = field_x;
game.selected_y = field_y;
}
else {
game.selected = 0;
};
}; };
}; };
}; // } else if (game.mode == GAME_MODE_RAMPAGE) {
//
// int i; // game.selected = 1;
// for (i = field_y; i > 0; i--) { // game.selected_x = field_x;
// FIELD_ITEM(field_x, i) = FIELD_ITEM(field_x, (i-1) ); // game.selected_y = field_y;
//
// game_check_and_explode_rampage();
//
// }; // };
// FIELD_ITEM(field_x, 0) = 0;
}; };
@ -712,10 +853,10 @@ void game_ding(int i) {
switch (i) { switch (i) {
case 0: case 0:
soundbuf_play(&game.sound_test2); // soundbuf_play(&game.sound_test2);
break; break;
case 1: case 1:
soundbuf_play(&game.sound_test3); // soundbuf_play(&game.sound_test3);
break; break;
}; };

View File

@ -116,11 +116,11 @@ void soundbuf_stop(rs_soundbuf_t *snd);
#define GAME_SHOOT_PERIOD 3 #define GAME_SHOOT_PERIOD 3
#define FIELD_WIDTH 10 #define FIELD_WIDTH 11
#define FIELD_HEIGHT 8 #define FIELD_HEIGHT 8
#define FIELD_LENGTH (FIELD_WIDTH * FIELD_HEIGHT) #define FIELD_LENGTH (FIELD_WIDTH * FIELD_HEIGHT)
#define CRYSTAL_SIZE 40 #define CRYSTAL_SIZE 40
#define FIELD_X0 56 #define FIELD_X0 36
#define FIELD_Y0 128 #define FIELD_Y0 128
#define FIELD_ITEM(x,y) (game.field[(y)*FIELD_WIDTH+(x)]) #define FIELD_ITEM(x,y) (game.field[(y)*FIELD_WIDTH+(x)])
@ -137,6 +137,11 @@ void soundbuf_stop(rs_soundbuf_t *snd);
#define ANIMATION_PROCESS_TIMER_LIMIT 3 #define ANIMATION_PROCESS_TIMER_LIMIT 3
#define SOUND_EXPLOSION_COUNT 8
//#define GAME_MODE_MATCH3 0
//#define GAME_MODE_RAMPAGE 1
typedef struct rs_game_t { typedef struct rs_game_t {
rs_texture_t framebuffer; rs_texture_t framebuffer;
unsigned char *bgr_framebuffer; // 24-bit BGRBGRBGR... for direct drawing unsigned char *bgr_framebuffer; // 24-bit BGRBGRBGR... for direct drawing
@ -156,24 +161,27 @@ typedef struct rs_game_t {
rs_texture_t tex_font[64*FONTS_COUNT]; rs_texture_t tex_font[64*FONTS_COUNT];
rs_soundbuf_t sound_test1; int sound_index;
rs_soundbuf_t sound_test2; rs_soundbuf_t sound_explosion[SOUND_EXPLOSION_COUNT];
rs_soundbuf_t sound_test3; rs_soundbuf_t sound_tick;
// rs_soundbuf_t sound_tack;
rs_soundbuf_t sound_click;
rs_soundbuf_t sound_bang;
int status; int status;
// int game_mode;
int menu_replay_timeout;
unsigned int keyboard_state; unsigned int keyboard_state;
int menu_index; // int menu_index;
int menu_item_index; // int menu_item_index;
// int window_scale;
int process_timer; int process_timer;
int tx; // int tx;
int ty; // int ty;
int tz; // int tz;
unsigned char *field; unsigned char *field;

View File

@ -28,40 +28,44 @@ void game_draw() {
texture_draw(&game.framebuffer, &game.tex_bg, 0, 0, DRAW_MODE_REPLACE); texture_draw(&game.framebuffer, &game.tex_bg, 0, 0, DRAW_MODE_REPLACE);
if (game.menu_index == MENU_MAIN) {
if (game.status == STATUS_LOADING) { if (game.status == STATUS_LOADING) {
game_textout_at_center( 0, 240, 0, L_LOADING ); game_textout_at_center( 0, 240, 0, L_LOADING );
game_textout_at_center( -3, 240-2, 3, L_LOADING ); game_textout_at_center( -3, 240-2, 3, L_LOADING );
} }
else { else {
texture_draw( &game.framebuffer, &game.tex_logo, 0, 50, DRAW_MODE_ALPHA ); texture_draw( &game.framebuffer, &game.tex_logo, 0, 50, DRAW_MODE_ALPHA );
if (game.time) { if (game.score) {
game_textout_at_center( 0, 230, 0, L_LEVEL_PASSED );
game_textout_at_center( -3, 230-2, 3, L_LEVEL_PASSED );
char s[] = L_TIME; game_textout_at_center( 0, 230, 0, L_GAME_OVER );
int time_sec = game.time / 25; game_textout_at_center( -3, 230-2, 3, L_GAME_OVER );
char *str_num = strchr(s, 'x');
str_num[0] = '0' + (( time_sec / 100 ) % 10);
str_num[1] = '0' + (( time_sec / 10 ) % 10);
str_num[2] = '0' + (( time_sec / 1 ) % 10);
game_textout_at_center( 0, 260, 0, s );
game_textout_at_center( -3, 260-2, 3, s );
};
game_textout_at_center( 0, 300, 0, L_START ); char s[] = L_SCORE;
game_textout_at_center( -3, 300-2, 3, L_START ); char *str_num;
str_num = strchr(s, 'x');
str_num[0] = '0' + ( (game.score / 100) % 10);
str_num[1] = '0' + ( (game.score / 10) % 10);
str_num[2] = '0' + ( (game.score / 1) % 10);
game_textout_at_center( 0, 260, 0, s );
game_textout_at_center( -3, 260-2, 3, s );
}; };
game_textout( 2, GAME_HEIGHT-10, 2, L_BOTTOM_LINE_DEVELOPER_INFO); if (!game.menu_replay_timeout) {
game_textout_at_center( 0, 300, 0, L_START );
game_textout_at_center( -3, 300-2, 3, L_START );
};
}; };
game_textout( 2, GAME_HEIGHT-10, 2, L_BOTTOM_LINE_DEVELOPER_INFO);
} }
else { else {
@ -94,16 +98,33 @@ void game_draw() {
}; };
char str[] = L_TIME;
int time_sec = game.time / 25;
char *str_num = strchr(str, 'x');
str_num[0] = '0' + ( (time_sec / 100) % 10);
str_num[1] = '0' + ( (time_sec / 10) % 10);
str_num[2] = '0' + ( (time_sec / 1) % 10);
game_textout( 56+3, 32+2, 0, str ); int blink_visible = 0;
// game_textout( 56-1, 32-1, 0, str ); if (game.time > 10*25) {
game_textout( 56, 32, 3, str ); blink_visible = 1;
}
else if (game.time > 5*25) {
blink_visible = (game.time / 8) & 1;
continue_need_redraw = 1;
}
else {
blink_visible = (game.time / 4) & 1;
continue_need_redraw = 1;
};
char *str_num;
if (blink_visible) {
char str[] = L_TIME;
int time_sec = game.time / 25;
str_num = strchr(str, 'x');
str_num[0] = '0' + ( (time_sec / 10) % 10);
str_num[1] = '0' + ( (time_sec / 1) % 10);
// str_num[2] = '0' + ( (time_sec / 1) % 10);
game_textout( 56+3, 32+2, 0, str );
game_textout( 56, 32, 3, str );
};
char sstr[] = L_SCORE; char sstr[] = L_SCORE;

View File

@ -57,46 +57,46 @@ char **menu_titles[] = {
}; };
void menu_cursor_down() { //void menu_cursor_down() {
int new_index = game.menu_item_index+1; // int new_index = game.menu_item_index+1;
while ( (menu_titles[game.menu_index][new_index]) ) { // while ( (menu_titles[game.menu_index][new_index]) ) {
if ((menu_titles[game.menu_index][new_index][0] != ' ')) { // if ((menu_titles[game.menu_index][new_index][0] != ' ')) {
game.menu_item_index = new_index; // game.menu_item_index = new_index;
game_ding(1); // game_ding(1);
return; // return;
}; // };
new_index++; // new_index++;
}; // };
}; //};
//
//void menu_cursor_up() {
// int new_index = game.menu_item_index-1;
// while ( new_index+1 ) {
// if ((menu_titles[game.menu_index][new_index][0] != ' ')) {
// game.menu_item_index = new_index;
// game_ding(1);
// return;
// };
// new_index--;
// };
//};
void menu_cursor_up() { //void menu_open(int i) {
int new_index = game.menu_item_index-1; //
while ( new_index+1 ) { // game.menu_index = i;
if ((menu_titles[game.menu_index][new_index][0] != ' ')) { //
game.menu_item_index = new_index; // game.menu_item_index = -1;
game_ding(1); // // (menu_cursor_down without sound)
return; // int new_index = game.menu_item_index+1;
}; // while ( (menu_titles[game.menu_index][new_index]) ) {
new_index--; // if ((menu_titles[game.menu_index][new_index][0] != ' ')) {
}; // game.menu_item_index = new_index;
}; // return;
// };
void menu_open(int i) { // new_index++;
// };
game.menu_index = i; //
//};
game.menu_item_index = -1;
// (menu_cursor_down without sound)
int new_index = game.menu_item_index+1;
while ( (menu_titles[game.menu_index][new_index]) ) {
if ((menu_titles[game.menu_index][new_index][0] != ' ')) {
game.menu_item_index = new_index;
return;
};
new_index++;
};
};
void menu_cursor_click() { void menu_cursor_click() {
@ -107,8 +107,8 @@ void menu_cursor_click() {
void menu_action_start() { void menu_action_start() {
game.status = STATUS_PLAYING; game.status = STATUS_PLAYING;
game.tx = GAME_WIDTH/2 - 50; // game.tx = GAME_WIDTH/2 - 50;
game.ty = GAME_HEIGHT/2 - 10; // game.ty = GAME_HEIGHT/2 - 10;
}; };

View File

@ -285,7 +285,7 @@ void rs_gen_func_normalmap(int dest_r, int dest_g, int dest_b, int src, float k)
////// }; ////// };
////// }; ////// };
DEBUG10f("\n\nmax val %.3f \nmin %.3f \n", max_val, min_val); // DEBUG10f("\n\nmax val %.3f \nmin %.3f \n", max_val, min_val);
}; };

View File

@ -12,10 +12,10 @@
#define L_START "CLICK T0 5TART" #define L_START "CLICK T0 5TART"
#define L_TIME "TIME: xxx" #define L_TIME "TIME: 0:xx"
#define L_SCORE "5C0RE: xxx 0F 100" #define L_SCORE "5C0RE: xxx"
#define L_LEVEL_PASSED "LEVEL PA55ED" #define L_GAME_OVER "GAME 0VER"
#define L_BOTTOM_LINE_DEVELOPER_INFO "DEVELOPER: ROMAN SHUVALOV` TOGLIATTI_ 2014" #define L_BOTTOM_LINE_DEVELOPER_INFO "DEVELOPER: ROMAN SHUVALOV` TOGLIATTI_ 2014"

View File

@ -12,10 +12,10 @@
#define L_START "HA4AT] igPY" #define L_START "HA4AT] igPY"
#define L_TIME "BPEMa: xxx" #define L_TIME "BPEMa: 0:xx "
#define L_SCORE "04Ki: xxx i3 100" #define L_SCORE "04Ki: xxx"
#define L_LEVEL_PASSED "YP0BEH] nP0^dEH" #define L_GAME_OVER "igPA 0K0H4EHA"
#define L_BOTTOM_LINE_DEVELOPER_INFO "PA3PAb0T4iK: P0MAH hYBAl0B` T0l]aTTi_ 2014" #define L_BOTTOM_LINE_DEVELOPER_INFO "PA3PAb0T4iK: P0MAH hYBAl0B` T0l]aTTi_ 2014"