/programs/games/heliothryx/Tupfile.lua |
---|
15,7 → 15,7 |
else C_LANG = "LANG_EN" -- default language is English |
end |
CFLAGS = CFLAGS .. " -DRS_KOS -D" .. C_LANG .. " " |
CFLAGS = CFLAGS .. " -Werror=implicit -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/rsgamelogic.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/rsgentex.c", "game/rssoundgen.c", "game/rsgame.c", "game/rsgamedraw.c", "game/rsgamelogic.c", "game/rskos.c", "game/rsgametext.c", "game/rsgamemenu.c"} |
link_gcc ("heliothryx") |
/programs/games/heliothryx/game/rs/rsplatform_kos.c |
---|
1,5 → 1,7 |
#include "rsplatform.h" |
#include "../rsgame.h" |
rs_app_t rs_app; |
186,7 → 188,7 |
if (!logic_halted) { |
if (key_up) { |
GameKeyUp(key, 1); |
GameKeyUp(key); |
} |
else { |
GameKeyDown(key); |
/programs/games/heliothryx/game/rsgame.c |
---|
185,6 → 185,10 |
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) { |
snd->status = 0; |
free(snd->data); |
259,6 → 263,8 |
game.player_y = 0; |
game.tz = 0; |
game.bg_color = COLOR_BLACK; |
// int i; |
// for (i = 0; i < BULLETS_COUNT; i++) { |
// game.bullet_x[i] = 0; |
520,9 → 526,59 |
soundbuf_sin(&game.sound_test3, 0.24); |
int soundlen = 55000; |
// int freqs[SOUND_EXPLOSIONS_COUNT] = { 440, 523, 587, 698, 783, 880, 1046, 1174 }; |
for (i = 0; i < SOUND_EXPLOSIONS_COUNT; i++) { |
soundbuf_init(&game.sound_explosions[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_EXPLOSIONS_COUNT, 6.0, 3.0, 2000.0, 1.73); |
rs_sgen_func_phaser(0, 2, 0.9, 16.2 + 0.5*i/SOUND_EXPLOSIONS_COUNT, 6.0, 3.0, 900.0, 0.93); |
rs_sgen_func_normalize(0, 1.0); |
rs_sgen_func_lowpass(2, 0, 0.6, 0.0, 20.0); |
rs_sgen_func_normalize(2, 1.0); |
rs_sgen_wave_out(2); |
memcpy(game.sound_explosions[i].data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2); |
soundbuf_update(&game.sound_explosions[i]); |
rs_sgen_term(); |
}; |
soundlen = 17888; |
soundbuf_init(&game.sound_hit, soundlen); |
rs_sgen_init(3, soundlen); |
rs_sgen_func_noise(2, 1000); |
rs_sgen_func_phaser(0, 2, 0.9, 11.5, 16.0, 13.0, 1300.0, 1.93); |
rs_sgen_func_normalize(0, 1.0); |
rs_sgen_func_highpass(2, 0, 1.0, 0.3, 20.0); |
rs_sgen_func_normalize(2, 1.0); |
rs_sgen_wave_out(2); |
memcpy(game.sound_hit.data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2); |
soundbuf_update(&game.sound_hit); |
rs_sgen_term(); |
}; |
void GameTerm() { |
564,7 → 620,7 |
void GameKeyDown(int key, int first) { |
void GameKeyDown(int key) { |
switch (key) { |
639,8 → 695,9 |
case RS_KEY_SPACE: |
#ifdef RS_LINUX |
game.stage_timer = 0; |
game.stage = 7; |
soundbuf_play( &game.sound_hit ); |
#endif |
//game_obj_add( game_obj( OBJ_EXPLOSION, 0, 0, 0, game.tx + 80, game.ty - 10, 0, 0.0 ) ); |
/programs/games/heliothryx/game/rsgame.h |
---|
19,23 → 19,13 |
#include "rskos.h" |
#include "rs/rsplatform.h" |
//#include "rs/rstexture.h" |
//#include "rs/rsshader.h" |
//#include "rs/rsgl.h" |
#include "rs/rsdebug.h" |
#include "rs/rsbits.h" |
//#include "rs/rskeyboard.h" |
#include "rsgamelogic.h" |
//#include "rs/rsaudio.h" |
//#include "rs/rsfile.h" |
//#include "rs/rsvbo.h" |
//#include "rs/rsfbo.h" |
//#include "rs/rsthread.h" |
#include "rs/rsmx.h" |
70,7 → 60,7 |
// for little-endian (ARGB) |
#define COLOR_BLACK 0xFF000000 |
#define COLOR_TRANSPARENT 0x00000000 |
#define COLOR_DARK_RED 0xFF660000 |
#define COLOR_DARK_RED 0xFF401000 |
174,6 → 164,8 |
#define GAME_FLAG_BOSS_DESTROYED 0x01 |
#define SOUND_EXPLOSIONS_COUNT 8 |
typedef struct rs_game_t { |
rs_texture_t framebuffer; |
unsigned char *scaled_framebuffer; // 24-bit BGRBGRBGR... for direct drawing |
193,11 → 185,15 |
rs_texture_t tex_gui_line; |
int bg_color; |
rs_soundbuf_t sound_test1; |
rs_soundbuf_t sound_test2; |
rs_soundbuf_t sound_test3; |
rs_soundbuf_t sound_explosions[SOUND_EXPLOSIONS_COUNT]; |
rs_soundbuf_t sound_hit; |
int status; |
int flags; |
243,6 → 239,14 |
extern rs_game_t game; |
void game_reg_init(); |
/* __ |
/cc\ |
/aaaa\ |
251,12 → 255,19 |
------------------------------- */ |
void game_ding(int i); |
void GameInit(); |
void GameTerm(); |
void GameKeyDown(int key, int first); |
void GameKeyDown(int key); |
void GameKeyUp(int key); |
void GameMouseDown(int x, int y); |
/programs/games/heliothryx/game/rsgamedraw.c |
---|
28,7 → 28,10 |
// }; |
texture_clear(&game.framebuffer, COLOR_BLACK); |
texture_clear(&game.framebuffer, game.bg_color ); |
game.bg_color = COLOR_BLACK; |
// texture_clear(&game.tex); |
// texture_draw(&game.framebuffer, &game.tex, 40, 40, DRAW_MODE_ADDITIVE); |
/programs/games/heliothryx/game/rsgamelogic.c |
---|
88,8 → 88,11 |
void player_hit() { |
game.health--; |
game.bg_color = COLOR_DARK_RED; |
soundbuf_play( &game.sound_hit ); |
if (game.health < 1) { |
game.status = STATUS_MENU; |
menu_open( MENU_GAME_OVER ); |
400,6 → 403,7 |
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 ] ); |
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--; |
/programs/games/heliothryx/game/rsgamemenu.c |
---|
160,6 → 160,8 |
game.objs_count = 0; |
game.bg_color = COLOR_BLACK; |
}; |
void menu_action_exit() { |